Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reindexing banner #2741

Merged
merged 4 commits into from
Feb 24, 2025
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "decent-interface",
"version": "0.7.0",
"version": "0.7.1",
"private": true,
"dependencies": {
"@amplitude/analytics-browser": "^2.11.1",
Expand Down
49 changes: 41 additions & 8 deletions src/components/ui/page/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box, Container, Grid, GridItem, Show } from '@chakra-ui/react';
import { Box, Container, Grid, GridItem, Show, Text } from '@chakra-ui/react';
import { useRef } from 'react';
import { Outlet } from 'react-router-dom';
import { Outlet, useMatches } from 'react-router-dom';
import {
MAX_CONTENT_WIDTH,
SIDEBAR_WIDTH,
Expand All @@ -24,22 +24,50 @@ export function Layout() {

useNavigationScrollReset();

const isReindexing = true;
const matches = useMatches();
const onDao = matches.some(
_match => _match.pathname !== '/' && !_match.pathname.startsWith('/create'),
);

const showReindexingBanner = isReindexing && onDao;

return (
<Grid
templateAreas={{
base: `"header header"
base: `"banner banner"
"header header"
"main main"`,
md: `"header header"
md: `"banner banner"
"header header"
"nav main"
"footer footer"`,
}}
gridTemplateColumns={`${SIDEBAR_WIDTH} 1fr`}
gridTemplateRows={{
base: `${HEADER_HEIGHT} 100%`,
md: `${HEADER_HEIGHT} minmax(${CONTENT_HEIGHT}, 100%) ${FOOTER_HEIGHT}`,
base: `auto ${HEADER_HEIGHT} 100%`,
md: `auto ${HEADER_HEIGHT} minmax(${CONTENT_HEIGHT}, 100%) ${FOOTER_HEIGHT}`,
}}
position="relative"
>
<GridItem area="banner">
{showReindexingBanner ? (
<Box
bg="lilac--2"
textAlign="center"
p={3}
position="fixed"
w="full"
zIndex="2"
fontWeight="bold"
transformOrigin="top"
>
<Text>
Decent&apos;s indexers are rebuilding. We are working to restore services soon.
</Text>
</Box>
) : null}
</GridItem>
<GridItem
area="header"
ref={headerContainerRef}
Expand All @@ -51,6 +79,7 @@ export function Layout() {
w="full"
maxW="100vw"
zIndex="1"
mt={showReindexingBanner ? '48px' : '0px'}
>
<Header headerContainerRef={headerContainerRef} />
</Box>
Expand All @@ -63,15 +92,19 @@ export function Layout() {
flexDirection="column"
position="fixed"
ml={6}
top={HEADER_HEIGHT}
minHeight={{ base: undefined, md: `calc(100vh - ${HEADER_HEIGHT})` }}
top={showReindexingBanner ? `calc(${HEADER_HEIGHT} + 48px)` : HEADER_HEIGHT}
minHeight={{
base: undefined,
md: `calc(100vh - ${HEADER_HEIGHT} - ${showReindexingBanner ? '48px' : '0px'})`,
}}
>
<NavigationLinks />
</GridItem>
</Show>
<GridItem
area="main"
mx={{ base: '0.5rem', md: '1.5rem' }}
mt={showReindexingBanner ? '48px' : '0px'}
>
<Container
maxWidth={MAX_CONTENT_WIDTH}
Expand Down