Show existing tags as autocomplete suggestions π·οΈ
File: client/src/components/Task/TaskModal.jsx
Every time you type tags you retype
same ones from scratch π fr!!
Fix: collect existing tags for suggestions:
const existingTags = [...new Set(
tasks.flatMap(t => t.tags || [])
)]
const lastTag = form.tags.split(',').pop().trim()
const suggestions = lastTag.length > 0
? existingTags.filter(t =>
t.includes(lastTag) && t !== lastTag
)
: []
{suggestions.length > 0 && (
{suggestions.map(tag => (
{
const tags = form.tags.split(',')
tags[tags.length-1] = tag
setForm({...form, tags: tags.join(',') + ','})
}}
className="text-[10px] px-2 py-0.5
bg-[#2a2a2f] text-[#888] rounded-full
hover:text-purple-400 transition">
+ {tag}
))}
)}
~15 lines! No backend needed π―
Show existing tags as autocomplete suggestions π·οΈ
File: client/src/components/Task/TaskModal.jsx
Every time you type tags you retype
same ones from scratch π fr!!
Fix: collect existing tags for suggestions:
const existingTags = [...new Set(
tasks.flatMap(t => t.tags || [])
)]
const lastTag = form.tags.split(',').pop().trim()
const suggestions = lastTag.length > 0
? existingTags.filter(t =>
t.includes(lastTag) && t !== lastTag
)
: []
{suggestions.length > 0 && (
~15 lines! No backend needed π―