Skip to content

Commit d04e70e

Browse files
committed
replace sidebar with top bar
1 parent ff01ec0 commit d04e70e

File tree

3 files changed

+306
-177
lines changed

3 files changed

+306
-177
lines changed

src/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Navigation } from '@/navigation'
21
import { TooltipProvider } from '@/components/ui/tooltip'
32
import { Header } from '@/header'
43
import { Theme, ThemeProvider } from './components/theme-provider'
@@ -21,9 +20,8 @@ const App = () => {
2120
<AccountContextProvider>
2221
<TooltipProvider>
2322
<div className="bg-muted/40 flex min-h-screen w-full flex-col">
24-
<Navigation />
25-
<div className="mb-24 flex flex-col pb-24 sm:gap-4 sm:py-4 sm:pl-56">
26-
<Header />
23+
<Header />
24+
<div className="mt-24 mb-24 flex flex-col">
2725
<Content />
2826
<Footer />
2927
</div>

src/footer.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
import { Button } from '@/components/ui/button'
2+
import { Badge } from '@/components/ui/badge'
23
import { useTheme } from '@/components/theme-provider'
34
import { openInNewTab } from '@/lib/utils'
45
import { Moon, Sun } from 'lucide-react'
56
import { FaGithub } from 'react-icons/fa'
7+
import { useEffect, useState } from 'react'
8+
import { polkadotClient } from './clients'
69

710
export const Footer = () => {
811
const { theme, setTheme } = useTheme()
12+
const [latestBlockNumber, setLatestBlockNumber] = useState<number | null>(
13+
null,
14+
)
915

1016
const toggleTheme = () => setTheme(theme === 'light' ? 'dark' : 'light')
1117

18+
useEffect(() => {
19+
const subscription = polkadotClient.finalizedBlock$.subscribe(
20+
(finalizedBlock) => {
21+
if (typeof finalizedBlock.number === 'number') {
22+
setLatestBlockNumber(finalizedBlock.number)
23+
}
24+
},
25+
)
26+
27+
return () => subscription.unsubscribe()
28+
}, [])
29+
1230
return (
1331
<footer className="bg-background/80 w-fill supports-backdrop-filter:bg-background/60 fixed bottom-0 border-t backdrop-blur">
14-
<div className="text-muted-foreground flex flex-col justify-between gap-4 px-4 py-6 text-sm sm:flex-row sm:items-center sm:px-6">
32+
<div className="text-muted-foreground mx-auto flex w-full max-w-7xl flex-col items-center justify-between gap-4 px-4 py-6 text-sm sm:flex-row sm:items-center sm:px-6">
1533
<div className="text-center sm:text-left">
1634
<p className="text-foreground text-base font-semibold">
1735
Polkadot Technical Fellowship
@@ -41,6 +59,11 @@ export const Footer = () => {
4159
<Moon className="h-[1.1rem] w-[1.1rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" />
4260
<span className="sr-only">Toggle theme</span>
4361
</Button>
62+
<Badge variant="secondary" className="p-3 text-nowrap">
63+
{latestBlockNumber
64+
? `#${latestBlockNumber.toLocaleString()}`
65+
: 'Syncing block...'}
66+
</Badge>
4467
</div>
4568
</div>
4669
</footer>

0 commit comments

Comments
 (0)