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
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
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>
|
|
)
|
|
}
|