* storybook v2 init * Merge config into storybook vite build * Remove path * Storybook config tweaks * Added styles and settings for storybook v2, and started working on button documentation and examples. * Badges + flex wrap on mobile * Breadcrumbs+button+avatar * Checkbox * Input + moving files around * WIP table * WIP table grid * Replaced imports for new components. * Added first steps for varianttable. * Small alignment fix. * Custom Args Table - With scrollbar * Adding table to components that need it + darkmode * Add intro * Fix types * Remove V1 storybook and replace with V2 * Fix badge type error * Fixed storybook dependencies * Added cover image to storybook * Remove vita from ts config, we dont use vite. * Fixed button import. * Explained postcss pseudo plugin. * Fixed badge import. * Add Avatar Stories * ButtonGroup Stories * Fixed imports * Add checkbox stories * Add exports for differnt types of inputs * Fix form and text area input * Fix mass import errors Co-authored-by: Jeroen Reumkens <[email protected]> Co-authored-by: Alex van Andel <[email protected]>
68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
import { GetServerSidePropsContext } from "next";
|
|
import { signOut, useSession } from "next-auth/react";
|
|
import { useRouter } from "next/router";
|
|
import { useEffect } from "react";
|
|
|
|
import { WEBSITE_URL } from "@calcom/lib/constants";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Icon } from "@calcom/ui/Icon";
|
|
import { Button } from "@calcom/ui/components/button";
|
|
|
|
import { inferSSRProps } from "@lib/types/inferSSRProps";
|
|
|
|
import AuthContainer from "@components/ui/AuthContainer";
|
|
|
|
import { ssrInit } from "@server/lib/ssr";
|
|
|
|
type Props = inferSSRProps<typeof getServerSideProps>;
|
|
|
|
export default function Logout(props: Props) {
|
|
const { status } = useSession();
|
|
if (status === "authenticated") signOut({ redirect: false });
|
|
const router = useRouter();
|
|
useEffect(() => {
|
|
if (props.query?.survey === "true") {
|
|
router.push(`${WEBSITE_URL}/cancellation`);
|
|
}
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [props.query?.survey]);
|
|
const { t } = useLocale();
|
|
|
|
return (
|
|
<AuthContainer title={t("logged_out")} description={t("youve_been_logged_out")} showLogo>
|
|
<div className="mb-4">
|
|
<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100">
|
|
<Icon.FiCheck className="h-6 w-6 text-green-600" />
|
|
</div>
|
|
<div className="mt-3 text-center sm:mt-5">
|
|
<h3 className="text-lg font-medium leading-6 text-gray-900" id="modal-title">
|
|
{t("youve_been_logged_out")}
|
|
</h3>
|
|
<div className="mt-2">
|
|
<p className="text-sm text-gray-500">{t("hope_to_see_you_soon")}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<Button href="/auth/login" passHref className="flex w-full justify-center">
|
|
{t("go_back_login")}
|
|
</Button>
|
|
</AuthContainer>
|
|
);
|
|
}
|
|
|
|
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
|
const ssr = await ssrInit(context);
|
|
// Deleting old cookie manually, remove this code after all existing cookies have expired
|
|
context.res.setHeader(
|
|
"Set-Cookie",
|
|
"next-auth.session-token=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"
|
|
);
|
|
|
|
return {
|
|
props: {
|
|
trpcState: ssr.dehydrate(),
|
|
query: context.query,
|
|
},
|
|
};
|
|
}
|