diff --git a/src/App.jsx b/src/App.jsx index 5cc8b02..ab1ed8f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -3287,9 +3287,47 @@ const restoreRemoteProject = async (id) => { if (e.key === 'Enter') { e.preventDefault(); addTag(selectedChunk.id); } }} placeholder="Add a tag and press Enter" + list="tag-suggestions" className="min-w-[10rem] flex-1 rounded-2xl border border-slate-300 bg-white px-3 py-1.5 text-sm text-slate-900 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-200" /> + {(() => { + const used = new Set((selectedChunk.tags ?? []).map((t) => t.toLowerCase())); + const allTags = Array.from( + new Set([ + ...projectIndex.flatMap((entry) => entry.tags ?? []), + ...(project?.chapters ?? []).flatMap((ch) => ch.chunks ?? []).flatMap((c) => c.tags ?? []), + ]), + ) + .filter((t) => !used.has(t.toLowerCase())) + .sort((a, b) => a.localeCompare(b)); + if (allTags.length === 0) return null; + return ( +