From 1daee47c682403e57567a4817bef896799280192 Mon Sep 17 00:00:00 2001 From: guiltygyoza <59590480+guiltygyoza@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:01:46 +0800 Subject: [PATCH] Simplify grid ui (#278) Co-authored-by: droak --- examples/grid/index.html | 23 ++++++++++++++--------- examples/grid/src/index.ts | 8 +++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/examples/grid/index.html b/examples/grid/index.html index 7cb2c8b3..9a20fbc3 100644 --- a/examples/grid/index.html +++ b/examples/grid/index.html @@ -7,21 +7,26 @@
-

A 2D grid made with DRP

+

GRID

Your Peer ID:

-

Peers on dRAM:

-

Discovery Peers:

+

Your Peers:

+

Your Discovery Peers:

- - | - -

- Connected to Grid DRP ID: + + + + + +

+ +

+ + +

-

Peers in DRP:

{ const render = () => { if (drpObject) { + const gridIdTextElement = ( + document.getElementById("gridIdText") + ); + gridIdTextElement.innerText = `You're in GRID ID:`; const gridIdElement = document.getElementById("gridId"); gridIdElement.innerText = drpObject.id; const copyGridIdButton = document.getElementById("copyGridId"); @@ -73,7 +77,9 @@ const render = () => { const element_objectPeers = ( document.getElementById("objectPeers") ); - element_objectPeers.innerHTML = `[${objectPeers.map((peer) => `${formatNodeId(peer)}`).join(", ")}]`; + element_objectPeers.innerHTML = !gridDRP + ? "" + : `Your frens in GRID: [${objectPeers.map((peer) => `${formatNodeId(peer)}`).join(", ")}]`; if (!gridDRP) return; const users = gridDRP.getUsers();