Merge branch 'worktree-agent-ab18ecf78a0bb887b' into claude/relaxed-maxwell-c10wof

# Conflicts:
#	src/i18n/locales/ar.ts
#	src/i18n/locales/de.ts
#	src/i18n/locales/en.ts
#	src/i18n/locales/es.ts
#	src/i18n/locales/fr.ts
#	src/i18n/locales/hi.ts
#	src/i18n/locales/id.ts
#	src/i18n/locales/it.ts
#	src/i18n/locales/ja.ts
#	src/i18n/locales/ko.ts
#	src/i18n/locales/nl.ts
#	src/i18n/locales/pl.ts
#	src/i18n/locales/pt.ts
#	src/i18n/locales/ru.ts
#	src/i18n/locales/th.ts
#	src/i18n/locales/tr.ts
#	src/i18n/locales/vi.ts
#	src/i18n/locales/zh.ts
#	src/pages/SettingsPage.tsx
This commit is contained in:
Claude committed 2026-10-09 15:26:24 +00:00
commit 6c18cfe71e
42 files changed
+4983 -32

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
import { Component, type ErrorInfo, type ReactNode } from 'react'
import { t } from '../i18n'
import { reportError } from '../lib/errorReporter'
/**
* Filet de sécurité global : si l'affichage plante, on montre un écran propre
* (« Oups… ») au lieu d'une page blanche, et l'erreur est remontée (sans donnée perso).
*/
export default class ErrorBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {
state = { failed: false }
static getDerivedStateFromError() {
return { failed: true }
}
componentDidCatch(error: unknown, info: ErrorInfo) {
reportError(error, 'render', info.componentStack ?? '')
}
render() {
if (!this.state.failed) return this.props.children
return <CrashScreen onRetry={() => this.setState({ failed: false })} />
}
}
function CrashScreen({ onRetry }: { onRetry: () => void }) {
return (
<main role="alert" className="flex min-h-dvh flex-col items-center justify-center bg-bg px-6 text-center text-ink">
<p className="text-5xl font-bold text-accent" aria-hidden>
:(
</p>
<h1 className="mt-6 text-2xl font-bold">{t('crash.title')}</h1>
<p className="mt-2 max-w-sm text-sm leading-relaxed text-ink-2">{t('crash.text')}</p>
<div className="mt-8 flex flex-wrap justify-center gap-2">
<button type="button" onClick={() => location.reload()} className="btn btn-primary">
{t('crash.reload')}
</button>
<button type="button" onClick={onRetry} className="btn btn-ghost">
{t('crash.retry')}
</button>
</div>
<p className="mt-8 max-w-xs text-xs text-ink-3">{t('crash.privacy')}</p>
</main>
)
}
+167
View File
@@ -0,0 +1,167 @@
import { Bug, Check, ExternalLink, Loader2 } from 'lucide-react'
import { useMemo, useState } from 'react'
import { createPortal } from 'react-dom'
import { t, type TKey } from '../../i18n'
import { techInfo } from '../../lib/appInfo'
import { useBackToClose } from '../../lib/backNav'
import { BUG_DESCRIPTION_MAX, BUG_DESCRIPTION_MIN, submitBugReport } from '../../lib/cloud/moderation'
import { useEscape } from '../../lib/escape'
import { useScrollLock } from '../../lib/scrollLock'
import { useMedia } from '../../store'
/** Contact de l'éditeur (sans compte, le formulaire n'est pas disponible). */
export const SUPPORT_URL = 'https://rdacet.fr'
const INFO_LABEL: Record<string, TKey> = {
version: 'bug.info.version',
browser: 'bug.info.browser',
os: 'bug.info.os',
lang: 'bug.info.lang',
theme: 'bug.info.theme',
screen: 'bug.info.screen',
viewport: 'bug.info.viewport',
route: 'bug.info.route',
standalone: 'bug.info.standalone',
online: 'bug.info.online',
}
/** Ligne « Signaler un bug » de la section « À propos » des réglages. */
export function BugReportRow() {
const { account } = useMedia()
const [open, setOpen] = useState(false)
if (!account) {
return (
<a href={SUPPORT_URL} target="_blank" rel="noopener" className="flex items-center gap-3.5 px-4 py-4 transition-colors active:bg-surface-2">
<Bug size={19} className="text-ink-2" />
<span className="flex-1">
<span className="block font-medium">{t('bug.title')}</span>
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hintLocal')}</span>
</span>
<ExternalLink size={16} className="text-ink-3" />
</a>
)
}
return (
<>
<button type="button" onClick={() => setOpen(true)} className="flex w-full items-center gap-3.5 px-4 py-4 text-start transition-colors active:bg-surface-2">
<Bug size={19} className="text-ink-2" />
<span className="flex-1">
<span className="block font-medium">{t('bug.title')}</span>
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hint')}</span>
</span>
<span className="text-ink-3">→</span>
</button>
{open && createPortal(<BugReportDialog onClose={() => setOpen(false)} />, document.body)}
</>
)
}
/** Formulaire « Signaler un bug » : description + infos techniques (montrées avant l'envoi, rien de personnel). */
export default function BugReportDialog({ onClose }: { onClose: () => void }) {
const { settings } = useMedia()
const info = useMemo(() => techInfo(settings.themeMode), [settings.themeMode])
const [text, setText] = useState('')
const [busy, setBusy] = useState(false)
const [error, setError] = useState<string>()
const [done, setDone] = useState(false)
useScrollLock()
useEscape(onClose)
useBackToClose(onClose)
const tooShort = text.trim().length < BUG_DESCRIPTION_MIN
const submit = async () => {
if (tooShort || busy) return
setBusy(true)
setError(undefined)
try {
await submitBugReport(text, info)
setDone(true)
} catch (e) {
setError((e as Error).message)
} finally {
setBusy(false)
}
}
return (
<div className="fixed inset-0 z-[80] 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-labelledby="bug-title"
className="sheet-in safe-bottom max-h-[92dvh] w-full max-w-lg 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()}
>
{done ? (
<div className="flex flex-col items-center py-4 text-center">
<span className="grid size-12 place-items-center rounded-full border border-line-strong text-accent">
<Check size={22} />
</span>
<h2 id="bug-title" className="mt-4 text-lg font-semibold">
{t('bug.thanks')}
</h2>
<p className="mt-2 text-sm leading-relaxed text-ink-2">{t('bug.thanksText')}</p>
<button type="button" onClick={onClose} className="btn btn-ghost mt-6 w-full" autoFocus>
{t('common.close')}
</button>
</div>
) : (
<>
<h2 id="bug-title" className="flex items-center gap-2 text-lg font-semibold">
<Bug size={18} className="text-accent" />
{t('bug.title')}
</h2>
<p className="mt-1.5 text-sm text-ink-3">{t('bug.intro')}</p>
<label className="mt-4 block">
<span className="label">{t('bug.description')}</span>
<textarea
className="field min-h-32 resize-y text-sm"
maxLength={BUG_DESCRIPTION_MAX}
value={text}
onChange={(e) => setText(e.target.value)}
placeholder={t('bug.placeholder')}
autoFocus
/>
<span className="mt-1 block text-end text-[11px] tabular-nums text-ink-3">
{text.length}/{BUG_DESCRIPTION_MAX}
</span>
</label>
<details className="mt-2 rounded-xl border border-line px-3.5 py-2.5 text-sm" open>
<summary className="cursor-pointer font-medium text-ink-2">{t('bug.techTitle')}</summary>
<dl className="mt-2 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs">
{Object.entries(info).map(([k, v]) => (
<div key={k} className="contents">
<dt className="text-ink-3">{INFO_LABEL[k] ? t(INFO_LABEL[k]) : k}</dt>
<dd className="min-w-0 break-words text-ink-2" dir="ltr">
{v}
</dd>
</div>
))}
</dl>
<p className="mt-2 text-[11px] leading-relaxed text-ink-3">{t('bug.techPrivacy')}</p>
</details>
{error && (
<p role="alert" className="mt-3 rounded-xl border border-accent px-3 py-2 text-sm text-ink">
{error}
</p>
)}
<div className="mt-4 grid grid-cols-2 gap-2">
<button type="button" onClick={onClose} className="btn btn-ghost">
{t('common.cancel')}
</button>
<button type="button" onClick={submit} disabled={tooShort || busy} className="btn btn-primary">
{busy && <Loader2 size={16} className="animate-spin" />}
{t('bug.send')}
</button>
</div>
</>
)}
</div>
</div>
)
}
+115
View File
@@ -0,0 +1,115 @@
import { Flag, MoreHorizontal } from 'lucide-react'
import { useState, type ReactNode } from 'react'
import { createPortal } from 'react-dom'
import { t } from '../../i18n'
import { useBackToClose } from '../../lib/backNav'
import type { ReportTarget } from '../../lib/cloud/moderation'
import { useEscape } from '../../lib/escape'
import { cx } from '../../lib/utils'
import ReportDialog from './ReportDialog'
export interface MenuAction {
icon: ReactNode
label: string
onClick: () => void
danger?: boolean
}
/**
* Bouton « ⋯ » réutilisable : ouvre un petit menu avec « Signaler » (+ actions en plus,
* ex. « Bloquer »), puis la fenêtre de signalement. Cible générique : avis, profil, commentaire, liste.
*/
export default function ReportButton({
target,
actions = [],
className,
size = 18,
label,
}: {
target: ReportTarget
actions?: MenuAction[]
className?: string
size?: number
/** Nom accessible du bouton (par défaut « Plus d'options ») */
label?: string
}) {
const [menu, setMenu] = useState(false)
const [report, setReport] = useState(false)
return (
<>
<button
type="button"
onClick={(e) => {
e.stopPropagation()
setMenu(true)
}}
aria-label={label ?? t('report.more')}
aria-haspopup="menu"
className={cx('grid size-9 shrink-0 place-items-center rounded-full text-ink-3 transition-colors hover:text-ink active:bg-surface-2', className)}
>
<MoreHorizontal size={size} />
</button>
{/* Portail : un parent animé (transform) piégerait sinon les fenêtres « fixed » dans sa boîte */}
{menu &&
createPortal(
<ActionMenu onClose={() => setMenu(false)}>
{actions.map((a) => (
<MenuItem
key={a.label}
icon={a.icon}
danger={a.danger}
onClick={() => {
setMenu(false)
a.onClick()
}}
>
{a.label}
</MenuItem>
))}
<MenuItem
icon={<Flag size={18} />}
danger
onClick={() => {
setMenu(false)
setReport(true)
}}
>
{t('report.action')}
</MenuItem>
</ActionMenu>,
document.body,
)}
{report && createPortal(<ReportDialog target={target} onClose={() => setReport(false)} />, document.body)}
</>
)
}
/** Menu en bas d'écran (comme le « ⋯ » de la fiche) : Échap / geste retour le ferment, sans fermer l'écran derrière. */
function ActionMenu({ onClose, children }: { onClose: () => void; children: ReactNode }) {
useEscape(onClose)
useBackToClose(onClose)
return (
<div className="fixed inset-0 z-[80] flex items-end justify-center bg-black/70 sm:items-center" onClick={onClose}>
<div role="menu" className="sheet-in safe-bottom w-full max-w-md rounded-t-3xl border border-line-strong bg-surface p-3 sm:rounded-3xl" onClick={(e) => e.stopPropagation()}>
{children}
<button type="button" onClick={onClose} className="mt-1 w-full rounded-xl px-3 py-3 text-center text-sm text-ink-3 active:bg-surface-2">
{t('common.cancel')}
</button>
</div>
</div>
)
}
function MenuItem({ icon, children, onClick, danger }: { icon: ReactNode; children: ReactNode; onClick: () => void; danger?: boolean }) {
return (
<button
type="button"
role="menuitem"
onClick={onClick}
className={cx('flex w-full items-center gap-3 rounded-xl px-3 py-3.5 text-start text-[15px] active:bg-surface-2', danger ? 'text-accent' : 'text-ink')}
>
{icon}
{children}
</button>
)
}
+139
View File
@@ -0,0 +1,139 @@
import { Check, Flag, Loader2 } from 'lucide-react'
import { useState } from 'react'
import { t, type TKey } from '../../i18n'
import { useBackToClose } from '../../lib/backNav'
import { REPORT_DETAILS_MAX, REPORT_REASONS, reportContent, type ReportReason, type ReportTarget } from '../../lib/cloud/moderation'
import { useEscape } from '../../lib/escape'
import { useScrollLock } from '../../lib/scrollLock'
import { cx } from '../../lib/utils'
const REASON_LABEL: Record<ReportReason, TKey> = {
spoiler: 'report.reason.spoiler',
harassment: 'report.reason.harassment',
hate: 'report.reason.hate',
sexual: 'report.reason.sexual',
spam: 'report.reason.spam',
impersonation: 'report.reason.impersonation',
other: 'report.reason.other',
}
export const reasonLabel = (r: ReportReason) => t(REASON_LABEL[r])
const TITLE: Record<ReportTarget['type'], TKey> = {
review: 'report.titleReview',
profile: 'report.titleProfile',
comment: 'report.titleComment',
list: 'report.titleList',
}
/**
* Fenêtre « Signaler » générique (avis, profil, commentaire, liste partagée) :
* motif + précision facultative (500 caractères), envoyée à l'équipe de modération.
*/
export default function ReportDialog({ target, onClose }: { target: ReportTarget; onClose: () => void }) {
const [reason, setReason] = useState<ReportReason>()
const [details, setDetails] = useState('')
const [busy, setBusy] = useState(false)
const [error, setError] = useState<string>()
const [done, setDone] = useState<'sent' | 'duplicate'>()
useScrollLock()
useEscape(onClose)
useBackToClose(onClose)
const submit = async () => {
if (!reason || busy) return
setBusy(true)
setError(undefined)
try {
const r = await reportContent(target, reason, details)
setDone(r.duplicate ? 'duplicate' : 'sent')
} catch (e) {
setError((e as Error).message)
} finally {
setBusy(false)
}
}
return (
<div className="fixed inset-0 z-[80] 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-labelledby="report-title"
className="sheet-in safe-bottom max-h-[90dvh] 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()}
>
{done ? (
<div className="flex flex-col items-center py-4 text-center">
<span className="grid size-12 place-items-center rounded-full border border-line-strong text-accent">
<Check size={22} />
</span>
<h2 id="report-title" className="mt-4 text-lg font-semibold">
{done === 'sent' ? t('report.thanks') : t('report.already')}
</h2>
<p className="mt-2 text-sm leading-relaxed text-ink-2">{t('report.thanksText')}</p>
<button type="button" onClick={onClose} className="btn btn-ghost mt-6 w-full" autoFocus>
{t('common.close')}
</button>
</div>
) : (
<>
<h2 id="report-title" className="flex items-center gap-2 text-lg font-semibold">
<Flag size={18} className="text-accent" />
{t(TITLE[target.type])}
</h2>
<p className="mt-1.5 text-sm text-ink-3">{t('report.intro')}</p>
<fieldset className="mt-4">
<legend className="label">{t('report.reason')}</legend>
<div className="space-y-1.5">
{REPORT_REASONS.map((r) => (
<label
key={r}
className={cx(
'flex cursor-pointer items-center gap-3 rounded-xl border px-3.5 py-2.5 text-sm transition-colors',
reason === r ? 'border-accent text-ink' : 'border-line text-ink-2',
)}
>
<input type="radio" name="report-reason" value={r} checked={reason === r} onChange={() => setReason(r)} className="accent-accent-fill" />
{reasonLabel(r)}
</label>
))}
</div>
</fieldset>
<label className="mt-4 block">
<span className="label">{t('report.details')}</span>
<textarea
className="field min-h-24 resize-y text-sm"
maxLength={REPORT_DETAILS_MAX}
value={details}
onChange={(e) => setDetails(e.target.value)}
placeholder={t('report.detailsPlaceholder')}
/>
<span className="mt-1 block text-end text-[11px] tabular-nums text-ink-3">
{details.length}/{REPORT_DETAILS_MAX}
</span>
</label>
{error && (
<p role="alert" className="mt-2 rounded-xl border border-accent px-3 py-2 text-sm text-ink">
{error}
</p>
)}
<div className="mt-4 grid grid-cols-2 gap-2">
<button type="button" onClick={onClose} className="btn btn-ghost">
{t('common.cancel')}
</button>
<button type="button" onClick={submit} disabled={!reason || busy} className="btn btn-primary">
{busy && <Loader2 size={16} className="animate-spin" />}
{t('report.send')}
</button>
</div>
<p className="mt-3 text-[11px] leading-relaxed text-ink-3">{t('report.privacy')}</p>
</>
)}
</div>
</div>
)
}
@@ -0,0 +1,30 @@
import { useEffect, useState } from 'react'
import { t } from '../../i18n'
import { adminAlerts, type AdminAlerts } from '../../lib/cloud/adminModeration'
/** Compteurs « à traiter » de l'administration (signalements ouverts, nouveaux bugs, nouvelles erreurs). */
export function useAdminAlerts(enabled: boolean, refreshKey: unknown = 0): AdminAlerts | null {
const [alerts, setAlerts] = useState<AdminAlerts | null>(null)
useEffect(() => {
if (!enabled) return setAlerts(null)
let alive = true
adminAlerts()
.then((a) => alive && setAlerts(a))
.catch(() => alive && setAlerts(null))
return () => {
alive = false
}
}, [enabled, refreshKey])
return alerts
}
/** Résumé court pour la ligne « Administration » des réglages (undefined s'il n'y a rien à traiter). */
export function alertsSummary(a: AdminAlerts | null): string | undefined {
if (!a) return undefined
const parts = [
a.reports ? t('adminMod.alertReports', { count: a.reports }) : '',
a.bugs ? t('adminMod.alertBugs', { count: a.bugs }) : '',
a.errors ? t('adminMod.alertErrors', { count: a.errors }) : '',
].filter(Boolean)
return parts.length ? parts.join(' · ') : undefined
}
+2
View File
@@ -11,6 +11,7 @@ import { useMedia } from '../../store'
import type { MediaInput, MediaItem } from '../../types'
import { StatusPill, TypeBadge } from '../Badges'
import Poster from '../Poster'
import ReportButton from '../moderation/ReportButton'
import Avatar from './Avatar'
import Reactions from './Reactions'
import { useEscape } from '../../lib/escape'
@@ -120,6 +121,7 @@ export default function ItemPeek({ item, owner, onClose }: { item: MediaItem; ow
{formatRating(item.rating, settings.ratingScale)}
</span>
)}
{canReact && review && <ReportButton target={{ type: 'review', id: review.item_id, userId: review.user_id }} className="-me-1.5 size-8" size={16} />}
</div>
<div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-ink-3">
<StatusPill status={item.status} />
+87 -21
View File
@@ -1,4 +1,4 @@
import { Check, Loader2, Lock, Share2, Star, UserPlus } from 'lucide-react'
import { Ban, Check, Loader2, Lock, Share2, Star, UserCheck, UserPlus } from 'lucide-react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { fmtNumber, t } from '../../i18n'
import { follow, getProfile, getProfileItems, profileLink, unfollow, type Profile } from '../../lib/cloud/social'
@@ -7,6 +7,8 @@ import { cx, formatRating } from '../../lib/utils'
import { useMedia } from '../../store'
import type { MediaItem, WatchStatus } from '../../types'
import ConfirmDialog from '../ConfirmDialog'
import ReportButton from '../moderation/ReportButton'
import { blockUser, unblockUser, useBlocked } from '../../lib/cloud/moderation'
import Poster from '../Poster'
import { EmptyState, SectionTitle } from '../ui'
import Avatar from './Avatar'
@@ -58,6 +60,9 @@ export default function ProfileView({ username, onClose }: { username: string; o
const [busy, setBusy] = useState(false)
const [confirmUnfollow, setConfirmUnfollow] = useState(false)
const [toast, setToast] = useState<string>()
const [confirmBlock, setConfirmBlock] = useState(false)
const { isBlocked } = useBlocked(!!profile && !profile.isMe)
const blocked = !!profile && !profile.isMe && isBlocked(profile.id)
const load = useCallback(async () => {
setError(undefined)
@@ -132,6 +137,36 @@ export default function ProfileView({ username, onClose }: { username: string; o
}
}
// Bloquer : il ne peut plus me suivre ni réagir à mes avis ; ses avis me sont masqués
const doBlock = async () => {
if (!profile) return
setConfirmBlock(false)
setBusy(true)
try {
await blockUser({ id: profile.id, username: profile.username, displayName: profile.displayName, avatarUrl: profile.avatarUrl })
await load()
void social.refresh()
setToast(t('block.done', { name: profile.displayName }))
} catch (e) {
setToast((e as Error).message)
} finally {
setBusy(false)
}
}
const doUnblock = async () => {
if (!profile) return
setBusy(true)
try {
await unblockUser(profile.id)
setToast(t('block.undone', { name: profile.displayName }))
} catch (e) {
setToast((e as Error).message)
} finally {
setBusy(false)
}
}
const topByCategory = useMemo(() => {
const out: { label: string; items: MediaItem[] }[] = []
// Mon profil : mes réglages locaux font foi tout de suite (même avant la synchro)
@@ -179,26 +214,43 @@ export default function ProfileView({ username, onClose }: { username: string; o
{t('social.editProfile')}
</button>
) : (
<button
onClick={toggleFollow}
disabled={busy}
className={cx('btn mb-1 px-4 py-2 text-sm', profile.relation === 'none' ? 'btn-primary' : 'btn-ghost')}
>
{busy ? (
<Loader2 size={15} className="animate-spin" />
) : profile.relation === 'accepted' ? (
<Check size={15} />
) : profile.relation === 'none' ? (
<UserPlus size={15} />
) : null}
{profile.relation === 'accepted'
? t('social.following')
: profile.relation === 'pending'
? t('social.requested')
: profile.followsMe
? t('social.followBack')
: t('social.follow')}
</button>
<div className="mb-1 flex items-center gap-1">
{blocked ? (
<button onClick={doUnblock} disabled={busy} className="btn btn-ghost px-4 py-2 text-sm">
{busy ? <Loader2 size={15} className="animate-spin" /> : <UserCheck size={15} />}
{t('block.unblock')}
</button>
) : (
<button
onClick={toggleFollow}
disabled={busy}
className={cx('btn px-4 py-2 text-sm', profile.relation === 'none' ? 'btn-primary' : 'btn-ghost')}
>
{busy ? (
<Loader2 size={15} className="animate-spin" />
) : profile.relation === 'accepted' ? (
<Check size={15} />
) : profile.relation === 'none' ? (
<UserPlus size={15} />
) : null}
{profile.relation === 'accepted'
? t('social.following')
: profile.relation === 'pending'
? t('social.requested')
: profile.followsMe
? t('social.followBack')
: t('social.follow')}
</button>
)}
<ReportButton
target={{ type: 'profile', id: profile.id, userId: profile.id }}
actions={[
blocked
? { icon: <UserCheck size={18} />, label: t('block.unblock'), onClick: () => void doUnblock() }
: { icon: <Ban size={18} />, label: t('block.block'), onClick: () => setConfirmBlock(true) },
]}
/>
</div>
)}
</div>
@@ -213,6 +265,12 @@ export default function ProfileView({ username, onClose }: { username: string; o
)}
</p>
{profile.bio && <p className="mt-3 whitespace-pre-line text-sm leading-relaxed text-ink-2 lg:max-w-3xl lg:text-base">{profile.bio}</p>}
{blocked && (
<p className="mt-4 flex items-start gap-2.5 rounded-2xl border border-line px-4 py-3 text-sm text-ink-2 lg:max-w-2xl">
<Ban size={16} className="mt-0.5 shrink-0 text-accent" />
{t('block.notice')}
</p>
)}
<div className="mt-5 flex divide-x divide-line rounded-2xl border border-line py-3 lg:max-w-2xl">
<Stat value={profile.visible ? (profile.stats?.finished ?? 0) : undefined} label={t('social.seen')} />
@@ -262,6 +320,14 @@ export default function ProfileView({ username, onClose }: { username: string; o
{toast}
</p>
)}
<ConfirmDialog
open={confirmBlock}
title={t('block.confirmTitle', { name: profile?.displayName ?? '' })}
message={t('block.confirmText')}
confirmLabel={t('block.block')}
onConfirm={doBlock}
onCancel={() => setConfirmBlock(false)}
/>
<ConfirmDialog
open={confirmUnfollow}
title={profile?.relation === 'pending' ? t('social.cancelRequestTitle') : t('social.unfollowTitle', { name: profile?.displayName ?? '' })}
+10 -3
View File
@@ -1,9 +1,11 @@
import { Loader2, Star } from 'lucide-react'
import { useEffect, useState } from 'react'
import { t } from '../../i18n'
import { useBlocked } from '../../lib/cloud/moderation'
import { titleReviews, type TitleReview, type TitleReviews as TitleReviewsData } from '../../lib/cloud/reviews'
import { formatRating } from '../../lib/utils'
import { useMedia } from '../../store'
import ReportButton from '../moderation/ReportButton'
import Avatar from './Avatar'
import Reactions from './Reactions'
import Sheet from './Sheet'
@@ -12,6 +14,8 @@ import Sheet from './Sheet'
export default function TitleReviews({ externalId, title, onClose, onOpenProfile }: { externalId: string; title: string; onClose: () => void; onOpenProfile: (username: string) => void }) {
const [data, setData] = useState<TitleReviewsData>()
const [error, setError] = useState(false)
// Avis des comptes que j'ai bloqués : masqués
const { isBlocked } = useBlocked()
useEffect(() => {
let alive = true
@@ -23,7 +27,9 @@ export default function TitleReviews({ externalId, title, onClose, onOpenProfile
}
}, [externalId])
const bothEmpty = !!data && data.friends.length === 0 && data.others.length === 0
const friends = data?.friends.filter((r) => !isBlocked(r.user_id)) ?? []
const others = data?.others.filter((r) => !isBlocked(r.user_id)) ?? []
const bothEmpty = !!data && friends.length === 0 && others.length === 0
return (
<Sheet title={title} label={t('reviews.title')} onClose={onClose} elevated>
@@ -36,8 +42,8 @@ export default function TitleReviews({ externalId, title, onClose, onOpenProfile
<p className="px-4 py-16 text-center text-sm text-ink-3">{t('reviews.none')}</p>
) : (
<div className="grid grid-cols-1 gap-4 px-4 pt-4 sm:grid-cols-2">
<ReviewColumn heading={t('reviews.friends')} empty={t('reviews.noneFriends')} list={data.friends} onOpenProfile={onOpenProfile} />
<ReviewColumn heading={t('reviews.others')} empty={t('reviews.noneOthers')} list={data.others} onOpenProfile={onOpenProfile} />
<ReviewColumn heading={t('reviews.friends')} empty={t('reviews.noneFriends')} list={friends} onOpenProfile={onOpenProfile} />
<ReviewColumn heading={t('reviews.others')} empty={t('reviews.noneOthers')} list={others} onOpenProfile={onOpenProfile} />
</div>
)}
</Sheet>
@@ -77,6 +83,7 @@ function ReviewCard({ r, onOpenProfile }: { r: TitleReview; onOpenProfile: (user
{formatRating(r.rating, settings.ratingScale)}
</span>
)}
<ReportButton target={{ type: 'review', id: r.item_id, userId: r.user_id }} className="-me-1.5" size={16} />
</div>
{r.notes && <p className="mt-2 whitespace-pre-line text-sm leading-relaxed text-ink-2">{r.notes}</p>}
<div className="mt-3">