Skip to content

Commit

Permalink
Merge pull request #61 from oxen-io/fix/registration_page_map_error
Browse files Browse the repository at this point in the history
Add NO_MINIFY option to staking portal webpack bundler
  • Loading branch information
Aerilym authored Oct 14, 2024
2 parents 219f489 + b34880a commit 51bf922
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/staking/app/mystakes/modules/StakedNodesModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function StakedNodesWithAddress({ address }: { address: Address }) {
}

return [
data.stakes.concat(data.historical_stakes),
[...data.stakes, ...data.historical_stakes],
data.network.block_height,
data.network.block_timestamp,
];
Expand Down
4 changes: 2 additions & 2 deletions apps/staking/app/register/NodeRegistrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ export default function NodeRegistrations() {
return [];
}

if (!stakesData || stakesData.stakes.length === 0) {
if (!stakesData || !stakesData?.stakes?.length) {
return registrationsData?.registrations ?? [];
}

const stakedNodeEd25519Pubkeys = stakesData.stakes.map(
const stakedNodeEd25519Pubkeys = stakesData?.stakes?.map(
({ service_node_pubkey }) => service_node_pubkey
);

Expand Down
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
18 changes: 16 additions & 2 deletions apps/staking/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,28 @@ import { getTranslations } from 'next-intl/server';

export default async function Header() {
const dictionary = await getTranslations('navigation');
const isCanary = process.env.NEXT_PUBLIC_IS_CANARY?.toLowerCase() === 'true';

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} />
{isCanary ? <span className="absolute -top-4 left-1 h-max w-max text-sm">🐤</span> : null}
</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
5 changes: 5 additions & 0 deletions apps/staking/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const nextConfig = {
},
webpack: (config) => {
config.externals.push('pino-pretty', 'lokijs', 'encoding');
if (process.env.NO_MINIFY?.toLowerCase() === 'true') {
config.optimization = {
minimize: false,
};
}
return config;
},
redirects: async () => {
Expand Down
1 change: 1 addition & 0 deletions apps/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"build:large": "NO_MINIFY=true next build",
"start": "next start",
"check-types": "tsc --noEmit",
"check-telemetry": "next telemetry",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
".env.local"
],
"env": [
"NO_MINIFY",
"NEXT_PUBLIC_IS_CANARY",
"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 51bf922

Please sign in to comment.