Skip to content

Commit

Permalink
Merge pull request #3515 from ever-co/stage
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
evereq authored Jan 15, 2025
2 parents 44d33c4 + bd9cecf commit 4fcdf40
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions apps/web/components/offline-wrapper/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use client';

import { useNetworkState } from '@uidotdev/usehooks';
import { PropsWithChildren } from 'react';
import dynamic from 'next/dynamic';
import Offline from '@components/pages/offline';
import { useTimerView } from '@app/hooks';
import { usePathname } from 'next/navigation';

interface OfflineWrapperProps {
children: React.ReactNode;
}

/**
* A wrapper component that conditionally renders the Offline component if the user is not online.
Expand All @@ -22,7 +21,7 @@ interface OfflineWrapperProps {
* @param {React.ReactNode} children - The children components to render when the user is online
* @returns {React.ReactElement} - The Offline component if the user is offline (except on auth pages), or the children components if the user is online
*/
export default function OfflineWrapper({ children }: OfflineWrapperProps) {
const OfflineWrapper = ({ children }: PropsWithChildren) => {
const { online } = useNetworkState();
const { timerStatus } = useTimerView();
const pathname = usePathname();
Expand All @@ -34,4 +33,8 @@ export default function OfflineWrapper({ children }: OfflineWrapperProps) {
}

return <>{children}</>;
}
};

export default dynamic(() => Promise.resolve(OfflineWrapper), {
ssr: false
});

0 comments on commit 4fcdf40

Please sign in to comment.