fix: production build tab rendering

This commit is contained in:
Danish Arora 2025-04-18 13:36:29 +05:30
parent d473ddb823
commit 046b7427ed
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
6 changed files with 27 additions and 29 deletions

View File

@ -1,14 +0,0 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
domains: [
'waku.org',
'logos.co',
'contributors.free.technology'
],
},
reactStrictMode: true,
output: 'export',
}
module.exports = nextConfig

View File

@ -1,7 +1,14 @@
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
/* config options here */ images: {
}; domains: [
'waku.org',
'logos.co',
'contributors.free.technology'
],
},
reactStrictMode: true,
}
export default nextConfig; module.exports = nextConfig

View File

@ -8,8 +8,8 @@ import { KeystoreManagement } from '../components/Tabs/KeystoreTab/KeystoreManag
export default function Home() { export default function Home() {
return ( return (
<Layout> <Layout>
<MembershipRegistration /> <MembershipRegistration tabId="membership" />
<KeystoreManagement /> <KeystoreManagement tabId="keystore" />
</Layout> </Layout>
); );
} }

View File

@ -15,20 +15,15 @@ const tabs = [
}, },
]; ];
const componentToTabId: Record<string, string> = {
MembershipRegistration: 'membership',
KeystoreManagement: 'keystore',
};
export function Layout({ children }: { children: React.ReactNode }) { export function Layout({ children }: { children: React.ReactNode }) {
const { activeTab, setActiveTab } = useAppState(); const { activeTab, setActiveTab } = useAppState();
const childrenArray = Children.toArray(children); const childrenArray = Children.toArray(children);
const getTabContent = (tabId: string) => { const getTabContent = (tabId: string) => {
return childrenArray.find((child) => { return childrenArray.find((child) => {
if (isValidElement(child) && typeof child.type === 'function') { if (isValidElement(child)) {
const componentName = child.type.name; const props = child.props as { tabId?: string };
return componentToTabId[componentName] === tabId; return props.tabId === tabId;
} }
return false; return false;
}); });

View File

@ -31,7 +31,12 @@ interface ExtendedMembershipInfo extends Omit<MembershipInfo, 'state'> {
token: string; token: string;
} }
export function KeystoreManagement() { interface KeystoreManagementProps {
tabId?: string;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function KeystoreManagement({ tabId: _tabId }: KeystoreManagementProps) {
const { const {
hasStoredCredentials, hasStoredCredentials,
storedCredentialsHashes, storedCredentialsHashes,

View File

@ -11,7 +11,12 @@ import { Button } from '../../ui/button';
import { membershipRegistration, type ContentSegment } from '../../../content/index'; import { membershipRegistration, type ContentSegment } from '../../../content/index';
import { toast } from 'sonner'; import { toast } from 'sonner';
export function MembershipRegistration() { interface MembershipRegistrationProps {
tabId?: string;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function MembershipRegistration({ tabId: _tabId }: MembershipRegistrationProps) {
const { registerMembership, isInitialized, isStarted, rateMinLimit, rateMaxLimit, error, isLoading } = useRLN(); const { registerMembership, isInitialized, isStarted, rateMinLimit, rateMaxLimit, error, isLoading } = useRLN();
const { isConnected, chainId } = useWallet(); const { isConnected, chainId } = useWallet();