Files
nav-carte/pages/bibliotheque/fiche/[slug].vue
T

47 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
/bibliotheque/fiche/<slug> — lot B9. La page à elle d'une fiche de lecture servie, rendue au serveur.
`noindex` tant que la fiche n'a pas été relue (bandeau) ; route dynamique : hors du sitemap par
construction (utils/seo.ts, cheminsSitemap). Un socle non servi répond 404, comme l'API.
-->
<template>
<main class="flp">
<nav class="flp__retour" aria-label="Fil d’Ariane">
<NuxtLink to="/bibliotheque">Bibliothèque</NuxtLink>
<span aria-hidden="true"> › </span>
<NuxtLink :to="`/bibliotheque?vue=mixte&fiche=${fiche.id}`">voir dans l’arborescence</NuxtLink>
</nav>
<article class="flp__article">
<h1 class="flp__titre">{{ fiche.titre }}</h1>
<p class="flp__meta">{{ fiche.auteurs }} · {{ anneeTexte(fiche.annee) }} · {{ fiche.regime }}</p>
<BibliothequeFicheLecture :fiche="fiche" sommaire />
</article>
</main>
</template>
<script setup lang="ts">
import { anneeTexte } from '~/utils/bibliotheque/arbre'
const route = useRoute()
const slug = String(route.params.slug ?? '')
const { data } = await useAsyncData(`bibliotheque-page-${slug}`, () => $fetch<any>(`/api/bibliotheque/fiche/${slug}`).catch(() => null))
if (!data.value) throw createError({ statusCode: 404, statusMessage: 'Fiche introuvable ou pas encore ouverte', fatal: true })
const fiche = computed(() => data.value)
useSeoMeta({
title: () => `${fiche.value.titre} — fiche de lecture — Bibliothèque AEP`,
description: () => `${fiche.value.titre}, ${fiche.value.auteurs} : fiche de lecture composée depuis les notes d’AEP, pas encore relue.`,
robots: () => (fiche.value.relecture_humaine ? undefined : 'noindex, follow'),
})
</script>
<style scoped>
.flp { height: 100%; overflow-y: auto; padding: var(--space-md) var(--space-md) var(--space-xl); color: var(--text); background: var(--surface); }
.flp__retour { max-width: 68ch; margin: 0 auto var(--space-sm); font-size: var(--fs-sm); }
.flp__retour a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.flp__retour a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.flp__article { max-width: 68ch; margin: 0 auto; }
.flp__titre { margin: 0 0 var(--space-2xs); font-size: var(--fs-2xl, var(--fs-xl)); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.flp__meta { margin: 0 0 var(--space-md); font-size: var(--fs-sm); color: color-mix(in srgb, var(--text) 78%, transparent); }
@media (max-width: 640px) { .flp { padding: var(--space-sm) var(--space-sm) var(--space-lg); } }
</style>