From 92cfabff6ead259d28e19502905aa6b5706c726c Mon Sep 17 00:00:00 2001 From: Rushikesh Nimkar Date: Thu, 12 Sep 2024 02:11:58 +0530 Subject: [PATCH] fix : ui usernode page --- components/nodedataDwifiUser.js | 31 +++++++++++++++++++++++++++++-- pnpm-lock.yaml | 22 +++++++++++----------- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/components/nodedataDwifiUser.js b/components/nodedataDwifiUser.js index 035d221..a481d82 100644 --- a/components/nodedataDwifiUser.js +++ b/components/nodedataDwifiUser.js @@ -6,6 +6,7 @@ import Link from "next/link"; import { ethers } from 'ethers'; import contractABI from '../components/peaqabi/contractABI.json'; + const contractAddress = '0x5940445e1e8A419ebea10B45c5d1C0F603926F41'; const NodeDwifiStreamUser = () => { @@ -16,6 +17,7 @@ const NodeDwifiStreamUser = () => { const [error, setError] = useState(null); const [editingNode, setEditingNode] = useState(null); const [isSaving, setIsSaving] = useState(false); + const [expandedLocations, setExpandedLocations] = useState({}); useEffect(() => { checkConnection(); @@ -94,6 +96,13 @@ const NodeDwifiStreamUser = () => { const handleEdit = (node) => { setEditingNode(node); }; + const toggleLocation = (id) => { + setExpandedLocations(prev => ({ + ...prev, + [id]: !prev[id] + })); + }; + const handleSave = async (updatedNode) => { setError(null); @@ -262,8 +271,26 @@ const NodeDwifiStreamUser = () => { {item.isActive ? "Online" : "Offline"} - {item.location} - {item.pricePerMinute} ETH + + {expandedLocations[item.id] ? ( + {item.location} + ) : ( + + {item.location.length > 20 + ? `${item.location.slice(0, 20)}...` + : item.location} + + )} + {item.location.length > 20 && ( + + )} + + {item.pricePerMinute} AGNG {new Date(item.connectedAt).toLocaleString()} {new Date(item.lastChecked).toLocaleString()} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d65fbe0..e3d45a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13171,7 +13171,7 @@ snapshots: chalk: 4.1.2 ci-info: 3.9.0 connect: 3.7.0 - debug: 4.3.4 + debug: 4.3.7 env-editor: 0.4.2 fast-glob: 3.3.2 find-yarn-workspace-root: 2.0.0 @@ -13262,7 +13262,7 @@ snapshots: '@expo/plist': 0.1.3 '@expo/sdk-runtime-versions': 1.0.0 chalk: 4.1.2 - debug: 4.3.4 + debug: 4.3.7 find-up: 5.0.0 getenv: 1.0.0 glob: 7.1.6 @@ -13332,7 +13332,7 @@ snapshots: '@expo/env@0.3.0': dependencies: chalk: 4.1.2 - debug: 4.3.4 + debug: 4.3.7 dotenv: 16.4.5 dotenv-expand: 11.0.6 getenv: 1.0.0 @@ -13383,7 +13383,7 @@ snapshots: '@expo/json-file': 8.3.3 '@expo/spawn-async': 1.7.2 chalk: 4.1.2 - debug: 4.3.4 + debug: 4.3.7 find-yarn-workspace-root: 2.0.0 fs-extra: 9.1.0 getenv: 1.0.0 @@ -13409,7 +13409,7 @@ snapshots: find-up: 5.0.0 find-yarn-workspace-root: 2.0.0 js-yaml: 3.14.1 - micromatch: 4.0.5 + micromatch: 4.0.8 npm-package-arg: 7.0.0 ora: 3.4.0 split: 1.0.1 @@ -13429,7 +13429,7 @@ snapshots: '@expo/image-utils': 0.5.1(encoding@0.1.13) '@expo/json-file': 8.3.3 '@react-native/normalize-colors': 0.74.83 - debug: 4.3.4 + debug: 4.3.7 expo-modules-autolinking: 1.11.1 fs-extra: 9.1.0 resolve-from: 5.0.0 @@ -20993,7 +20993,7 @@ snapshots: find-yarn-workspace-root@2.0.0: dependencies: - micromatch: 4.0.5 + micromatch: 4.0.8 flat-cache@3.2.0: dependencies: @@ -22103,7 +22103,7 @@ snapshots: '@types/stack-utils': 2.0.3 chalk: 4.1.2 graceful-fs: 4.2.11 - micromatch: 4.0.5 + micromatch: 4.0.8 pretty-format: 29.7.0 slash: 3.0.0 stack-utils: 2.0.6 @@ -22200,7 +22200,7 @@ snapshots: chalk: 4.1.2 flow-parser: 0.235.1 graceful-fs: 4.2.11 - micromatch: 4.0.5 + micromatch: 4.0.8 neo-async: 2.6.2 node-dir: 0.1.17 recast: 0.21.5 @@ -22771,7 +22771,7 @@ snapshots: graceful-fs: 4.2.11 invariant: 2.2.4 jest-worker: 29.7.0 - micromatch: 4.0.5 + micromatch: 4.0.8 node-abort-controller: 3.1.1 nullthrows: 1.1.1 walker: 1.0.8 @@ -24797,7 +24797,7 @@ snapshots: retry-request@5.0.2: dependencies: - debug: 4.3.4 + debug: 4.3.7 extend: 3.0.2 transitivePeerDependencies: - supports-color