+
+ {/* ── Toolbar ───────────────────────────────────────────────── */}
+
+
+ {/* Left group: content tools */}
+
+
+
+
+
+
+
+
+ {isMarkdown && (
+
+ )}
+
+ {note.type === 'text' && aiAssistantEnabled && (
+
+ )}
+
+ {previousContent !== null && (
+
+ )}
+
+
+ {/* Right group: meta actions + save indicator */}
+
+
+ {isSaving ? (
+ <> {t('notes.saving')}>
+ ) : isDirty ? (
+ <> {t('notes.dirtyStatus')}>
+ ) : (
+ <> {t('notes.savedStatus')}>
+ )}
+
+
+
+
+
+
+
+
+
+
+ {Object.entries(NOTE_COLORS).map(([name, cls]) => (
+
+
+
+
+
+
+
+
+
+
+ {note.isArchived
+ ? <>{t('notes.unarchive')}>
+ : <>{t('notes.archive')}>}
+
+ {onOpenHistory && (
+ onOpenHistory(note)}
+ >
+
+ {noteHistoryEnabled
+ ? (t('notes.history') || 'Historique')
+ : (t('notes.enableHistory') || "Activer l'historique")}
+
+ )}
+
+
+ {t('notes.delete')}
+
+
+
+
+
+
+ {/* ── Link input bar (inline) ───────────────────────────────────────── */}
+ {showLinkInput && (
+
+ setLinkUrl(e.target.value)}
+ onKeyDown={(e) => { if (e.key === 'Enter') handleAddLink() }}
+ autoFocus
+ />
+
+
+
+ )}
+
+ {/* ── Labels strip + AI suggestions — always visible outside scroll area ─ */}
+ {((note.labels?.length ?? 0) > 0 || filteredSuggestions.length > 0 || isAnalyzing) && (
+
+ {/* Existing labels */}
+ {(note.labels ?? []).map((label) => (
+
+ ))}
+ {/* AI-suggested tags inline with labels */}
+ setDismissedTags((p) => [...p, tag])}
+ />
+
+ )}
+
+ {/* ── Scrollable editing area ── */}
+
+ {/* Title */}
+
+ { changeTitle(e.target.value); scheduleSave() }}
+ />
+ {!title && content.trim().split(/\s+/).filter(Boolean).length >= 5 && (
+
+ )}
+
+
+ {/* Title Suggestions Dropdown / Inline list */}
+ {!title && !dismissedTitleSuggestions && titleSuggestions.length > 0 && (
+
+ { changeTitle(selectedTitle); scheduleSave() }}
+ onDismiss={() => setDismissedTitleSuggestions(true)}
+ />
+
+ )}
+
+ {/* Images */}
+ {Array.isArray(note.images) && note.images.length > 0 && (
+
+
+
+ )}
+
+ {/* Link previews */}
+ {Array.isArray(note.links) && note.links.length > 0 && (
+
+ {note.links.map((link, idx) => (
+
+ {link.imageUrl && (
+
+ )}
+
+
+
+ ))}
+
+ )}
+
+ {/* ── Text / Checklist content ───────────────────────────────────── */}
+
+ {note.type === 'text' ? (
+
+ {showMarkdownPreview && isMarkdown ? (
+
+
+
+ ) : (
+
+ ) : (
+ /* Checklist */
+
+ {checkItems.filter((ci) => !ci.checked).map((ci, index) => (
+
+
+ ))}
+
+
+
+ {t('notes.addItem') }
+
+
+ {checkItems.filter((ci) => ci.checked).length > 0 && (
+
+
+ {t('notes.completedLabel')} ({checkItems.filter((ci) => ci.checked).length})
+
+ {checkItems.filter((ci) => ci.checked).map((ci) => (
+
+ handleToggleCheckItem(ci.id)}
+ >
+
+
+ {ci.text}
+ handleRemoveCheckItem(ci.id)}>
+
+
+
+ ))}
+
+ )}
+
+ )}
+
+
+
+ {/* ── Memory Echo Connections Section ── */}
+
{
+ window.open(`/?note=${connNoteId}`, '_blank')
+ }}
+ onCompareNotes={handleCompareNotes}
+ onMergeNotes={handleMergeNotes}
+ />
+
+ {/* ── Footer ───────────────────────────────────────────────────────────── */}
+
+
+ {t('notes.modified') } {formatDistanceToNow(new Date(note.updatedAt), { addSuffix: true, locale: dateLocale })}
+ ·
+ {t('notes.created') || 'Créée'} {formatDistanceToNow(new Date(note.createdAt), { addSuffix: true, locale: dateLocale })}
+
+
+
+ {/* Fusion Modal */}
+ {fusionNotes.length > 0 && (
+ 0}
+ onClose={() => setFusionNotes([])}
+ notes={fusionNotes}
+ onConfirmFusion={handleConfirmFusion}
+ />
+ )}
+
+ {/* Comparison Modal */}
+ {comparisonNotes.length > 0 && (
+ 0}
+ onClose={() => setComparisonNotes([])}
+ notes={comparisonNotes}
+ />
+ )}
+