app/: the Support page reads client mails from LibreDesk (read-only)
Menu « Depuis LibreDesk » : the 50 latest conversations; choosing one fills the mail (thread newest first, no private notes, decoded subjects) and its images over 10 kB. Settings LIBREDESK_* in API/.env; check_libredesk in check.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
67a1d71c57
commit
b475da0acc
6 files changed
+148
-4
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { ActionIcon, Badge, Button, Grid, Group, Image, Paper, ScrollArea, SimpleGrid, Stack, Text, Textarea, Title, Tooltip } from "@mantine/core";
|
||||
import { ActionIcon, Badge, Button, Grid, Group, Image, Paper, ScrollArea, Select, SimpleGrid, Stack, Text, Textarea, Title, Tooltip } from "@mantine/core";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { IconChartLine, IconDownload, IconPhoto, IconSend } from "@tabler/icons-react";
|
||||
import { Carte, poster } from "../commun.jsx";
|
||||
import { appel, Carte, poster } from "../commun.jsx";
|
||||
|
||||
export const AGENTS = ["support", "analyste"];
|
||||
export const NOMS = { support: "Support", analyste: "Analyste" };
|
||||
@@ -24,6 +24,17 @@ export function Etat({ occupe }) {
|
||||
|
||||
function Saisie({ occupe }) {
|
||||
const [mail, setMail] = useState(""), [contexte, setContexte] = useState(""), [images, setImages] = useState([]);
|
||||
const [fils, setFils] = useState(null), [fil, setFil] = useState(null);
|
||||
|
||||
// LibreDesk : la liste au premier clic sur le menu ; un fil choisi remplit le mail et ses images, qu'on peut retoucher
|
||||
const listerFils = async () => fils || setFils(await appel("/api/libredesk") || []);
|
||||
async function choisirFil(uuid) {
|
||||
setFil(uuid);
|
||||
const c = uuid && await appel(`/api/libredesk/${uuid}`);
|
||||
if (!c) return;
|
||||
setMail(c.mail);
|
||||
setImages(c.images.map(im => ({ ...im, url: `data:${im.type};base64,${im.base64}` })));
|
||||
}
|
||||
|
||||
function coller(ev) {
|
||||
for (const item of ev.clipboardData.items) {
|
||||
@@ -44,6 +55,9 @@ function Saisie({ occupe }) {
|
||||
<Carte surtitre="Demande" titre="Le mail du client" action={<Button onClick={analyser} disabled={occupe}>Analyser</Button>}>
|
||||
<Grid p="lg" gutter="lg">
|
||||
<Grid.Col span={{ base: 12, md: 8 }}>
|
||||
<Select label="Depuis LibreDesk" placeholder="Choisir une conversation" searchable clearable mb="sm"
|
||||
data={(fils || []).map(c => ({ value: c.uuid, label: `#${c.reference} · ${c.contact} · ${c.sujet} (${c.statut})` }))}
|
||||
value={fil} onDropdownOpen={listerFils} onChange={choisirFil} nothingFoundMessage={fils ? "Aucune" : "Chargement…"} />
|
||||
<Textarea label="Mail du client" description="Le texte ; colle les captures ici, elles s'ajoutent en vignettes"
|
||||
placeholder="Bonjour, …" autosize minRows={6} maxRows={16} value={mail}
|
||||
onChange={e => setMail(e.currentTarget.value)} onPaste={coller} />
|
||||
|
||||
Reference in new issue
Block a user