Skip to content

Commit

Permalink
refactor(apps): persist layouts between page transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Oct 25, 2024
1 parent 4a3ca2a commit b3d0c9f
Show file tree
Hide file tree
Showing 82 changed files with 1,877 additions and 1,601 deletions.
7 changes: 7 additions & 0 deletions .changeset/nice-lobsters-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'hostd': patch
'renterd': patch
'walletd': patch
---

The page layout is now persisted between page transitions.
47 changes: 47 additions & 0 deletions apps/hostd/components/Config/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Text } from '@siafoundation/design-system'
import { Warning16, CheckmarkFilled16 } from '@siafoundation/react-icons'
import { HostdSidenav } from '../HostdSidenav'
import { routes } from '../../config/routes'
import { useDialog } from '../../contexts/dialog'
import {
HostdAuthedLayout,
HostdAuthedPageLayoutProps,
} from '../HostdAuthedLayout'
import { useConfig } from '../../contexts/config'
import { ConfigNav } from './ConfigNav'
import { ConfigActions } from './ConfigActions'

export const Layout = HostdAuthedLayout
export function useLayoutProps(): HostdAuthedPageLayoutProps {
const { openDialog } = useDialog()
const { settings, dynDNSCheck } = useConfig()
return {
title: 'Configuration',
routes,
nav: <ConfigNav />,
sidenav: <HostdSidenav />,
stats:
settings.data?.ddns.provider && !dynDNSCheck.isValidating ? (
dynDNSCheck.error ? (
<>
<Text color="amber">
<Warning16 />
</Text>
<Text size="14">
Error with dynamic DNS configuration: {dynDNSCheck.error.message}
</Text>
</>
) : (
<>
<Text color="green">
<CheckmarkFilled16 />
</Text>
<Text>Dynamic DNS enabled</Text>
</>
)
) : null,
actions: <ConfigActions />,
openSettings: () => openDialog('settings'),
size: '3',
}
}
Loading

0 comments on commit b3d0c9f

Please sign in to comment.