Files
myeasycms-v2/apps/web/app/(marketing)/layout.tsx
giancarlo 1cef5ac3db Update dependencies, add copy and adjust UI
This commit updates the version of Next.js along with a series of other dependencies outlined in the pnpm-lock.yaml file. The new copy "For each {{unit}}" has been added to the billing.json file and several adjustments have been made in the UI components. In particular, a separator has been added, animations have been set to re-run on re-render for certain elements, and the PricingTable component has been added.
2024-04-05 17:30:37 +08:00

40 lines
1.0 KiB
TypeScript

import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import { Separator } from '@kit/ui/separator';
import { SiteFooter } from '~/(marketing)/_components/site-footer';
import { SiteHeader } from '~/(marketing)/_components/site-header';
import { withI18n } from '~/lib/i18n/with-i18n';
async function SiteLayout(props: React.PropsWithChildren) {
const user = await getUser();
return (
<>
<SiteHeader user={user} />
{props.children}
<Separator />
<SiteFooter />
</>
);
}
export default withI18n(SiteLayout);
async function getUser() {
const client = getSupabaseServerComponentClient();
// Supabase is going to be complaining about this line
// since we use getSession instead of getUser
// we don't quite care because we only need to know if the user is logged in
// to display the user menu in the header.
// There is no need to ping the server while navigating to marketing pages.
const {
data: { session },
} = await client.auth.getSession();
return session?.user;
}