diff --git a/components/ActiveLink.tsx b/components/ActiveLink.tsx index f4da7d65..d7ae61c3 100644 --- a/components/ActiveLink.tsx +++ b/components/ActiveLink.tsx @@ -1,5 +1,4 @@ import { useRouter } from 'next/router' -import PropTypes from 'prop-types' import Link from 'next/link' import React, { Children } from 'react' diff --git a/components/Settings.tsx b/components/Settings.tsx index ff23e35b..bfbfd19c 100644 --- a/components/Settings.tsx +++ b/components/Settings.tsx @@ -1,5 +1,5 @@ import ActiveLink from '../components/ActiveLink'; -import { UserCircleIcon, KeyIcon, CodeIcon, UserGroupIcon } from '@heroicons/react/outline'; +import { UserCircleIcon, KeyIcon, CodeIcon, UserGroupIcon, CreditCardIcon } from '@heroicons/react/outline'; export default function SettingsShell(props) { return ( @@ -37,6 +37,11 @@ export default function SettingsShell(props) { Teams + {/* Change/remove me, if you're self-hosting */} + + Billing + + {/* diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx new file mode 100644 index 00000000..57acc64f --- /dev/null +++ b/pages/settings/billing.tsx @@ -0,0 +1,66 @@ +import Head from 'next/head'; +import Shell from '../../components/Shell'; +import SettingsShell from '../../components/Settings'; +import prisma from '../../lib/prisma'; +import {getSession, useSession} from 'next-auth/client'; + +export default function Billing(props) { + const [ session, loading ] = useSession(); + + if (loading) { + return Loading...; + } + + return ( + + + Billing | Calendso + + + + + + Change your Subscription + + + Cancel, update credit card or change plan + + + + + + + + + ); +} + +export async function getServerSideProps(context) { + const session = await getSession(context); + if (!session) { + return { redirect: { permanent: false, destination: '/auth/login' } }; + } + + const user = await prisma.user.findFirst({ + where: { + email: session.user.email, + }, + select: { + id: true, + username: true, + name: true, + email: true, + bio: true, + avatar: true, + timeZone: true, + weekStart: true, + } + }); + + return { + props: {user}, // will be passed to the page component as props + } +} \ No newline at end of file
Loading...
+ Cancel, update credit card or change plan +