SPB Git forge

spb/uqo-chat

Public
14commits 1branches 0releases
1.4 MBsize
maindefault branch
17 days agolast push
Python 64.6% TypeScript 33.7% CSS 0.8%
1.7 KB · 33 lines tsx
Raw Blame History
1import { Download, FileText, Share2 } from 'lucide-react';2import type { ToolCallView } from '@/lib/types';3import { downloadFile, shareFile } from '@/lib/api';4import { Button } from '@/components/ui/button';56export function DocxCard({ call }: { call: ToolCallView }) {7  const p = call.payload as { title?: string; filename?: string; file_id?: string; words?: number; outline?: string[] };8  const fileId = p.file_id || call.artifacts?.[0]?.file_id;9  const filename = p.filename || 'document.docx';10  return (11    <div className="space-y-3">12      <div className="flex items-start gap-3">13        <span className="h-10 w-10 rounded-xl bg-[#e6ecfb] text-[#2b579a] inline-flex items-center justify-center shrink-0"><FileText size={20} /></span>14        <div className="min-w-0 flex-1">15          <div className="font-semibold truncate">{p.title || filename}</div>16          <div className="text-xs text-neutral-muted">{filename}{p.words ? ` · ${p.words} mots` : ''} · Word (.docx)</div>17        </div>18      </div>19      {p.outline?.length ? (20        <ol className="rounded-xl border border-neutral-line bg-white px-3 py-2 text-sm space-y-0.5">21          {p.outline.map((h, i) => <li key={i} className="truncate text-neutral-text">{h}</li>)}22        </ol>23      ) : null}24      {fileId && (25        <div className="flex gap-2 flex-wrap">26          <Button size="sm" onClick={() => downloadFile(fileId, filename)}><Download size={16} /> Télécharger</Button>27          {typeof navigator !== 'undefined' && !!navigator.share && <Button size="sm" variant="secondary" onClick={() => shareFile(fileId, filename)}><Share2 size={16} /> Partager</Button>}28        </div>29      )}30    </div>31  );32}33