2024-02-20 11:47:52 +01:00
|
|
|
import { PageProps } from '$fresh/server.ts'
|
2024-07-01 13:11:20 +02:00
|
|
|
import { Markdown } from ':components/Markdown.tsx'
|
|
|
|
import { MemberCard, memberMock } from ':components/MemberCard.tsx'
|
2024-02-20 11:47:52 +01:00
|
|
|
|
|
|
|
const db = [
|
|
|
|
'julien.oculi',
|
|
|
|
]
|
|
|
|
|
|
|
|
async function getCarnet(user: string): Promise<string> {
|
|
|
|
try {
|
|
|
|
const response = await fetch(
|
|
|
|
`https://git.cohabit.fr/${user}/.carnet/raw/branch/main/index.md`,
|
|
|
|
)
|
|
|
|
return response.text()
|
|
|
|
} catch (error) {
|
|
|
|
return 'Carnet introuvable\n```js\nString(error)\n```'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function Member(_: Request, { params }: PageProps) {
|
|
|
|
const id = Number(params.id)
|
|
|
|
const Member = memberMock.at(id)
|
|
|
|
|
|
|
|
if (!Member) {
|
|
|
|
return <h3>Membre inconnu, peut être serai vous le prochain</h3>
|
|
|
|
}
|
|
|
|
|
|
|
|
const carnet = await getCarnet(db.at(id)!)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
display: 'grid',
|
|
|
|
gridTemplateColumns: 'auto 1fr',
|
|
|
|
gap: 'var(--_gap)',
|
|
|
|
justifyContent: 'center',
|
|
|
|
}}
|
|
|
|
>
|
2024-02-20 11:56:15 +01:00
|
|
|
<style>{'.markdown-body { max-width: 80dvw; }'}</style>
|
2024-02-20 11:47:52 +01:00
|
|
|
<div>
|
|
|
|
{MemberCard(Member)}
|
2024-02-20 11:56:15 +01:00
|
|
|
<br />
|
2024-02-20 11:47:52 +01:00
|
|
|
<a
|
|
|
|
href={`/membres/${id}/portfolio/index.html`}
|
|
|
|
class='cta'
|
|
|
|
target='_blank'
|
|
|
|
>
|
|
|
|
Portfolio
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<Markdown>{carnet}</Markdown>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|