Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { Suspense } from 'react'
import { NetworkProvider } from "@/contexts/NetworkContext";
import { ThemeProvider } from "next-themes";


const geistSans = Geist({
Expand Down Expand Up @@ -33,15 +34,22 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<html lang="en">
<html lang="en" suppressHydrationWarning>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
{...customBodyProps}
>
<Suspense fallback={<div>Loading...</div>}>
<NetworkProvider>
{children}
</NetworkProvider>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<NetworkProvider>
{children}
</NetworkProvider>
</ThemeProvider>
</Suspense>
</body>
</html>
Expand Down
18 changes: 16 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@ import { EXAMPLE_CONTRACT_IDS } from "@/lib/escrow-constants";
import type { NextPage } from "next";
import { useRouter } from "next/navigation";
import { useNetwork } from "@/contexts/NetworkContext";
import { getNetworkConfig } from "@/lib/network-config";


const inter = Inter({ subsets: ["latin"] });

const Home: NextPage = () => {
const router = useRouter();
const { currentNetwork } = useNetwork();
const { currentNetwork, setNetwork } = useNetwork();
const [contractId, setContractId] = useState<string>("");
const [error, setError] = useState<string | null>(null);
const [isSearchFocused, setIsSearchFocused] = useState<boolean>(false);

// Network switching for error recovery
const otherNetwork = currentNetwork === 'testnet' ? 'mainnet' : 'testnet';
const switchNetworkLabel = `Try ${getNetworkConfig(otherNetwork).name}`;
const handleSwitchNetwork = () => {
setNetwork(otherNetwork);
// Clear error when switching networks
setError(null);
};

// Responsive: detect mobile for SearchCard behaviour

const handleNavigate = async () => {
Expand Down Expand Up @@ -86,7 +96,11 @@ const Home: NextPage = () => {
handleUseExample={handleUseExample}
/>

<ErrorDisplay error={error} />
<ErrorDisplay
error={error}
onSwitchNetwork={handleSwitchNetwork}
switchNetworkLabel={switchNetworkLabel}
/>
</div>
</div>

Expand Down
Loading