correcition
This commit is contained in:
1 parent
d723078d89
commit
1dde1311a3
15 files changed
+100
-55
No files matched your search
@@ -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>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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}>
|
||||
|
||||
@@ -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)), [])
|
||||
|
||||
Reference in new issue
Block a user