2021-07-31 17:22:48 +00:00
|
|
|
import type { BlitzPage } from "blitz";
|
2021-08-28 06:03:49 +00:00
|
|
|
import { Routes, useMutation } from "blitz";
|
2021-07-31 17:22:48 +00:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faCreditCard, faUserCircle } from "@fortawesome/pro-regular-svg-icons";
|
|
|
|
|
|
|
|
import Layout from "../../core/layouts/layout";
|
|
|
|
|
|
|
|
import appLogger from "../../../integrations/logger";
|
|
|
|
import useRequireOnboarding from "../../core/hooks/use-require-onboarding";
|
2021-08-28 06:03:49 +00:00
|
|
|
import logout from "../../auth/mutations/logout";
|
2021-07-31 17:22:48 +00:00
|
|
|
|
|
|
|
const logger = appLogger.child({ page: "/settings" });
|
|
|
|
|
|
|
|
/* eslint-disable react/display-name */
|
|
|
|
const navigation = [
|
|
|
|
{
|
|
|
|
name: "Account",
|
|
|
|
href: "/settings/account",
|
2021-08-01 14:03:49 +00:00
|
|
|
icon: ({ className = "w-8 h-8" }) => <FontAwesomeIcon size="lg" className={className} icon={faUserCircle} />,
|
2021-07-31 17:22:48 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Billing",
|
|
|
|
href: "/settings/billing",
|
2021-08-01 14:03:49 +00:00
|
|
|
icon: ({ className = "w-8 h-8" }) => <FontAwesomeIcon size="lg" className={className} icon={faCreditCard} />,
|
2021-07-31 17:22:48 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
/* eslint-enable react/display-name */
|
|
|
|
|
|
|
|
const Settings: BlitzPage = () => {
|
|
|
|
useRequireOnboarding();
|
2021-08-28 06:03:49 +00:00
|
|
|
const [logoutMutation] = useMutation(logout);
|
2021-07-31 17:22:48 +00:00
|
|
|
|
|
|
|
return (
|
2021-08-01 07:40:18 +00:00
|
|
|
<>
|
|
|
|
<div className="flex flex-col space-y-6 p-6">
|
|
|
|
<h2 className="text-3xl font-bold">Settings</h2>
|
|
|
|
</div>
|
|
|
|
<div className="flex flex-col space-y-6 p-6">
|
|
|
|
<aside className="py-6 lg:col-span-3">
|
|
|
|
<nav className="space-y-1">
|
|
|
|
{navigation.map((item) => (
|
|
|
|
<a
|
|
|
|
key={item.name}
|
|
|
|
href={item.href}
|
|
|
|
className="border-transparent text-gray-900 hover:bg-gray-50 hover:text-gray-900 group border-l-4 px-3 py-2 flex items-center text-sm font-medium"
|
|
|
|
>
|
|
|
|
<item.icon className="text-gray-400 group-hover:text-gray-500 flex-shrink-0 -ml-1 mr-3 h-6 w-6" />
|
|
|
|
<span className="truncate">{item.name}</span>
|
|
|
|
</a>
|
|
|
|
))}
|
|
|
|
</nav>
|
|
|
|
</aside>
|
2021-08-28 06:03:49 +00:00
|
|
|
|
|
|
|
<button onClick={() => logoutMutation()}>Log out</button>
|
2021-08-01 07:40:18 +00:00
|
|
|
</div>
|
|
|
|
</>
|
2021-07-31 17:22:48 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-08-01 03:05:40 +00:00
|
|
|
Settings.getLayout = (page) => <Layout title="Settings">{page}</Layout>;
|
|
|
|
|
|
|
|
Settings.authenticate = { redirectTo: Routes.SignIn() };
|
2021-07-31 17:22:48 +00:00
|
|
|
|
|
|
|
export default Settings;
|