Social : avis avec spoilers, commentaires sous les avis, listes partagées
- Spoilers : case « Contient des spoilers » dans l'éditeur d'avis (notesSpoiler, synchronisé avec la fiche) ; texte retiré de la page (pas seulement flouté) jusqu'à « Afficher le spoiler » dans les avis d'un titre et l'aperçu d'une fiche ; badge sur mon avis. - Commentaires sous les avis (≤ 500 car.) : fil avec auteur, date relative, suppression (auteur / auteur de l'avis / admin), compteur à côté des réactions, notification « review_comment » (préférence notifPrefs.comments), anti-spam 10/min côté SQL. - Listes partagées : section dans l'onglet Listes, invitations (notification + acceptation), membres, qui a ajouté quoi, quitter / retirer un membre / supprimer, ajout depuis la fiche et depuis la bibliothèque, ouverture d'un titre (ma fiche ou fiche du catalogue). - SQL : 20261009130000_review_spoilers_comments.sql et 20261009130100_shared_lists.sql (RLS, aucun accès direct aux tables, fonctions security definer + search_path vide). - Tout se masque sans compte ou si les migrations ne sont pas encore appliquées. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
41 files changed
+3487
-27
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { X } from 'lucide-react'
|
||||
import { EyeOff, X } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { t } from '../../i18n'
|
||||
import { useBackToClose } from '../../lib/backNav'
|
||||
@@ -6,11 +6,24 @@ import { useEscape } from '../../lib/escape'
|
||||
import { LIMITS } from '../../lib/security'
|
||||
|
||||
/** Écriture de mon avis, en plein écran pour avoir la place d'écrire. */
|
||||
export default function ReviewEditor({ title, initial, onSave, onClose }: { title: string; initial: string; onSave: (notes: string) => void; onClose: () => void }) {
|
||||
export default function ReviewEditor({
|
||||
title,
|
||||
initial,
|
||||
initialSpoiler = false,
|
||||
onSave,
|
||||
onClose,
|
||||
}: {
|
||||
title: string
|
||||
initial: string
|
||||
initialSpoiler?: boolean
|
||||
onSave: (notes: string, spoiler: boolean) => void
|
||||
onClose: () => void
|
||||
}) {
|
||||
const [text, setText] = useState(initial)
|
||||
const [spoiler, setSpoiler] = useState(initialSpoiler)
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
const changed = text.trim() !== initial.trim()
|
||||
const changed = text.trim() !== initial.trim() || (spoiler !== initialSpoiler && !!text.trim())
|
||||
return (
|
||||
<div className="sheet sheet-in z-[60]" role="dialog" aria-modal="true" aria-label={t('form.review')}>
|
||||
<header className="safe-top border-b border-line">
|
||||
@@ -19,7 +32,7 @@ export default function ReviewEditor({ title, initial, onSave, onClose }: { titl
|
||||
<X size={22} />
|
||||
</button>
|
||||
<h2 className="min-w-0 flex-1 truncate text-center text-base font-semibold">{title}</h2>
|
||||
<button onClick={() => onSave(text.trim())} disabled={!changed} className="btn btn-light px-4 py-2 text-sm">
|
||||
<button onClick={() => onSave(text.trim(), spoiler && !!text.trim())} disabled={!changed} className="btn btn-light px-4 py-2 text-sm">
|
||||
{t('common.save')}
|
||||
</button>
|
||||
</div>
|
||||
@@ -35,6 +48,15 @@ export default function ReviewEditor({ title, initial, onSave, onClose }: { titl
|
||||
maxLength={LIMITS.notes}
|
||||
autoFocus
|
||||
/>
|
||||
<label className="mt-3 flex cursor-pointer items-start gap-3 rounded-xl border border-line px-3.5 py-3">
|
||||
<input type="checkbox" checked={spoiler} onChange={(e) => setSpoiler(e.target.checked)} className="mt-0.5 size-4 shrink-0 accent-accent-fill" />
|
||||
<span className="min-w-0">
|
||||
<span className="flex items-center gap-1.5 text-sm font-medium text-ink">
|
||||
<EyeOff size={14} className="text-accent" aria-hidden="true" /> {t('spoiler.checkbox')}
|
||||
</span>
|
||||
<span className="mt-0.5 block text-xs text-ink-3">{t('spoiler.checkboxHint')}</span>
|
||||
</span>
|
||||
</label>
|
||||
<p className="mt-2 text-xs text-ink-3">{t('title.reviewPublicHint')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user