Skip to content

Commit 7707179

Browse files
authored
Merge pull request #995 from hemilabs/mainnet-is-alive
Add Mainnet modal + badges
2 parents 25b8eec + 33af3a5 commit 7707179

File tree

15 files changed

+1298
-10
lines changed

15 files changed

+1298
-10
lines changed

webapp/app/[locale]/_components/header.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { TunnelTabs } from 'components/tunnelTabs'
66
import { useTunnelOperationByConnectedWallet } from 'hooks/useTunnelOperationByConnectedWallet'
77
import dynamic from 'next/dynamic'
88

9+
import { Badge } from './navbar/_components/badge'
10+
911
const WalletConnection = dynamic(
1012
() =>
1113
import('app/components/connectWallets').then(mod => mod.WalletConnection),
@@ -41,10 +43,11 @@ export const Header = function ({ isMenuOpen, toggleMenu }: Props) {
4143
className="md:h-17 md:py-4.5 flex h-14 items-center border-b border-solid
4244
border-neutral-300/55 bg-white px-3 py-3 md:bg-transparent md:px-0"
4345
>
44-
<div className="h-6 w-6 md:hidden">
45-
<Link href={href}>
46+
<div className="flex items-center gap-x-2 md:hidden">
47+
<Link className="h-6 w-6" href={href}>
4648
<HemiSymbol />
4749
</Link>
50+
<Badge />
4851
</div>
4952
<div className="hidden pl-6 md:block">
5053
<StakeTabs />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useNetworkType } from 'hooks/useNetworkType'
2+
3+
export const Badge = function () {
4+
const [networkType] = useNetworkType()
5+
return (
6+
<span
7+
className="text-xxs flex h-5 items-center justify-center rounded-md
8+
px-1.5 py-1 text-center font-medium capitalize text-orange-950"
9+
style={{
10+
background:
11+
'linear-gradient(180deg, rgba(255, 255, 255, 0.20) 35.57%, rgba(255, 255, 255, 0.00) 70.92%), var(--Color-Orange-500, #FF6C15)',
12+
boxShadow:
13+
'0px 1px 0px 0px rgba(255, 255, 255, 0.25) inset, 0px 1px 2px 0px rgba(10, 10, 10, 0.04)',
14+
textShadow:
15+
'0px 0px 2px rgba(255, 255, 255, 0.56), 0px 0px 1px rgba(0, 0, 0, 0.14)',
16+
}}
17+
>
18+
{networkType}
19+
</span>
20+
)
21+
}

webapp/app/[locale]/_components/navbar/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { useTranslations } from 'next-intl'
1717
import React, { Suspense } from 'react'
1818
import { getSwapUrl } from 'utils/swap'
1919

20+
import { Badge } from './_components/badge'
2021
import { CmcAttribution } from './_components/cmcAttribution'
2122
import { GetStarted } from './_components/getStarted'
2223
import { HemiExplorerLink } from './_components/hemiExplorerLink'
@@ -47,10 +48,11 @@ export const Navbar = function () {
4748
<>
4849
<div className="md:h-98vh flex h-[calc(100dvh-56px)] flex-col bg-white px-3 pt-3 md:pt-0 [&>*]:md:ml-3 [&>*]:md:pr-3">
4950
<div className="hidden h-24 items-center justify-center md:flex">
50-
<div className="flex h-1/3 w-1/3">
51+
<div className="flex items-center gap-x-2">
5152
<Link className="w-full" href={href}>
5253
<HemiLogoFull />
5354
</Link>
55+
<Badge />
5456
</div>
5557
</div>
5658
<ul className="flex h-[calc(100dvh-275px)] flex-col gap-y-1 overflow-y-auto md:h-full [&>li>div]:px-3">

webapp/app/[locale]/layout.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ import { Analytics } from './_components/analytics'
2121
import { AppLayout } from './_components/appLayout'
2222
import { Navbar } from './_components/navbar'
2323

24+
const MainnetLiveModal = dynamic(
25+
() => import('components/mainnetLiveModal').then(mod => mod.MainnetLiveModal),
26+
{
27+
ssr: false,
28+
},
29+
)
30+
2431
const StakeAndEarnCard = dynamic(
2532
() =>
2633
import('./_components/stakeAndEarnCard').then(mod => mod.StakeAndEarnCard),
@@ -86,6 +93,7 @@ export default async function RootLayout({
8693
{featureFlags.stakeCampaignEnabled && (
8794
<StakeAndEarnCard />
8895
)}
96+
{featureFlags.mainnetEnabled && <MainnetLiveModal />}
8997
</AppLayout>
9098
</div>
9199
</Analytics>

webapp/components/button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const variants = {
1717
} as const
1818

1919
type Height = {
20-
height?: 'h-4' | 'h-6' | 'h-8'
20+
height?: 'h-4' | 'h-5' | 'h-6' | 'h-8'
2121
}
2222

2323
type Variant = {

webapp/components/drawer/index.tsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use client'
22

3+
import { ComponentType } from 'react'
34
import ReactDOM from 'react-dom'
45
import { CloseIcon } from 'ui-common/components/closeIcon'
56
import { useOnClickOutside } from 'ui-common/hooks/useOnClickOutside'
@@ -9,10 +10,17 @@ import { Overlay } from '../overlay'
910

1011
type Props = {
1112
children: React.ReactNode
13+
container?: HTMLElement
1214
onClose?: () => void
15+
overlay?: ComponentType
1316
}
1417

15-
export const Drawer = function ({ children, onClose }: Props) {
18+
export const Drawer = function ({
19+
children,
20+
container,
21+
onClose,
22+
overlay: OverlayComponent = Overlay,
23+
}: Props) {
1624
const drawerRef = useOnClickOutside<HTMLDivElement>(onClose)
1725

1826
useOnKeyUp(function (e) {
@@ -34,9 +42,9 @@ export const Drawer = function ({ children, onClose }: Props) {
3442
>
3543
{children}
3644
</div>
37-
<Overlay />
45+
<OverlayComponent />
3846
</>,
39-
document.getElementById('app-layout-container'),
47+
container ?? document.getElementById('app-layout-container'),
4048
)
4149
}
4250

0 commit comments

Comments
 (0)