diff --git a/packages/web/components/elements/MaintenanceBanner.tsx b/packages/web/components/elements/MaintenanceBanner.tsx new file mode 100644 index 000000000..ba5134284 --- /dev/null +++ b/packages/web/components/elements/MaintenanceBanner.tsx @@ -0,0 +1,42 @@ +import { usePersistedState } from '../../lib/hooks/usePersistedState' +import { CloseButton } from './CloseButton' +import { HStack, SpanBox } from './LayoutPrimitives' + +export const MaintenanceBanner = () => { + const [ + showMaintenanceMode, + setShowMaintenanceMode, + isLoadingShowMaintenanceMode, + ] = usePersistedState({ + key: 'show-maintenance-mode', + isSessionStorage: false, + initialValue: true, + }) + return ( + <> + {!isLoadingShowMaintenanceMode && showMaintenanceMode && ( + + Omnivore will be undergoing maintenance for 30 minutes at 04:00 UTC, + during that time the website and APIs will be unavailable. + + { + setShowMaintenanceMode(false) + }} + /> + + )} + + ) +} diff --git a/packages/web/components/nav-containers/HomeContainer.tsx b/packages/web/components/nav-containers/HomeContainer.tsx index c5cbbabc5..66bbf788f 100644 --- a/packages/web/components/nav-containers/HomeContainer.tsx +++ b/packages/web/components/nav-containers/HomeContainer.tsx @@ -181,8 +181,9 @@ type NavigationContextType = { dispatch: React.Dispatch } -const NavigationContext = - createContext(undefined) +const NavigationContext = createContext( + undefined +) export const useNavigation = (): NavigationContextType => { const context = useContext(NavigationContext) diff --git a/packages/web/components/templates/AuthLayout.tsx b/packages/web/components/templates/AuthLayout.tsx index bc9388894..f12553320 100644 --- a/packages/web/components/templates/AuthLayout.tsx +++ b/packages/web/components/templates/AuthLayout.tsx @@ -1,4 +1,5 @@ import { Box, VStack, HStack } from '../elements/LayoutPrimitives' +import { MaintenanceBanner } from '../elements/MaintenanceBanner' import { OmnivoreNameLogo } from '../elements/images/OmnivoreNameLogo' import { theme } from '../tokens/stitches.config' import { GoogleReCaptchaProvider } from '@google-recaptcha/react' @@ -11,6 +12,7 @@ type ProfileLayoutProps = { export function AuthLayout(props: ProfileLayoutProps): JSX.Element { return ( <> + + } largerLayoutNode={} diff --git a/packages/web/components/templates/NavigationLayout.tsx b/packages/web/components/templates/NavigationLayout.tsx index 453e9df51..90e105f64 100644 --- a/packages/web/components/templates/NavigationLayout.tsx +++ b/packages/web/components/templates/NavigationLayout.tsx @@ -1,7 +1,6 @@ import { PageMetaData, PageMetaDataProps } from '../patterns/PageMetaData' import { HStack, SpanBox, VStack } from '../elements/LayoutPrimitives' import { ReactNode, useEffect, useState, useCallback } from 'react' -import { useGetViewerQuery } from '../../lib/networking/queries/useGetViewerQuery' import { navigationCommands } from '../../lib/keyboardShortcuts/navigationShortcuts' import { useKeyboardShortcuts } from '../../lib/keyboardShortcuts/useKeyboardShortcuts' import { useRouter } from 'next/router' @@ -19,10 +18,12 @@ import { List } from '@phosphor-icons/react' import { LIBRARY_LEFT_MENU_WIDTH } from './navMenu/LibraryLegacyMenu' import { AddLinkModal } from './AddLinkModal' import useWindowDimensions from '../../lib/hooks/useGetWindowDimensions' -import { useAddItem } from '../../lib/networking/library_items/useLibraryItems' import { useHandleAddUrl } from '../../lib/hooks/useHandleAddUrl' import { useGetViewer } from '../../lib/networking/viewer/useGetViewer' import { useQueryClient } from '@tanstack/react-query' +import { usePersistedState } from '../../lib/hooks/usePersistedState' +import { CloseButton } from '../elements/CloseButton' +import { MaintenanceBanner } from '../elements/MaintenanceBanner' export type NavigationSection = | 'home' @@ -109,15 +110,6 @@ export function NavigationLayout(props: NavigationLayoutProps): JSX.Element { }, [showLogout]) const { logout } = useLogout() - // if (isLoading) { - // return ( - // - // ) - // } return ( +
{