-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into core-node/fix/upgrade_test
- Loading branch information
Showing
31 changed files
with
262 additions
and
112 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './sidebar/Sidebar'; |
19 changes: 19 additions & 0 deletions
19
apps/wallet-dashboard/app/(protected)/components/sidebar/Sidebar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { PROTECTED_ROUTES } from '@/lib/constants/routes.constants'; | ||
import { IotaLogoMark } from '@iota/ui-icons'; | ||
import { SidebarItem } from './SidebarItem'; | ||
|
||
export function Sidebar() { | ||
return ( | ||
<nav className="flex h-screen flex-col items-center gap-y-2xl bg-neutral-100 py-xl dark:bg-neutral-6"> | ||
<IotaLogoMark className="h-10 w-10 text-neutral-10 dark:text-neutral-92" /> | ||
<div className="flex flex-col gap-y-xs"> | ||
{PROTECTED_ROUTES.map((route) => ( | ||
<SidebarItem key={route.path} {...route} /> | ||
))} | ||
</div> | ||
</nav> | ||
); | ||
} |
22 changes: 22 additions & 0 deletions
22
apps/wallet-dashboard/app/(protected)/components/sidebar/SidebarItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
'use client'; | ||
|
||
import type { ProtectedRoute } from '@/lib/interfaces'; | ||
import { NavbarItem, Tooltip, TooltipPosition } from '@iota/apps-ui-kit'; | ||
import { usePathname } from 'next/navigation'; | ||
import Link from 'next/link'; | ||
|
||
export function SidebarItem({ icon, title, path }: ProtectedRoute) { | ||
const pathname = usePathname(); | ||
const RouteIcon = icon; | ||
const isActive = pathname === path; | ||
return ( | ||
<Tooltip text={title} position={TooltipPosition.Right}> | ||
<Link href={path} className="relative px-sm py-xxs"> | ||
<NavbarItem isSelected={isActive} icon={<RouteIcon />} /> | ||
</Link> | ||
</Tooltip> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/wallet-dashboard/app/(protected)/components/top-nav/TopNav.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { Badge, BadgeType, Button, ButtonType } from '@iota/apps-ui-kit'; | ||
import { ConnectButton } from '@iota/dapp-kit'; | ||
import { Settings } from '@iota/ui-icons'; | ||
|
||
export function TopNav() { | ||
return ( | ||
<div className="flex w-full flex-row items-center justify-end gap-md py-xs--rs"> | ||
<Badge label="Mainnet" type={BadgeType.PrimarySoft} /> | ||
<ConnectButton size="md" /> | ||
<Button icon={<Settings />} type={ButtonType.Ghost} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
'use client'; | ||
|
||
import { Notifications } from '@/components/index'; | ||
import React, { useEffect, useState, type PropsWithChildren } from 'react'; | ||
import { useCurrentAccount, useCurrentWallet } from '@iota/dapp-kit'; | ||
import { Button } from '@iota/apps-ui-kit'; | ||
import { redirect } from 'next/navigation'; | ||
import { Sidebar } from './components'; | ||
import { TopNav } from './components/top-nav/TopNav'; | ||
|
||
function DashboardLayout({ children }: PropsWithChildren): JSX.Element { | ||
const [isDarkMode, setIsDarkMode] = useState(false); | ||
const { connectionStatus } = useCurrentWallet(); | ||
const account = useCurrentAccount(); | ||
|
||
const toggleDarkMode = () => { | ||
setIsDarkMode(!isDarkMode); | ||
if (isDarkMode) { | ||
document.documentElement.classList.remove('dark'); | ||
} else { | ||
document.documentElement.classList.add('dark'); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
if (connectionStatus !== 'connected' && !account) { | ||
redirect('/'); | ||
} | ||
}, [connectionStatus, account]); | ||
|
||
return ( | ||
<div className="h-full"> | ||
<div className="fixed left-0 top-0 z-50 h-full"> | ||
<Sidebar /> | ||
</div> | ||
|
||
<div className="container relative min-h-screen"> | ||
<div className="sticky top-0"> | ||
<TopNav /> | ||
</div> | ||
<div>{children}</div> | ||
</div> | ||
|
||
<div className="fixed bottom-5 right-5"> | ||
<Button onClick={toggleDarkMode} text={isDarkMode ? 'Light Mode' : 'Dark Mode'} /> | ||
</div> | ||
|
||
<Notifications /> | ||
</div> | ||
); | ||
} | ||
|
||
export default DashboardLayout; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import type { ProtectedRoute } from '../interfaces'; | ||
import { ProtectedRouteTitle } from '../enums'; | ||
import { Activity, Assets, Calendar, Home, Migration, Tokens } from '@iota/ui-icons'; | ||
|
||
export const HOMEPAGE_ROUTE: ProtectedRoute = { | ||
title: ProtectedRouteTitle.Home, | ||
path: '/home', | ||
icon: Home, | ||
}; | ||
|
||
export const ASSETS_ROUTE: ProtectedRoute = { | ||
title: ProtectedRouteTitle.Assets, | ||
path: '/assets', | ||
icon: Assets, | ||
}; | ||
|
||
export const STAKING_ROUTE: ProtectedRoute = { | ||
title: ProtectedRouteTitle.Staking, | ||
path: '/staking', | ||
icon: Activity, | ||
}; | ||
|
||
export const ACTIVITY_ROUTE: ProtectedRoute = { | ||
title: ProtectedRouteTitle.Activity, | ||
path: '/activity', | ||
icon: Tokens, | ||
}; | ||
export const MIGRATIONS_ROUTE: ProtectedRoute = { | ||
title: ProtectedRouteTitle.Migrations, | ||
path: '/migrations', | ||
icon: Calendar, | ||
}; | ||
export const VESTING_ROUTE: ProtectedRoute = { | ||
title: ProtectedRouteTitle.Vesting, | ||
path: '/vesting', | ||
icon: Migration, | ||
}; | ||
|
||
export const PROTECTED_ROUTES = [ | ||
HOMEPAGE_ROUTE, | ||
ASSETS_ROUTE, | ||
STAKING_ROUTE, | ||
ACTIVITY_ROUTE, | ||
MIGRATIONS_ROUTE, | ||
VESTING_ROUTE, | ||
] as const satisfies ProtectedRoute[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Copyright (c) 2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
export * from './protectedRouteTitle.enum'; |
Oops, something went wrong.