2022-05-09 10:16:42 +00:00
|
|
|
import { Box, Flex, Image, Text, Spinner, useMediaQuery } from '@chakra-ui/react';
|
2022-01-17 07:33:28 +00:00
|
|
|
import React from 'react';
|
2022-03-09 06:23:34 +00:00
|
|
|
import { useQuery } from 'urql';
|
|
|
|
import { MetaQuery } from '../graphql/queries';
|
2022-01-15 15:45:46 +00:00
|
|
|
|
|
|
|
export function AuthLayout({ children }: { children: React.ReactNode }) {
|
2022-03-09 06:23:34 +00:00
|
|
|
const [{ fetching, data }] = useQuery({ query: MetaQuery });
|
2022-05-09 10:16:42 +00:00
|
|
|
const [isNotSmallerScreen] = useMediaQuery('(min-width:600px)');
|
2022-01-17 07:33:28 +00:00
|
|
|
return (
|
2022-05-09 10:16:42 +00:00
|
|
|
<Flex flexWrap='wrap' h='100vh' bg='gray.100' alignItems='center' justifyContent='center' flexDirection='column'>
|
|
|
|
<Flex alignItems='center'>
|
|
|
|
<Image src='https://authorizer.dev/images/logo.png' alt='logo' height='50' />
|
|
|
|
<Text fontSize='x-large' ml='3' letterSpacing='3'>
|
2022-01-19 16:50:25 +00:00
|
|
|
AUTHORIZER
|
2022-01-17 07:33:28 +00:00
|
|
|
</Text>
|
2022-01-19 16:50:25 +00:00
|
|
|
</Flex>
|
|
|
|
|
2022-03-09 06:23:34 +00:00
|
|
|
{fetching ? (
|
|
|
|
<Spinner />
|
|
|
|
) : (
|
|
|
|
<>
|
2022-05-09 10:16:42 +00:00
|
|
|
<Box p='6' m='5' rounded='5' bg='white' w={isNotSmallerScreen ? '500px' : '450px'} shadow='xl'>
|
2022-03-09 06:23:34 +00:00
|
|
|
{children}
|
|
|
|
</Box>
|
2022-05-09 10:16:42 +00:00
|
|
|
<Text color='gray.600' fontSize='sm'>
|
2022-03-09 06:23:34 +00:00
|
|
|
Current Version: {data.meta.version}
|
|
|
|
</Text>
|
|
|
|
</>
|
|
|
|
)}
|
2022-01-17 07:33:28 +00:00
|
|
|
</Flex>
|
|
|
|
);
|
2022-01-15 15:45:46 +00:00
|
|
|
}
|