fix(chat): inject preview inline in chat tab + resizable note list panel
This commit is contained in:
@@ -507,6 +507,56 @@ export function ContextualAIChat({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Enrich-in-progress indicator */}
|
||||
{resourceEnriching && !isLoading && (
|
||||
<div className="flex gap-2">
|
||||
<div className="w-6 h-6 rounded-full bg-emerald-500/10 text-emerald-600 flex items-center justify-center flex-shrink-0 border border-emerald-500/20">
|
||||
<Wand2 className="h-3 w-3" />
|
||||
</div>
|
||||
<div className="bg-muted/40 border border-border/40 p-3 rounded-2xl rounded-tl-sm flex items-center gap-2">
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin text-emerald-600" />
|
||||
<span className="text-xs text-muted-foreground">{t('ai.resource.enriching') || 'Traitement IA...'}</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Inline preview from inject buttons */}
|
||||
{resourcePreview && !resourceEnriching && (
|
||||
<div className="rounded-xl border border-primary/30 bg-primary/5 overflow-hidden">
|
||||
<div className="flex items-center justify-between px-3 py-2 border-b border-primary/20">
|
||||
<span className="text-[10px] font-semibold uppercase tracking-wider text-primary">
|
||||
{resourcePreview.source === 'chat' ? (t('ai.resource.fromChat') || 'Remplacement')
|
||||
: resourcePreview.source === 'replace' ? (t('ai.resource.replacement') || 'Remplacement')
|
||||
: resourcePreview.source === 'complete' ? (t('ai.resource.completedByAI') || 'Complété par IA')
|
||||
: (t('ai.resource.mergedByAI') || 'Fusionné par IA')}
|
||||
</span>
|
||||
<button onClick={() => setResourcePreview(null)} className="text-muted-foreground hover:text-foreground">
|
||||
<X className="h-3 w-3" />
|
||||
</button>
|
||||
</div>
|
||||
<div className="px-3 py-2 max-h-48 overflow-y-auto">
|
||||
<MarkdownContent content={resourcePreview.text} />
|
||||
</div>
|
||||
<div className="flex gap-2 px-3 py-2 border-t border-primary/20">
|
||||
<button
|
||||
onClick={() => setResourcePreview(null)}
|
||||
className="flex-1 text-[11px] py-1.5 rounded-lg border border-border/60 text-muted-foreground hover:bg-muted transition-colors"
|
||||
>
|
||||
{t('common.cancel') || 'Annuler'}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => { if (onApplyToNote && resourcePreview) { onApplyToNote(resourcePreview.text); setResourcePreview(null); setResourceText(''); toast.success(t('ai.appliedToNote')) } }}
|
||||
disabled={!onApplyToNote}
|
||||
className="flex-1 text-[11px] py-1.5 rounded-lg bg-primary text-primary-foreground font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-1"
|
||||
>
|
||||
<Check className="h-3 w-3" />
|
||||
{t('ai.resource.applyToNote') || 'Appliquer'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div ref={messagesEndRef} />
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user