diff --git a/dapp/src/components/Header/ConnectWallet.tsx b/dapp/src/components/Header/ConnectWallet.tsx
index 0398874df..5abbb5d89 100644
--- a/dapp/src/components/Header/ConnectWallet.tsx
+++ b/dapp/src/components/Header/ConnectWallet.tsx
@@ -1,9 +1,9 @@
import React from "react"
import { Button, HStack, Icon, Tooltip } from "@chakra-ui/react"
-import { useWallet } from "#/hooks"
+import { useIsHomeRouteActive, useWallet, useWalletContext } from "#/hooks"
import { CurrencyBalance } from "#/components/shared/CurrencyBalance"
import { TextMd } from "#/components/shared/Typography"
-import { BitcoinIcon, EthereumIcon } from "#/assets/icons"
+import { BitcoinIcon } from "#/assets/icons"
import { Account } from "@ledgerhq/wallet-api-client"
import { CURRENCY_ID_BITCOIN } from "#/constants"
import {
@@ -11,6 +11,12 @@ import {
logPromiseFailure,
truncateAddress,
} from "#/utils"
+import { AnimatePresence, motion, Variants } from "framer-motion"
+
+const containerVariants: Variants = {
+ hidden: { opacity: 0, y: -48 },
+ visible: { opacity: 1, y: 0 },
+}
const getCustomDataByAccount = (
account?: Account,
@@ -28,53 +34,54 @@ const getCustomDataByAccount = (
export default function ConnectWallet() {
const {
bitcoin: { account: btcAccount, requestAccount: requestBitcoinAccount },
- ethereum: { account: ethAccount, requestAccount: requestEthereumAccount },
} = useWallet()
+ // TODO: Move `isConnected` to useWallet hook
+ const { isConnected } = useWalletContext()
const customDataBtcAccount = getCustomDataByAccount(btcAccount)
- const customDataEthAccount = getCustomDataByAccount(ethAccount)
+
+ const isHomeRoute = useIsHomeRouteActive()
const handleConnectBitcoinAccount = () => {
logPromiseFailure(requestBitcoinAccount())
}
- const handleConnectEthereumAccount = () => {
- logPromiseFailure(requestEthereumAccount())
- }
-
return (
-
-
- Balance
-
-
-
- }
- onClick={handleConnectBitcoinAccount}
+
+ {(isConnected || !isHomeRoute) && (
+
- {customDataBtcAccount.text}
-
-
- }
- onClick={handleConnectEthereumAccount}
- >
- {customDataEthAccount.text}
-
-
+
+ Balance
+
+
+
+ }
+ onClick={handleConnectBitcoinAccount}
+ >
+ {customDataBtcAccount.text}
+
+
+
+ )}
+
)
}
diff --git a/dapp/src/components/Header/Navigation/Navigation.tsx b/dapp/src/components/Header/Navigation/Navigation.tsx
new file mode 100644
index 000000000..bcfe4357f
--- /dev/null
+++ b/dapp/src/components/Header/Navigation/Navigation.tsx
@@ -0,0 +1,24 @@
+import React from "react"
+import { Box, BoxProps, HStack, List } from "@chakra-ui/react"
+import { NavigationItemType } from "#/types/navigation"
+import NavigationItem from "./NavigationItem"
+
+type NavigationProps = BoxProps & {
+ items: NavigationItemType[]
+}
+
+function Navigation(props: NavigationProps) {
+ const { items, ...restProps } = props
+
+ return (
+
+
+ {items.map((item) => (
+
+ ))}
+
+
+ )
+}
+
+export default Navigation
diff --git a/dapp/src/components/Header/Navigation/NavigationItem.tsx b/dapp/src/components/Header/Navigation/NavigationItem.tsx
new file mode 100644
index 000000000..ad5c4817f
--- /dev/null
+++ b/dapp/src/components/Header/Navigation/NavigationItem.tsx
@@ -0,0 +1,38 @@
+import React from "react"
+import {
+ Box,
+ ListItem,
+ ListItemProps,
+ useMultiStyleConfig,
+} from "@chakra-ui/react"
+import { motion } from "framer-motion"
+import { NavigationItemType } from "#/types/navigation"
+import { NavLink } from "../../shared/NavLink"
+
+type NavigationItemProps = ListItemProps & NavigationItemType
+
+function NavigationItem(props: NavigationItemProps) {
+ const { label, href, ...restProps } = props
+ const styles = useMultiStyleConfig("Link", { variant: "navigation" })
+
+ return (
+
+
+ {({ isActive }) => (
+ <>
+ {label}
+ {isActive && (
+
+ )}
+ >
+ )}
+
+
+ )
+}
+
+export default NavigationItem
diff --git a/dapp/src/components/Header/Navigation/index.ts b/dapp/src/components/Header/Navigation/index.ts
new file mode 100644
index 000000000..168487f66
--- /dev/null
+++ b/dapp/src/components/Header/Navigation/index.ts
@@ -0,0 +1 @@
+export { default as Navigation } from "./Navigation"
diff --git a/dapp/src/components/Header/index.tsx b/dapp/src/components/Header/index.tsx
index df0a2eb53..f633a9fdc 100644
--- a/dapp/src/components/Header/index.tsx
+++ b/dapp/src/components/Header/index.tsx
@@ -1,12 +1,22 @@
import React from "react"
-import { Flex, HStack, Icon } from "@chakra-ui/react"
import { AcreLogo } from "#/assets/icons"
+import { routerPath } from "#/router/path"
+import { Flex, HStack, Icon } from "@chakra-ui/react"
+import { NavigationItemType } from "#/types/navigation"
import ConnectWallet from "./ConnectWallet"
+import { Navigation } from "./Navigation"
+
+// TODO: To be adjusted after project pivot/cleanup
+const NAVIGATION_ITEMS: NavigationItemType[] = [
+ { label: "Season 1", href: routerPath.home },
+ { label: "Dashboard", href: routerPath.dashboard },
+]
export default function Header() {
return (
-
+
+
diff --git a/dapp/src/components/shared/Link.tsx b/dapp/src/components/shared/Link.tsx
new file mode 100644
index 000000000..cc0185670
--- /dev/null
+++ b/dapp/src/components/shared/Link.tsx
@@ -0,0 +1,16 @@
+import React from "react"
+import {
+ Link as ChakraLink,
+ LinkProps as ChakraLinkProps,
+} from "@chakra-ui/react"
+import {
+ Link as RouterLink,
+ LinkProps as RouterLinkProps,
+} from "react-router-dom"
+
+type LinkProps = Omit &
+ Pick
+
+export function Link(props: LinkProps) {
+ return
+}
diff --git a/dapp/src/components/shared/NavLink.tsx b/dapp/src/components/shared/NavLink.tsx
new file mode 100644
index 000000000..1826af89a
--- /dev/null
+++ b/dapp/src/components/shared/NavLink.tsx
@@ -0,0 +1,21 @@
+import React from "react"
+import {
+ Link as ChakraLink,
+ LinkProps as ChakraLinkProps,
+} from "@chakra-ui/react"
+import {
+ NavLink as RouterNavLink,
+ NavLinkProps as RouterNavLinkProps,
+} from "react-router-dom"
+
+type NavLinkProps = Omit &
+ Pick
+
+export function NavLink(props: NavLinkProps) {
+ const { children, ...restProps } = props
+ return (
+
+ {children as React.ReactNode}
+
+ )
+}
diff --git a/dapp/src/hooks/index.ts b/dapp/src/hooks/index.ts
index 5651557f2..c854ed84f 100644
--- a/dapp/src/hooks/index.ts
+++ b/dapp/src/hooks/index.ts
@@ -23,3 +23,4 @@ export * from "./useTimeout"
export * from "./useCountdown"
export * from "./useActivities"
export * from "./useSize"
+export * from "./router"
diff --git a/dapp/src/hooks/router/index.ts b/dapp/src/hooks/router/index.ts
new file mode 100644
index 000000000..cb8162e91
--- /dev/null
+++ b/dapp/src/hooks/router/index.ts
@@ -0,0 +1 @@
+export * from "./useIsActiveRoute"
diff --git a/dapp/src/hooks/router/useIsActiveRoute.ts b/dapp/src/hooks/router/useIsActiveRoute.ts
new file mode 100644
index 000000000..715c3702a
--- /dev/null
+++ b/dapp/src/hooks/router/useIsActiveRoute.ts
@@ -0,0 +1,10 @@
+import { routerPath } from "#/router/path"
+import { useLocation } from "react-router-dom"
+
+export const useIsActiveRoute = (route: string) => {
+ const location = useLocation()
+
+ return location.pathname === route
+}
+
+export const useIsHomeRouteActive = () => useIsActiveRoute(routerPath.home)
diff --git a/dapp/src/router/index.tsx b/dapp/src/router/index.tsx
index bf57314cd..7d72d8ee3 100644
--- a/dapp/src/router/index.tsx
+++ b/dapp/src/router/index.tsx
@@ -1,9 +1,9 @@
import React from "react"
import { BrowserRouter, Route, Routes } from "react-router-dom"
import LandingPage from "#/pages/LandingPage"
+import Layout from "#/components/shared/Layout"
import ActivityPage from "#/pages/ActivityPage"
import DashboardPage from "#/pages/DashboardPage"
-import Layout from "#/components/shared/Layout"
import { routerPath } from "./path"
export function Router() {
diff --git a/dapp/src/theme/Link.ts b/dapp/src/theme/Link.ts
index 3c9d7c7aa..7c283559e 100644
--- a/dapp/src/theme/Link.ts
+++ b/dapp/src/theme/Link.ts
@@ -1,6 +1,9 @@
-import { defineStyle, defineStyleConfig } from "@chakra-ui/react"
+import { createMultiStyleConfigHelpers, defineStyle } from "@chakra-ui/react"
-const baseStyle = defineStyle({
+const PARTS = ["container", "indicator"]
+const multiStyleConfig = createMultiStyleConfigHelpers(PARTS)
+
+const containerBaseStyle = defineStyle({
fontWeight: "semibold",
fontSize: "sm",
lineHeight: "sm",
@@ -10,6 +13,33 @@ const baseStyle = defineStyle({
},
})
-export const linkTheme = defineStyleConfig({
- baseStyle,
+const navigationContainerStyles = defineStyle({
+ display: "block",
+ fontSize: "md",
+ lineHeight: "md",
+ fontWeight: "bold",
+ marginBottom: 2,
+ color: "grey.500",
+ _activeLink: { color: "grey.700" },
+})
+
+const navigationIndicatorStyles = defineStyle({
+ pos: "absolute",
+ bottom: 0.5,
+ left: 0,
+ w: "full",
+ h: 0.5,
+ bg: "brand.400",
+})
+
+export const linkTheme = multiStyleConfig.defineMultiStyleConfig({
+ baseStyle: {
+ container: containerBaseStyle,
+ },
+ variants: {
+ navigation: {
+ container: navigationContainerStyles,
+ indicator: navigationIndicatorStyles,
+ },
+ },
})
diff --git a/dapp/src/types/navigation.ts b/dapp/src/types/navigation.ts
new file mode 100644
index 000000000..058b095d0
--- /dev/null
+++ b/dapp/src/types/navigation.ts
@@ -0,0 +1,4 @@
+export type NavigationItemType = {
+ label: string
+ href: string
+}