--- // Cestino degli articoli: qui si recupera ciò che è stato tolto dal sito, o lo si elimina // per sempre. Chi gestisce vede tutto, gli altri solo i propri articoli. import Admin from '../../layouts/Admin.astro'; import { getDb } from '../../lib/db'; import { listTrashed } from '../../lib/posts'; import { listUsers } from '../../lib/auth'; export const prerender = false; const user = Astro.locals.user!; const isManager = user.role === 'superuser' || user.role === 'admin'; const posts = listTrashed(getDb(), isManager ? undefined : user.id); const nameById = new Map(listUsers(getDb()).map((u) => [u.id, u.username])); const fmt = new Intl.DateTimeFormat('it-IT', { dateStyle: 'short', timeStyle: 'short' }); ---

Cestino

← Torna agli articoli

{posts.length === 0 ? (

Il cestino è vuoto.

) : ( {isManager && } {posts.map((p) => ( {isManager && } ))}
TitoloCategoriaAutoreNel cestino dalAzioni
{p.title} {p.category}{p.author_id ? (nameById.get(p.author_id) ?? 'Staff InsanityLab') : 'Staff InsanityLab'}{p.deleted_at ? fmt.format(new Date(p.deleted_at.replace(' ', 'T') + 'Z')) : '—'}
)}