misc_pterodactyl-panel/resources/scripts/components/dashboard/AccountOverviewContainer.tsx

55 lines
1.9 KiB
TypeScript
Raw Normal View History

import ContentBox from '@/components/elements/ContentBox';
2019-06-26 04:28:56 +00:00
import UpdatePasswordForm from '@/components/dashboard/forms/UpdatePasswordForm';
import UpdateEmailAddressForm from '@/components/dashboard/forms/UpdateEmailAddressForm';
import ConfigureTwoFactorForm from '@/components/dashboard/forms/ConfigureTwoFactorForm';
import PageContentBlock from '@/components/elements/PageContentBlock';
2020-07-03 21:19:05 +00:00
import tw from 'twin.macro';
import { breakpoint } from '@/theme';
2022-11-25 20:25:03 +00:00
import styled from 'styled-components';
import MessageBox from '@/components/MessageBox';
import { useLocation } from 'react-router-dom';
const Container = styled.div`
${tw`flex flex-wrap`};
& > div {
${tw`w-full`};
${breakpoint('sm')`
width: calc(50% - 1rem);
`}
${breakpoint('md')`
${tw`w-auto flex-1`};
`}
}
`;
export default () => {
2022-11-25 20:25:03 +00:00
const { state } = useLocation();
return (
2022-11-25 20:25:03 +00:00
<PageContentBlock title="Account Overview">
{state?.twoFactorRedirect && (
2022-11-25 20:25:03 +00:00
<MessageBox title="2-Factor Required" type="error">
Your account must have two-factor authentication enabled in order to continue.
</MessageBox>
)}
<Container css={[tw`lg:grid lg:grid-cols-3 mb-10`, state?.twoFactorRedirect ? tw`mt-4` : tw`mt-10`]}>
2022-11-25 20:25:03 +00:00
<ContentBox title="Update Password" showFlashes="account:password">
<UpdatePasswordForm />
</ContentBox>
2022-11-25 20:25:03 +00:00
<ContentBox css={tw`mt-8 sm:mt-0 sm:ml-8`} title="Update Email Address" showFlashes="account:email">
<UpdateEmailAddressForm />
</ContentBox>
2022-11-25 20:25:03 +00:00
<ContentBox css={tw`md:ml-8 mt-8 md:mt-0`} title="Two-Step Verification">
<ConfigureTwoFactorForm />
</ContentBox>
</Container>
</PageContentBlock>
);
};