Skip to content

Commit

Permalink
feat: add hide faucet env flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerilym committed Oct 11, 2024
1 parent 75ceca2 commit 387617e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
14 changes: 13 additions & 1 deletion apps/staking/components/DropdownHamburgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ function DropdownMenuItemNavLink({ label, children, ...props }: NavLinkProps) {
export function DropdownHamburgerMenu() {
const dictionary = useTranslations('navigation.hamburgerDropdown');
const navDictionary = useTranslations('navigation');

const routes: typeof ROUTES = [];
ROUTES.forEach(({ dictionaryKey, href }) => {
if (
process.env.NEXT_PUBLIC_HIDE_FAUCET?.toLowerCase() === 'true' &&
dictionaryKey === 'faucet'
) {
return;
}
routes.push({ dictionaryKey, href });
});

return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
Expand All @@ -37,7 +49,7 @@ export function DropdownHamburgerMenu() {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-max">
{ROUTES.map(({ dictionaryKey, href }) => (
{routes.map(({ dictionaryKey, href }) => (
<DropdownMenuItemNavLink
key={href}
href={href}
Expand Down
13 changes: 12 additions & 1 deletion apps/staking/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ import { useTranslations } from 'next-intl';
export function Footer() {
const dictionary = useTranslations('navigation');

const menuItems = [...ROUTES, ...EXTERNAL_ROUTES].map(
const routes: typeof ROUTES = [];
ROUTES.forEach(({ dictionaryKey, href }) => {
if (
process.env.NEXT_PUBLIC_HIDE_FAUCET?.toLowerCase() === 'true' &&
dictionaryKey === 'faucet'
) {
return;
}
routes.push({ dictionaryKey, href });
});

const menuItems = [...routes, ...EXTERNAL_ROUTES].map(
({ dictionaryKey, href, linkType = 'internal' }) => ({
title: dictionary(dictionaryKey),
href: href,
Expand Down
17 changes: 15 additions & 2 deletions apps/staking/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,27 @@ import { getTranslations } from 'next-intl/server';

export default async function Header() {
const dictionary = await getTranslations('navigation');

const routes: typeof ROUTES = [];
ROUTES.forEach(({ dictionaryKey, href }) => {
if (
process.env.NEXT_PUBLIC_HIDE_FAUCET?.toLowerCase() === 'true' &&
dictionaryKey === 'faucet'
) {
return;
}
routes.push({ dictionaryKey, href });
});

return (
<nav className="z-30 flex items-center justify-between p-6">
<div className={cn('flex flex-row gap-10 pr-4')}>
<Link href="/">
<Link href="/" className="relative">
<Image src="/images/logo.png" alt="Session Token Logo" width={144} height={50} />
<span className="absolute -top-4 left-1 h-max w-max text-sm">🐤</span>
</Link>
<div className="hidden flex-row gap-10 lg:flex">
{ROUTES.map(({ dictionaryKey, href }) => (
{routes.map(({ dictionaryKey, href }) => (
<NavLink key={href} href={href} label={dictionary(dictionaryKey)} />
))}
</div>
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
"env": [
"NO_MINIFY",
"NEXT_PUBLIC_HIDE_FAUCET",
"NEXT_PUBLIC_SENT_STAKING_API_URL",
"NEXT_PUBLIC_SENT_EXPLORER_API_URL",
"NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID",
Expand Down

0 comments on commit 387617e

Please sign in to comment.