recipes/client/modules/Home.tsx
One file of recipes/client, at commit 9a5bb24.
// site/Home: the public act. It reads identity but does not require it.
import type { Auth } from '@aweftjs/auth/client';
import { h } from '@aweftjs/ui';
import { trace } from '../trace.ts';
export const deps = ['auth/Session'];
export default ({ imports }: { imports: Readonly<Record<string, unknown>> }): {
title: string;
component: () => unknown;
stop(): void;
} => {
const session = imports['Session'] as Auth;
trace('site/Home loaded');
return {
title: 'Home',
component: (): unknown => (
<section id="home">
<h1>Notes</h1>
<p id="who">
{session.user.map((who) =>
(typeof who === 'string' ? `signed in as ${who}` : who === null ? 'nobody' : 'asking'))}
</p>
</section>
),
stop: () => { trace('site/Home stopped'); },
};
};