mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-04-24 03:00:09 -04:00
This is being merged for further testing so as to not block the progress of `develop` & not require more rebases.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { SetupAvailability } from 'components/Setup/SetupAvailability';
|
|
import { SetupProfile } from 'components/Setup/SetupProfile';
|
|
import { SetupContextProvider } from 'contexts/SetupContext';
|
|
import { Maybe } from 'graphql/autogen/types';
|
|
import { useUser } from 'lib/hooks';
|
|
import { InferGetStaticPropsType } from 'next';
|
|
import React, { useState } from 'react';
|
|
|
|
export const getStaticProps = async () => ({
|
|
props: {
|
|
hideTopMenu: true,
|
|
},
|
|
});
|
|
|
|
export type DefaultSetupProps = InferGetStaticPropsType<typeof getStaticProps>;
|
|
|
|
const AvailabilitySetup: React.FC<DefaultSetupProps> = () => {
|
|
const { user } = useUser();
|
|
const { player } = user ?? {};
|
|
const [available, setAvailability] = useState<Maybe<number>>(
|
|
player?.profile?.availableHours ?? null,
|
|
);
|
|
|
|
if (player) {
|
|
if (player?.profile?.availableHours != null && available === null) {
|
|
setAvailability(player.profile.availableHours);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<SetupContextProvider>
|
|
<SetupProfile>
|
|
<SetupAvailability {...{ available, setAvailability }} />
|
|
</SetupProfile>
|
|
</SetupContextProvider>
|
|
);
|
|
};
|
|
|
|
export default AvailabilitySetup;
|