correcition

This commit is contained in:
Romain committed 2026-10-02 20:51:12 +02:00
1 parent d723078d89
commit 1dde1311a3
15 files changed
+100 -55

No files matched your search

+3 -3
View File
@@ -35,8 +35,8 @@
<h2>Qui peut voir quoi</h2>
<ul>
<li>Ton adresse e-mail n'est jamais visible par les autres utilisateurs.</li>
<li>Ton profil (pseudo, nom, photo, bannière, bio, titres vus, notes et statistiques) est visible par les utilisateurs connectés. Si tu passes ton compte en <strong>privé</strong>, seules les personnes que tu acceptes peuvent le voir.</li>
<li>Tes avis écrits restent privés, sauf ceux que tu choisis d'afficher sur ton profil.</li>
<li>Ton profil (pseudo, nom, photo, bannière, bio, titres vus, notes, avis et statistiques) est visible par les utilisateurs connectés. Si tu passes ton compte en <strong>privé</strong>, seules les personnes que tu acceptes peuvent le voir.</li>
<li>Tes avis écrits font partie de ton profil, comme tes notes. Tes listes personnelles et tes réglages restent privés.</li>
</ul>
<h2>Connexion avec Google</h2>
@@ -57,7 +57,7 @@
<hr />
<h1 style="font-size:1.4rem">Privacy policy (English summary)</h1>
<p>AzuuCine is a free, ad-free personal watch journal. It stores your email (and your name if you sign in with Google), your library, ratings, reviews and profile. Your email is never shown to other users; your profile is visible to signed-in users unless you make your account private; written reviews stay private unless you choose to show them. Google sign-in only shares your email, name and account ID. Data is stored with Supabase and hosted on Netlify; no ads, no trackers, nothing is sold. You can export your data or delete your account at any time from Settings → Account.</p>
<p>AzuuCine is a free, ad-free personal watch journal. It stores your email (and your name if you sign in with Google), your library, ratings, reviews and profile. Your email is never shown to other users; your profile (including ratings and written reviews) is visible to signed-in users unless you make your account private; personal lists and settings stay private. Google sign-in only shares your email, name and account ID. Data is stored with Supabase and hosted on Netlify; no ads, no trackers, nothing is sold. You can export your data or delete your account at any time from Settings → Account.</p>
<p class="muted"><a href="/">← Retour à AzuuCine</a></p>
</main>
+2 -7
View File
@@ -7,6 +7,7 @@ import { cachedMonth, isBrowsableMonth, loadMonth, RELEASE_CATEGORIES } from '..
import { remotePosterToLocal } from '../lib/image'
import { calendarEvents, loadReleases, refreshReleases } from '../lib/releases'
import { readStorage } from '../lib/security'
import { useScrollLock } from '../lib/scrollLock'
import { cx, normalizeText, todayISO } from '../lib/utils'
import { useMedia } from '../store'
import type { MediaInput, MediaItem, MediaType } from '../types'
@@ -107,13 +108,7 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
const [added, setAdded] = useState<Set<string>>(new Set())
const request = useRef(0)
useEffect(() => {
const prev = document.body.style.overflow
document.body.style.overflow = 'hidden'
return () => {
document.body.style.overflow = prev
}
}, [])
useScrollLock()
useEffect(() => {
try {
+8 -17
View File
@@ -6,6 +6,7 @@ import { canonicalGenre, canonicalSubtype, genreLabel, genreSuggestions as defau
import { fileToPosterDataURL } from '../lib/image'
import { getTmdbCredits } from '../lib/catalogApi'
import { renderItemCard, slug } from '../lib/shareCard'
import { useScrollLock } from '../lib/scrollLock'
import { cx, formatRating, todayISO } from '../lib/utils'
import { useMedia } from '../store'
import type { MediaInput, MediaItem, RatingScale, WatchStatus } from '../types'
@@ -127,7 +128,7 @@ function Rewatches({ dates, onChange }: { dates: string[]; onChange: (d: string[
}
export default function MediaForm({ item, onClose, onGoToSettings }: Props) {
const { add, update, remove, items, settings, lists, account } = useMedia()
const { add, update, remove, items, settings, lists } = useMedia()
const [form, setForm] = useState<MediaInput>(() => {
if (!item) return EMPTY
const { id: _id, createdAt: _c, updatedAt: _u, ...rest } = item
@@ -142,13 +143,7 @@ export default function MediaForm({ item, onClose, onGoToSettings }: Props) {
const typeInfo = TYPE_BY_VALUE[form.type]
// Bloque le défilement de la page derrière la feuille
useEffect(() => {
const prev = document.body.style.overflow
document.body.style.overflow = 'hidden'
return () => {
document.body.style.overflow = prev
}
}, [])
useScrollLock()
const set = <K extends keyof MediaInput>(key: K, value: MediaInput[K]) => setForm((f) => ({ ...f, [key]: value }))
@@ -179,6 +174,11 @@ export default function MediaForm({ item, onClose, onGoToSettings }: Props) {
const setStatus = (status: WatchStatus) =>
setForm((f) => {
const next = { ...f, status }
// « À voir » : pas encore regardé, donc pas de dates
if (status === 'a_voir') {
next.startDate = undefined
next.endDate = undefined
}
if (status === 'en_cours' && !f.startDate) next.startDate = todayISO()
if (status === 'termine') {
if (!f.endDate) next.endDate = todayISO()
@@ -511,15 +511,6 @@ export default function MediaForm({ item, onClose, onGoToSettings }: Props) {
<Section title={t('form.review')}>
<textarea className="field min-h-32 resize-y" value={form.notes ?? ''} onChange={(e) => set('notes', e.target.value)} placeholder={t('form.reviewPh')} />
{account && (
<label className="mt-3 flex items-start gap-2.5 text-sm text-ink-2">
<input type="checkbox" className="mt-0.5 size-4 accent-[var(--color-accent)]" checked={!!form.notesPublic} onChange={(e) => set('notesPublic', e.target.checked || undefined)} />
<span>
{t('form.reviewPublic')}
<span className="block text-xs text-ink-3">{t('form.reviewPublicHint')}</span>
</span>
</label>
)}
</Section>
<div className="space-y-2 border-t border-line pt-6">
+2 -7
View File
@@ -20,6 +20,7 @@ import type { MediaItem } from '../types'
import { TypeBadge } from './Badges'
import Poster from './Poster'
import { RatingBadge } from './Rating'
import { useScrollLock } from '../lib/scrollLock'
const CARD = 112 // largeur d'une affiche dans le rouleau (w-28)
const GAP = 12
@@ -68,13 +69,7 @@ export default function Roulette({ onClose, onOpen }: Props) {
}
// Bloque le défilement derrière + mémorise les filtres
useEffect(() => {
const prev = document.body.style.overflow
document.body.style.overflow = 'hidden'
return () => {
document.body.style.overflow = prev
}
}, [])
useScrollLock()
useEffect(() => saveFilters(filters), [filters])
// Changer les filtres efface le tirage en cours
+4 -2
View File
@@ -14,7 +14,7 @@ interface Props {
normalize?: (input: string) => string
}
/** Saisie de tags libres avec suggestions tapables. */
/** Saisie de tags libres ; des suggestions apparaissent quand on commence à taper. */
export default function TagInput({ value, onChange, suggestions, placeholder, display = (v) => v, normalize = (v) => v }: Props) {
const [text, setText] = useState('')
@@ -29,7 +29,9 @@ export default function TagInput({ value, onChange, suggestions, placeholder, di
const filtered = useMemo(() => {
const q = normalizeText(text)
const taken = new Set(value.map((v) => normalizeText(display(v))))
return suggestions.filter((s) => !taken.has(normalizeText(s)) && (!q || normalizeText(s).includes(q))).slice(0, 12)
// Suggestions seulement pendant la saisie (pas de rangée de genres affichée en permanence)
if (!q) return []
return suggestions.filter((s) => !taken.has(normalizeText(s)) && normalizeText(s).includes(q)).slice(0, 12)
}, [text, value, suggestions])
return (
+2 -7
View File
@@ -7,6 +7,7 @@ import { useMedia } from '../store'
import type { TopCategory } from '../types'
import { TypeBadge } from './Badges'
import Poster from './Poster'
import { useScrollLock } from '../lib/scrollLock'
interface Props {
category: TopCategory
@@ -29,13 +30,7 @@ export default function TopFiveEditor({ category: initialCategory, onClose }: Pr
const catInfo = TOP_CATEGORIES.find((c) => c.value === category)!
const byId = useMemo(() => new Map(items.map((i) => [i.id, i])), [items])
useEffect(() => {
const prev = document.body.style.overflow
document.body.style.overflow = 'hidden'
return () => {
document.body.style.overflow = prev
}
}, [])
useScrollLock()
/** Changer de catégorie enregistre d'abord celle en cours. */
const switchCategory = async (cat: TopCategory) => {
+9 -1
View File
@@ -2,6 +2,7 @@ import { Loader2, Star, UserPlus } from 'lucide-react'
import { useCallback, useEffect, useState } from 'react'
import { t } from '../../i18n'
import { getFeed, type FeedEntry } from '../../lib/cloud/social'
import { useOnResume } from '../../lib/onResume'
import { timeAgo } from '../../lib/timeAgo'
import { formatRating } from '../../lib/utils'
import { useMedia } from '../../store'
@@ -34,6 +35,13 @@ export default function FriendsFeed() {
useEffect(() => {
if (social.enabled && navigator.onLine) void load()
}, [social.enabled, load])
// Retour sur l'app : on récupère ce que les abonnements ont ajouté entre-temps
useOnResume(() => void load(), social.enabled)
// Abonnement / désabonnement : le fil change aussi
const followKey = `${social.me?.following ?? ''}`
useEffect(() => {
if (social.enabled && followKey && navigator.onLine) void load()
}, [followKey, social.enabled, load])
if (!social.enabled) return null
@@ -86,7 +94,7 @@ export default function FriendsFeed() {
{formatRating(e.item.rating, settings.ratingScale)}
</span>
)}
{e.item.notes && e.item.notesPublic && <span>{t('feed.review')}</span>}
{e.item.notes && <span>{t('feed.review')}</span>}
<span>{timeAgo(e.createdAt)}</span>
</span>
</span>
+5 -2
View File
@@ -2,6 +2,7 @@ import { Check, Loader2, Plus, Star } from 'lucide-react'
import { useEffect, useState } from 'react'
import { t } from '../../i18n'
import { genreLabel } from '../../lib/genres'
import { useScrollLock } from '../../lib/scrollLock'
import { cx, formatDate, formatRating, normalizeText } from '../../lib/utils'
import { useMedia } from '../../store'
import type { MediaInput, MediaItem } from '../../types'
@@ -24,6 +25,8 @@ export default function ItemPeek({ item, owner, onClose }: { item: MediaItem; ow
(i) => (item.externalId && i.externalId === item.externalId) || normalizeText(i.title) === normalizeText(item.title),
)
useScrollLock()
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
window.addEventListener('keydown', onKey)
@@ -61,12 +64,12 @@ export default function ItemPeek({ item, owner, onClose }: { item: MediaItem; ow
}
return (
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-black/70 sm:items-center sm:p-4" onClick={onClose}>
<div className="fixed inset-0 z-[60] flex touch-none items-end justify-center overscroll-none bg-black/70 sm:items-center sm:p-4" onClick={onClose}>
<div
role="dialog"
aria-modal="true"
aria-label={item.title}
className="sheet-in safe-bottom max-h-[88dvh] w-full max-w-md overflow-y-auto rounded-t-3xl border border-line-strong bg-surface p-5 sm:rounded-3xl"
className="sheet-in safe-bottom max-h-[88dvh] w-full max-w-md touch-pan-y overflow-y-auto overscroll-contain rounded-t-3xl border border-line-strong bg-surface p-5 sm:rounded-3xl"
onClick={(e) => e.stopPropagation()}
>
<div className="flex gap-4">
+1
View File
@@ -21,6 +21,7 @@ export default function PersonRow({ person, actions }: { person: ProfileCard; ac
await unfollow(person.id)
setRelation('none')
}
void social.refresh()
} catch {
/* réseau : rien ne change */
} finally {
+2
View File
@@ -108,6 +108,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
try {
await follow(profile.id)
await load()
void social.refresh()
} catch (e) {
setToast((e as Error).message)
} finally {
@@ -122,6 +123,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
try {
await unfollow(profile.id)
await load()
void social.refresh()
} catch (e) {
setToast((e as Error).message)
} finally {
+3 -6
View File
@@ -1,18 +1,15 @@
import { X } from 'lucide-react'
import { useEffect, type ReactNode } from 'react'
import { t } from '../../i18n'
import { useScrollLock } from '../../lib/scrollLock'
/** Écran plein (profil, recherche…) avec en-tête et bouton fermer. */
export default function Sheet({ title, onClose, right, children, label }: { title: ReactNode; onClose: () => void; right?: ReactNode; children: ReactNode; label: string }) {
useScrollLock()
useEffect(() => {
const prev = document.body.style.overflow
document.body.style.overflow = 'hidden'
const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose()
window.addEventListener('keydown', onKey)
return () => {
document.body.style.overflow = prev
window.removeEventListener('keydown', onKey)
}
return () => window.removeEventListener('keydown', onKey)
}, [onClose])
return (
<div className="sheet-in fixed inset-0 z-50 flex flex-col bg-bg" role="dialog" aria-modal="true" aria-label={label}>
+3
View File
@@ -7,6 +7,7 @@ import FollowList from './FollowList'
import ItemPeek, { type PeekOwner } from './ItemPeek'
import PeopleSearch from './PeopleSearch'
import ProfileView from './ProfileView'
import { useOnResume } from '../../lib/onResume'
import WelcomeProfile, { RANDOM_USERNAME } from './WelcomeProfile'
interface SocialApi {
@@ -84,6 +85,8 @@ export function SocialProvider({ children, onOpenOwnItem }: { children: ReactNod
useEffect(() => {
void refresh()
}, [refresh])
// Nouvelles demandes d'abonnement, compteurs… mis à jour au retour sur l'app
useOnResume(() => void refresh(), enabled)
const push = useCallback((o: Overlay) => setStack((s) => [...s.slice(-8), o]), [])
const pop = useCallback(() => setStack((s) => s.slice(0, -1)), [])
+28
View File
@@ -0,0 +1,28 @@
import { useEffect, useRef } from 'react'
/**
* Relance `fn` quand l'app revient au premier plan (onglet réaffiché, PWA rouverte, réseau retrouvé),
* au plus une fois toutes les `minGapMs`.
*/
export function useOnResume(fn: () => void, enabled = true, minGapMs = 20_000) {
const last = useRef(Date.now())
const cb = useRef(fn)
cb.current = fn
useEffect(() => {
if (!enabled) return
const run = () => {
if (document.visibilityState !== 'visible' || !navigator.onLine) return
if (Date.now() - last.current < minGapMs) return
last.current = Date.now()
cb.current()
}
document.addEventListener('visibilitychange', run)
window.addEventListener('focus', run)
window.addEventListener('online', run)
return () => {
document.removeEventListener('visibilitychange', run)
window.removeEventListener('focus', run)
window.removeEventListener('online', run)
}
}, [enabled, minGapMs])
}
+23
View File
@@ -0,0 +1,23 @@
import { useEffect } from 'react'
/**
* Bloque le défilement de la page derrière une fenêtre (fiche, profil, aperçu…).
* Compteur partagé : avec plusieurs fenêtres empilées, la page ne se débloque qu'à la fermeture de la dernière.
*/
let locks = 0
function apply(on: boolean) {
for (const el of [document.documentElement, document.body]) {
el.style.overflow = on ? 'hidden' : ''
el.style.overscrollBehavior = on ? 'none' : ''
}
}
export function useScrollLock() {
useEffect(() => {
if (locks++ === 0) apply(true)
return () => {
if (--locks === 0) apply(false)
}
}, [])
}
@@ -344,7 +344,8 @@ immutable
set search_path = ''
as $$
select case when length(coalesce(x->>'poster', '')) > 150000 then x - 'poster' else x end
from (select (case when d->>'notesPublic' = 'true' then d else d - 'notes' end) - 'listIds' as x) s
-- Les avis sont publics (comme sur Letterboxd) ; les listes perso restent privées
from (select d - 'listIds' - 'notesPublic' as x) s
$$;
create or replace function public.profile_card(p public.profiles)
@@ -409,9 +410,10 @@ begin
from public.items where user_id = p.id and not deleted and jsonb_typeof(data->'top') = 'object'
),
'recent', (
select coalesce(jsonb_agg(public.public_item(s.data) order by s.k desc), '[]'::jsonb)
select coalesce(jsonb_agg(public.public_item(s.data) order by s.k desc nulls last), '[]'::jsonb)
from (
select data, coalesce(data->>'endDate', left(data->>'updatedAt', 10)) as k
-- Date de visionnage (pas la date de modification : un import ou une synchro ne doit pas tout faire remonter)
select data, coalesce(data->>'endDate', data->>'startDate') as k
from public.items
where user_id = p.id and not deleted and data->>'status' = 'termine'
order by k desc nulls last