feat: add input for leadID and Username
ci-web / test (push) Has been cancelled

This commit is contained in:
Nuxgrid
2026-07-28 15:28:55 +02:00
parent 4b3a5720a3
commit 118ac02505
2 changed files with 45 additions and 5 deletions
+40 -3
View File
@@ -3,8 +3,11 @@ import {
Badge,
Button,
Flex,
FormControl,
FormLabel,
Heading,
HStack,
Input,
Link,
Modal,
ModalBody,
@@ -45,6 +48,10 @@ export function Demos() {
const [busy, setBusy] = useState<string | null>(null)
const [toDelete, setToDelete] = useState<Demo | null>(null)
// --- Formulaire de création ---
const [newUsername, setNewUsername] = useState('')
const [newLeadId, setNewLeadId] = useState('')
// --- Détails d'une démo (modale) ---
const [detailsFor, setDetailsFor] = useState<Demo | null>(null)
const [details, setDetails] = useState<DemoDetails | null>(null)
@@ -69,10 +76,16 @@ export function Demos() {
}, [load])
const create = async () => {
if (!newUsername.trim()) {
toast({ status: 'warning', title: 'Username requis' })
return
}
setBusy('new')
try {
await api.createDemo()
await api.createDemo(newUsername.trim(), newLeadId.trim() || undefined)
toast({ status: 'success', title: 'Démo lancée' })
setNewUsername('')
setNewLeadId('')
await load()
} catch (err) {
const msg = err instanceof ApiError ? err.message : 'Erreur'
@@ -138,9 +151,33 @@ export function Demos() {
return (
<>
<Flex mb={6} align="center">
<Heading size="md">Démos</Heading>
<Flex mb={6} align="flex-end" gap={4} wrap="wrap">
<Heading size="md" mr={4}>
Démos
</Heading>
<Spacer />
<FormControl maxW="220px">
<FormLabel fontSize="sm" mb={1}>
Username
</FormLabel>
<Input
size="sm"
placeholder="ex: acme-corp"
value={newUsername}
onChange={(e) => setNewUsername(e.target.value)}
/>
</FormControl>
<FormControl maxW="220px">
<FormLabel fontSize="sm" mb={1}>
Lead ID (optionnel)
</FormLabel>
<Input
size="sm"
placeholder="uuid du lead"
value={newLeadId}
onChange={(e) => setNewLeadId(e.target.value)}
/>
</FormControl>
<Button colorScheme="primary" isLoading={busy === 'new'} onClick={create}>
Nouvelle démo
</Button>