Plus léger et plus rapide : compression des fichiers, fiche et listes chargées à la demande
deploy / deploy (push) Successful in 42s
deploy / deploy (push) Successful in 42s
- nginx : compression gzip des fichiers de l'app (JS, CSS, JSON, SVG) ; ils partaient bruts (fichier principal 387 Ko envoyés au lieu de ~116 Ko). gzip_http_version 1.0 car le proxy en façade parle HTTP/1.0 - Fiche d'un titre, recherche d'ajout, onglets Journal et Listes, listes partagées : chargés à la demande (préchargés au repos, gardés par le service worker) - « Nouvelle liste » dans son propre fichier (n'embarque plus tout l'onglet Listes) - Fichier principal : 387 → 270 Ko (116 → 85 Ko compressés) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
8 files changed
+75
-41
No files matched your search
@@ -13,6 +13,17 @@ server {
|
|||||||
# Adresse inconnue : vraie réponse 404 avec une page dédiée
|
# Adresse inconnue : vraie réponse 404 avec une page dédiée
|
||||||
error_page 404 /404.html;
|
error_page 404 /404.html;
|
||||||
|
|
||||||
|
# Compression : sans elle, l'app partait brute (fichier principal 387 Ko au lieu de ~116 Ko, React 223 → 69 Ko).
|
||||||
|
# Réglée ici, au niveau du site (aucun doublon possible avec la config générale de nginx).
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied any;
|
||||||
|
# Le proxy HTTPS en façade parle à ce serveur en HTTP/1.0 : par défaut, nginx ne compresse alors rien
|
||||||
|
gzip_http_version 1.0;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_types text/css application/javascript text/javascript application/json application/manifest+json image/svg+xml text/plain;
|
||||||
|
|
||||||
# nginx ne connaît pas .webmanifest : sans cette ligne, le manifest du PWA est servi en octet-stream
|
# nginx ne connaît pas .webmanifest : sans cette ligne, le manifest du PWA est servi en octet-stream
|
||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
types { application/manifest+json webmanifest; }
|
types { application/manifest+json webmanifest; }
|
||||||
|
|||||||
+9
-3
@@ -3,8 +3,6 @@ import { ToastProvider } from './components/Toast'
|
|||||||
import { lazy, Suspense, useCallback, useEffect, useState } from 'react'
|
import { lazy, Suspense, useCallback, useEffect, useState } from 'react'
|
||||||
import BottomNav, { type Tab } from './components/BottomNav'
|
import BottomNav, { type Tab } from './components/BottomNav'
|
||||||
import SideNav from './components/SideNav'
|
import SideNav from './components/SideNav'
|
||||||
import AddTitle from './components/title/AddTitle'
|
|
||||||
import TitleSheet from './components/title/TitleSheet'
|
|
||||||
import HomePage from './pages/HomePage'
|
import HomePage from './pages/HomePage'
|
||||||
import CatalogPage from './pages/CatalogPage'
|
import CatalogPage from './pages/CatalogPage'
|
||||||
import SyncIndicator from './components/SyncIndicator'
|
import SyncIndicator from './components/SyncIndicator'
|
||||||
@@ -15,6 +13,9 @@ import type { Completion } from './lib/seasons'
|
|||||||
|
|
||||||
// Écrans moins fréquents : chargés à la demande (démarrage plus léger), puis préchargés quand l'app est au repos
|
// Écrans moins fréquents : chargés à la demande (démarrage plus léger), puis préchargés quand l'app est au repos
|
||||||
const loaders = {
|
const loaders = {
|
||||||
|
// Fiche d'un titre et recherche pour ajouter : les plus utilisés, préchargés dès que l'app est au repos
|
||||||
|
TitleSheet: () => import('./components/title/TitleSheet'),
|
||||||
|
AddTitle: () => import('./components/title/AddTitle'),
|
||||||
EditDetails: () => import('./components/title/EditDetails'),
|
EditDetails: () => import('./components/title/EditDetails'),
|
||||||
PersonSheet: () => import('./components/person/PersonSheet'),
|
PersonSheet: () => import('./components/person/PersonSheet'),
|
||||||
Roulette: () => import('./components/Roulette'),
|
Roulette: () => import('./components/Roulette'),
|
||||||
@@ -24,6 +25,8 @@ const loaders = {
|
|||||||
AdminPage: () => import('./pages/AdminPage'),
|
AdminPage: () => import('./pages/AdminPage'),
|
||||||
NotFoundPage: () => import('./pages/NotFoundPage'),
|
NotFoundPage: () => import('./pages/NotFoundPage'),
|
||||||
}
|
}
|
||||||
|
const TitleSheet = lazy(loaders.TitleSheet)
|
||||||
|
const AddTitle = lazy(loaders.AddTitle)
|
||||||
const EditDetails = lazy(loaders.EditDetails)
|
const EditDetails = lazy(loaders.EditDetails)
|
||||||
const PersonSheet = lazy(loaders.PersonSheet)
|
const PersonSheet = lazy(loaders.PersonSheet)
|
||||||
const Roulette = lazy(loaders.Roulette)
|
const Roulette = lazy(loaders.Roulette)
|
||||||
@@ -132,6 +135,7 @@ export default function App() {
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
||||||
{adding && (
|
{adding && (
|
||||||
|
<Suspense fallback={null}>
|
||||||
<AddTitle
|
<AddTitle
|
||||||
onClose={() => setAdding(false)}
|
onClose={() => setAdding(false)}
|
||||||
onPick={openSeed}
|
onPick={openSeed}
|
||||||
@@ -139,11 +143,12 @@ export default function App() {
|
|||||||
onOpenPerson={openPerson}
|
onOpenPerson={openPerson}
|
||||||
onManual={(title) => setManual(title)}
|
onManual={(title) => setManual(title)}
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
)}
|
)}
|
||||||
{layers.map((l) =>
|
{layers.map((l) =>
|
||||||
l.kind === 'title' ? (
|
l.kind === 'title' ? (
|
||||||
|
<Suspense key={l.uid} fallback={null}>
|
||||||
<TitleSheet
|
<TitleSheet
|
||||||
key={l.uid}
|
|
||||||
item={l.item}
|
item={l.item}
|
||||||
seed={l.seed}
|
seed={l.seed}
|
||||||
onClose={() => closeLayer(l.uid)}
|
onClose={() => closeLayer(l.uid)}
|
||||||
@@ -151,6 +156,7 @@ export default function App() {
|
|||||||
focus={l.item ? l.focus : undefined}
|
focus={l.item ? l.focus : undefined}
|
||||||
onDone={backHome}
|
onDone={backHome}
|
||||||
/>
|
/>
|
||||||
|
</Suspense>
|
||||||
) : (
|
) : (
|
||||||
<Suspense key={l.uid} fallback={null}>
|
<Suspense key={l.uid} fallback={null}>
|
||||||
<PersonSheet
|
<PersonSheet
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import ConfirmDialog from './ConfirmDialog'
|
|||||||
import { MediaCard } from './MediaCard'
|
import { MediaCard } from './MediaCard'
|
||||||
import Poster from './Poster'
|
import Poster from './Poster'
|
||||||
import { EmptyState } from './ui'
|
import { EmptyState } from './ui'
|
||||||
|
import { NewListForm } from './NewListForm'
|
||||||
import { useLibraryActions } from './library/useLibraryActions'
|
import { useLibraryActions } from './library/useLibraryActions'
|
||||||
import { SharedListsSection } from './social/SharedLists'
|
import { SharedListsSection } from './social/SharedLists'
|
||||||
|
|
||||||
@@ -28,38 +29,6 @@ function Mosaic({ items }: { items: MediaItem[] }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function NewListForm({ onCreated, autoFocus }: { onCreated?: (list: CustomList) => void; autoFocus?: boolean }) {
|
|
||||||
const { createList } = useMedia()
|
|
||||||
const [name, setName] = useState('')
|
|
||||||
// Pas de <form> ici : ce champ peut vivre à l'intérieur du formulaire d'une fiche
|
|
||||||
const submit = () => {
|
|
||||||
if (!name.trim()) return
|
|
||||||
onCreated?.(createList(name))
|
|
||||||
setName('')
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<div className="flex gap-2">
|
|
||||||
<input
|
|
||||||
className="field"
|
|
||||||
value={name}
|
|
||||||
onChange={(e) => setName(e.target.value)}
|
|
||||||
onKeyDown={(e) => {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
e.preventDefault()
|
|
||||||
submit()
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
placeholder={t('lists.newListPh')}
|
|
||||||
autoFocus={autoFocus}
|
|
||||||
enterKeyHint="done"
|
|
||||||
/>
|
|
||||||
<button type="button" onClick={submit} disabled={!name.trim()} className="btn btn-light shrink-0 px-4 text-sm">
|
|
||||||
{t('lists.create')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function ListDetail({ list, onBack, onOpen }: { list: CustomList; onBack: () => void; onOpen: (item: MediaItem) => void }) {
|
function ListDetail({ list, onBack, onOpen }: { list: CustomList; onBack: () => void; onOpen: (item: MediaItem) => void }) {
|
||||||
const { items, renameList, deleteList, toggleInList } = useMedia()
|
const { items, renameList, deleteList, toggleInList } = useMedia()
|
||||||
const actions = useLibraryActions()
|
const actions = useLibraryActions()
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { useState } from 'react'
|
||||||
|
import { t } from '../i18n'
|
||||||
|
import { useMedia } from '../store'
|
||||||
|
import type { CustomList } from '../types'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Champ « Nouvelle liste » (onglet Listes, fiche d'un titre, sélection multiple).
|
||||||
|
* Dans son propre fichier : l'importer n'embarque pas tout l'onglet Listes (chargé à la demande).
|
||||||
|
*/
|
||||||
|
export function NewListForm({ onCreated, autoFocus }: { onCreated?: (list: CustomList) => void; autoFocus?: boolean }) {
|
||||||
|
const { createList } = useMedia()
|
||||||
|
const [name, setName] = useState('')
|
||||||
|
// Pas de <form> ici : ce champ peut vivre à l'intérieur du formulaire d'une fiche
|
||||||
|
const submit = () => {
|
||||||
|
if (!name.trim()) return
|
||||||
|
onCreated?.(createList(name))
|
||||||
|
setName('')
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<input
|
||||||
|
className="field"
|
||||||
|
value={name}
|
||||||
|
onChange={(e) => setName(e.target.value)}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault()
|
||||||
|
submit()
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
placeholder={t('lists.newListPh')}
|
||||||
|
autoFocus={autoFocus}
|
||||||
|
enterKeyHint="done"
|
||||||
|
/>
|
||||||
|
<button type="button" onClick={submit} disabled={!name.trim()} className="btn btn-light shrink-0 px-4 text-sm">
|
||||||
|
{t('lists.create')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import { GuestError, useMedia } from '../../store'
|
|||||||
import type { MediaItem, WatchStatus } from '../../types'
|
import type { MediaItem, WatchStatus } from '../../types'
|
||||||
import { StatusDot } from '../Badges'
|
import { StatusDot } from '../Badges'
|
||||||
import ConfirmDialog from '../ConfirmDialog'
|
import ConfirmDialog from '../ConfirmDialog'
|
||||||
import { NewListForm } from '../ListsView'
|
import { NewListForm } from '../NewListForm'
|
||||||
import { useToast } from '../Toast'
|
import { useToast } from '../Toast'
|
||||||
import { useLibraryActions } from './useLibraryActions'
|
import { useLibraryActions } from './useLibraryActions'
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import type { MediaItem } from '../../types'
|
|||||||
import type { PeekOwner } from './ItemPeek'
|
import type { PeekOwner } from './ItemPeek'
|
||||||
import { useOnResume } from '../../lib/onResume'
|
import { useOnResume } from '../../lib/onResume'
|
||||||
import WelcomeProfile, { RANDOM_USERNAME } from './WelcomeProfile'
|
import WelcomeProfile, { RANDOM_USERNAME } from './WelcomeProfile'
|
||||||
import { InvitePeople, SharedListSheet } from './SharedLists'
|
|
||||||
import { getAniListById, type SearchResult } from '../../lib/catalogApi'
|
import { getAniListById, type SearchResult } from '../../lib/catalogApi'
|
||||||
import { TYPE_BY_VALUE } from '../../lib/constants'
|
import { TYPE_BY_VALUE } from '../../lib/constants'
|
||||||
import type { SharedListItem } from '../../lib/cloud/sharedLists'
|
import type { SharedListItem } from '../../lib/cloud/sharedLists'
|
||||||
@@ -47,6 +46,7 @@ const socialLoaders = {
|
|||||||
ProfileView: () => import('./ProfileView'),
|
ProfileView: () => import('./ProfileView'),
|
||||||
TitleReviews: () => import('./TitleReviews'),
|
TitleReviews: () => import('./TitleReviews'),
|
||||||
ItemPeek: () => import('./ItemPeek'),
|
ItemPeek: () => import('./ItemPeek'),
|
||||||
|
SharedLists: () => import('./SharedLists'),
|
||||||
}
|
}
|
||||||
const NotificationsSheet = lazy(socialLoaders.NotificationsSheet)
|
const NotificationsSheet = lazy(socialLoaders.NotificationsSheet)
|
||||||
const EditProfile = lazy(socialLoaders.EditProfile)
|
const EditProfile = lazy(socialLoaders.EditProfile)
|
||||||
@@ -55,6 +55,8 @@ const PeopleSearch = lazy(socialLoaders.PeopleSearch)
|
|||||||
const ProfileView = lazy(socialLoaders.ProfileView)
|
const ProfileView = lazy(socialLoaders.ProfileView)
|
||||||
const TitleReviews = lazy(socialLoaders.TitleReviews)
|
const TitleReviews = lazy(socialLoaders.TitleReviews)
|
||||||
const ItemPeek = lazy(socialLoaders.ItemPeek)
|
const ItemPeek = lazy(socialLoaders.ItemPeek)
|
||||||
|
const SharedListSheet = lazy(() => socialLoaders.SharedLists().then((m) => ({ default: m.SharedListSheet })))
|
||||||
|
const InvitePeople = lazy(() => socialLoaders.SharedLists().then((m) => ({ default: m.InvitePeople })))
|
||||||
export function preloadSocial() {
|
export function preloadSocial() {
|
||||||
for (const load of Object.values(socialLoaders)) void load().catch(() => {})
|
for (const load of Object.values(socialLoaders)) void load().catch(() => {})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import type { MediaInput, MediaItem, WatchStatus } from '../../types'
|
|||||||
import ConfirmDialog from '../ConfirmDialog'
|
import ConfirmDialog from '../ConfirmDialog'
|
||||||
import EpisodeList from '../EpisodeList'
|
import EpisodeList from '../EpisodeList'
|
||||||
import { useSocial } from '../social/SocialProvider'
|
import { useSocial } from '../social/SocialProvider'
|
||||||
import { NewListForm } from '../ListsView'
|
import { NewListForm } from '../NewListForm'
|
||||||
import Poster from '../Poster'
|
import Poster from '../Poster'
|
||||||
import { RatingInput } from '../Rating'
|
import { RatingInput } from '../Rating'
|
||||||
import SharePreview from '../SharePreview'
|
import SharePreview from '../SharePreview'
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import { genreLabel, subtypeLabel } from '../lib/genres'
|
import { genreLabel, subtypeLabel } from '../lib/genres'
|
||||||
import { locale, t } from '../i18n'
|
import { locale, t } from '../i18n'
|
||||||
import { CheckSquare, Hash, Heart, Search, SlidersHorizontal, X } from 'lucide-react'
|
import { CheckSquare, Hash, Heart, Search, SlidersHorizontal, X } from 'lucide-react'
|
||||||
import { useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
|
import { lazy, Suspense, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { StatusDot } from '../components/Badges'
|
import { StatusDot } from '../components/Badges'
|
||||||
import JournalView from '../components/JournalView'
|
|
||||||
import ListsView from '../components/ListsView'
|
|
||||||
import { MediaCard } from '../components/MediaCard'
|
import { MediaCard } from '../components/MediaCard'
|
||||||
import { EmptyState, PageHeader } from '../components/ui'
|
import { EmptyState, PageHeader } from '../components/ui'
|
||||||
import { MEDIA_TYPES, STATUSES } from '../lib/constants'
|
import { MEDIA_TYPES, STATUSES } from '../lib/constants'
|
||||||
@@ -17,6 +15,10 @@ import { useBackToClose } from '../lib/backNav'
|
|||||||
import { useEscape } from '../lib/escape'
|
import { useEscape } from '../lib/escape'
|
||||||
import type { MediaItem, MediaType, WatchStatus } from '../types'
|
import type { MediaItem, MediaType, WatchStatus } from '../types'
|
||||||
|
|
||||||
|
// Onglets « Journal » et « Listes » : chargés quand on les ouvre (gardés sur l'appareil par le service worker)
|
||||||
|
const JournalView = lazy(() => import('../components/JournalView'))
|
||||||
|
const ListsView = lazy(() => import('../components/ListsView'))
|
||||||
|
|
||||||
type SortKey = 'recent' | 'rating' | 'title' | 'watched'
|
type SortKey = 'recent' | 'rating' | 'title' | 'watched'
|
||||||
|
|
||||||
const SORTS: { value: SortKey; readonly label: string }[] = [
|
const SORTS: { value: SortKey; readonly label: string }[] = [
|
||||||
@@ -168,9 +170,13 @@ export default function CatalogPage({ onOpen, onAdd }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{view === 'journal' ? (
|
{view === 'journal' ? (
|
||||||
|
<Suspense fallback={null}>
|
||||||
<JournalView onOpen={onOpen} />
|
<JournalView onOpen={onOpen} />
|
||||||
|
</Suspense>
|
||||||
) : view === 'lists' ? (
|
) : view === 'lists' ? (
|
||||||
|
<Suspense fallback={null}>
|
||||||
<ListsView onOpen={onOpen} />
|
<ListsView onOpen={onOpen} />
|
||||||
|
</Suspense>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user