28 lines
688 B
TypeScript
28 lines
688 B
TypeScript
import { Markdown } from ':components/Markdown.tsx'
|
|
import { db } from ':src/db/mod.ts'
|
|
import { fetchCarnet } from ':src/members/mod.ts'
|
|
import { define } from '../../utils.ts'
|
|
|
|
export default define.page(async ({ params }) => {
|
|
const uuid = params.id as ReturnType<Crypto['randomUUID']>
|
|
const user = await db.resource.user.get({ uuid }).catch(() => undefined)
|
|
|
|
if (!user) {
|
|
return <h3>Membre inconnu, peut être serez vous le prochain</h3>
|
|
}
|
|
|
|
const carnet = await fetchCarnet(user.login)
|
|
|
|
return (
|
|
<Markdown
|
|
options={{
|
|
baseUrl:
|
|
`https://git.cohabit.fr/${user.login}/.carnet/raw/branch/main/index.md`,
|
|
allowMath: true,
|
|
}}
|
|
>
|
|
{carnet}
|
|
</Markdown>
|
|
)
|
|
})
|