mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-14 17:08:00 -05:00
* feat: metamask switch network support + fixed dependancy cycle * feat: moved landing to index * feat: updated favicon * fix: fixed landing page issues + scrollSnap * feat: join button * fix: fixed seed script with new prod schema * feat: join button redirects based on user creation date * fix: minor ui bug fixes * feat: connect to mainnet to continue with switch network on metamask * fix: uniform setup screens * fix: fixed XP on dashboard * feat: added start page * fix: fixed issues on landing page * fix: fixed minor issues on dashboard * fix: update idx profile in auth webhook for new players * fix: minor fixes in seed page * fix: player avatar & type * fix: incorporated review comments from @dysbulic & @vidvidvid * fix: more review comments
106 lines
2.6 KiB
TypeScript
106 lines
2.6 KiB
TypeScript
import {
|
|
Box,
|
|
BoxedNextImage,
|
|
Flex,
|
|
Grid,
|
|
ResponsiveText,
|
|
Text,
|
|
} from '@metafam/ds';
|
|
import LogoImage from 'assets/logo.png';
|
|
import { FlexContainer } from 'components/Container';
|
|
import { useSetupFlow } from 'contexts/SetupContext';
|
|
import { useWeb3 } from 'lib/hooks';
|
|
import React, { ReactElement } from 'react';
|
|
|
|
export const SetupHeader: React.FC = () => {
|
|
const {
|
|
stepIndex,
|
|
onNextPress,
|
|
onBackPress,
|
|
options: { steps, sections },
|
|
} = useSetupFlow();
|
|
|
|
const { sectionIndex } = steps[stepIndex];
|
|
|
|
const templateColumns = [0, ...sections.map(() => 1), 0].map(
|
|
(col) => `${col}fr`,
|
|
);
|
|
|
|
const { connected, chainId } = useWeb3();
|
|
if (!connected || chainId !== '0x1') return null;
|
|
|
|
return (
|
|
<Grid templateColumns={templateColumns.join(' ')} gap={[1, 4]} w="full">
|
|
<FlexContainer justify="flex-end" onClick={onBackPress} cursor="pointer">
|
|
<Text fontSize={25} fontFamily="heading">
|
|
<
|
|
</Text>
|
|
</FlexContainer>
|
|
{sections.map(({ label, title }, id) => (
|
|
<SectionProgress
|
|
key={label}
|
|
{...{ title }}
|
|
isActive={sectionIndex === id}
|
|
isDone={sectionIndex > id}
|
|
/>
|
|
))}
|
|
<FlexContainer justify="flex-end" onClick={onNextPress} cursor="pointer">
|
|
<Text fontSize={25} fontFamily="heading">
|
|
>
|
|
</Text>
|
|
</FlexContainer>
|
|
</Grid>
|
|
);
|
|
};
|
|
|
|
interface StepProps {
|
|
title: { [any: string]: string | undefined | ReactElement };
|
|
isDone: boolean;
|
|
isActive: boolean;
|
|
}
|
|
|
|
export const SectionProgress: React.FC<StepProps> = ({
|
|
title,
|
|
isDone,
|
|
isActive,
|
|
}) => {
|
|
const { options, stepIndex } = useSetupFlow();
|
|
const progress = isDone ? 100 : options.progressWithinSection(stepIndex);
|
|
|
|
return (
|
|
<FlexContainer pos="relative">
|
|
<ResponsiveText
|
|
w="100%"
|
|
textTransform="uppercase"
|
|
fontSize="xs"
|
|
fontWeight="bold"
|
|
color="offwhite"
|
|
opacity={isActive ? 1 : 0.4}
|
|
mb={2}
|
|
content={title}
|
|
ml={[0, '3.5em']}
|
|
pr={2}
|
|
sx={{ textIndent: [0, '-1.5em'] }}
|
|
h={4}
|
|
/>
|
|
<Flex bgColor="blue20" w="full" h={2} borderRadius="sm" overflow="hidden">
|
|
{(isActive || isDone) && (
|
|
<Box bgColor="purple.400" w={`${progress}%`} />
|
|
)}
|
|
</Flex>
|
|
{isActive && (
|
|
<BoxedNextImage
|
|
pos="absolute"
|
|
mt={24}
|
|
w={[4, 6]}
|
|
h={[5, 7]}
|
|
src={LogoImage}
|
|
left={`${progress}%`}
|
|
transform="translateX(-50%)"
|
|
alt="˅"
|
|
/>
|
|
)}
|
|
</FlexContainer>
|
|
);
|
|
};
|