From c565eaca36aff6e374abd824c05783c3814f06a5 Mon Sep 17 00:00:00 2001 From: Juan Di Toro Date: Sat, 30 Sep 2023 12:18:49 +0200 Subject: [PATCH] fix: finish the dashboard style --- src/assets/lume-logo.png | Bin 0 -> 2592 bytes .../lume/LumeDashboard/LumeDashboard.tsx | 70 +++++++++++++----- src/components/lume/LumeProvider.tsx | 16 ++-- 3 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 src/assets/lume-logo.png diff --git a/src/assets/lume-logo.png b/src/assets/lume-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..0a24ad80ef777350f33dab8041c0dc6557dc1034 GIT binary patch literal 2592 zcmV+*3g7jKP)~fhyhG!dN4r4d}a*xC^uX}cmp52{w{iM>&_Vm=w z%uY@BR8{u^U4}8{ILffG)G5D!qA1y+@k}%$SwYznic$f-f$m~IN7>et2~d;@&}|0w zZBO}kpePlf+YCxkDvcVHq69<@N>Ku$2BjzgQG-&HfT%$!NPP>K=|H7G?1 zNLvlc7_%K^XDCXK(iVfF5p7O+gsX2+UX8NIYfzLPqg^f3@s!C;pKFv^P?R2{T?RGD zQ8rPBWhlKyr=1d-MXvM|>g7|EfOMNded;OS3>Amn+i{d#p!77|W>9NATPTMj7J6Galhy| zm-SG3l1{f!Uo?N{>+4(2#Z#WTb1NDQc7+Di8Pub+>xZp5%H%1%(oud3-29j_M5Fo- zWltzd7t)84iCUGqV^f_i(s)OG@#rmr+X$NxkKnrr+gDTW=Xacp4kBq*aGVQ|tMqHH zw4Z*I&tabO*Ik9Y&(`oJJd&&Pk&Fa|Yc1;RPF?G$^K|qmJiooUIE1o+GK=ThKn|$q zn_T>bA`iLOsApD-`a5v(XSlnxapc(6QHCi?C{I)W+7$cA_w3GvoZ~o(9HWW!Eu}1? zo+SuGl({3lpWP^9V5hZ9^Wggo1+IN+q;;aa=W#Ne&|=?HOc;jIL5xiV9svSCHHXRr zqe<;MlwTnS-0!~FAwHQY8z zas5;*^NG)c?Vq*->4Ke_wsK^6NA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Q;0Jh&)JoR9mh)v`rSvYH$~N~Uh3fRgN~O_%fl!oybh|;lov~a|I!ad?6kqb*gdHZ`jAWB{=H*XO zT2O^9pLlL0)kZRfWdi#HX=sa~C|yX`kM4|umQ$f96+oR5iV_etC`Ac~8kC|0L=8$& z0-^?`C;?G}Qj~zGK`BZ=)Swh4AZk#G5)d^gMF~i!465NNUj{`{vSEzbg0d_&3b$_3 zPtu|&T}j7A$kKRrgq;{r{=Y|NSG^+eB>jrgcD@7-u3F_z1+UTo0000 = { + done: 'Synced', + error: 'Issue', + syncing: 'Syncing' +} + +const SYNC_STATE_TO_TW_COLOR: Record = { + 'done': 'text-primary', + 'error': 'text-red-500', + 'syncing': 'text-orange-500', +} + const LumeDashboard = () => { const { chains } = useLume() + const contentChains = chains.filter(c => c.type === 'content'); + const blockchainChains = chains.filter(c => c.type === 'blockchain'); + return ( Open - - Syncing State: Connected - Network Log: - {chains.map((chain) => ( -

- + +
+ +
+
+

Content

+
+ {contentChains.map((chain, index) => )}
- ))} +
+ +
+

Blockchain

+
+ {blockchainChains.map((chain, index) => )} +
+
) } +const ChainIndicator = ({ chain }: { chain: Chain }) => { + return
+ +
+ {chain.name} + {SYNCSTATE_TO_TEXT[chain.syncState]} +
+
+} + const CircularProgress = ({ chain, className @@ -35,16 +71,10 @@ const CircularProgress = ({ return ( @@ -64,7 +94,7 @@ const CircularProgress = ({ cx="50" cy="50" stroke="currentColor" - stroke-width="8px" + stroke-width="4px" stroke-linecap="round" stroke-dashoffset={`${progressOffset}px`} fill="transparent" @@ -75,7 +105,7 @@ const CircularProgress = ({ y="57.5px" fill="currentColor" font-size="26px" - font-weight="bold" + font-weight="normal" style={{ transform: "rotate(90deg) translate(0px, -98px)" }} > {chain.progress} diff --git a/src/components/lume/LumeProvider.tsx b/src/components/lume/LumeProvider.tsx index 29c3591..cdcff4b 100644 --- a/src/components/lume/LumeProvider.tsx +++ b/src/components/lume/LumeProvider.tsx @@ -4,12 +4,13 @@ type LumeSyncState = 'syncing' | 'done' | 'error' export type Chain = { syncState: LumeSyncState, + name: string, chainId: string, active: boolean, progress: number, // in porcentage logs: string[], type: 'blockchain' | 'content', - peerCount?: number + peerCount?: number } type LumeObject = { @@ -27,15 +28,16 @@ const LumeProvider = ({ children }: { children: React.ReactNode }) => { const [lume, setLume] = React.useState({ chains: [ { + name: 'Ethereum', syncState: 'done', chainId: '1', active: true, progress: 100, logs: [], - type: 'blockchain', - peerCount: 5 + type: 'blockchain' }, { + name: "IPFS", syncState: 'syncing', chainId: '2', active: false, @@ -59,13 +61,13 @@ const LumeProvider = ({ children }: { children: React.ReactNode }) => { export default LumeProvider; -export function useLume() { - const ctx = useContext(LumeContext); +export function useLume() { + const ctx = useContext(LumeContext); - if(!ctx) { + if (!ctx) { throw new Error('useLume must be used within a LumeProvider'); } - + const { lume } = ctx; return lume }