diff --git a/src/assets/lume-logo.png b/src/assets/lume-logo.png new file mode 100644 index 0000000..0a24ad8 Binary files /dev/null and b/src/assets/lume-logo.png differ diff --git a/src/components/lume/LumeDashboard/LumeDashboard.tsx b/src/components/lume/LumeDashboard/LumeDashboard.tsx index ccb23e4..5e80131 100644 --- a/src/components/lume/LumeDashboard/LumeDashboard.tsx +++ b/src/components/lume/LumeDashboard/LumeDashboard.tsx @@ -1,28 +1,64 @@ import * as Dialog from "@radix-ui/react-dialog" import { Chain, useLume } from "@/components/lume/LumeProvider" +import Logo from "@/assets/lume-logo.png" + +const SYNCSTATE_TO_TEXT: Record = { + 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 }