The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Fix the tag selection
Kiran K099831c3d25d
diff --git a/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx b/apps/web/ui/modals/add-edit-link-modal/tags-section.tsxindex 25de5e388c..93e90ab08b 100644--- a/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx+++ b/apps/web/ui/modals/add-edit-link-modal/tags-section.tsx@@ -166,16 +166,11 @@ export default function TagsSection({);};+ const tagMatch = availableTags?.map(({ name }) => name).includes(inputValue);+return (<div className="border-b border-gray-200 pb-2">- <Command- ref={commandRef}- className="relative"- loop- filter={(value, search) =>- value.toLowerCase().includes(search.toLowerCase()) ? 1 : 0- }- >+ <Command ref={commandRef} className="relative" loop><div className="group rounded-md border border-gray-300 bg-white p-1 focus-within:border-gray-500 focus-within:ring-1 focus-within:ring-gray-500"><div className="absolute inset-y-0 left-0 flex items-center justify-center pl-3 text-gray-400">{creatingTag ? (@@ -222,20 +217,6 @@ export default function TagsSection({Start typing to create tag...</p>)}- <Command.Empty>- {inputValue.length > 0 && (- <button- type="button"- onClick={() => createTag(inputValue)}- className="flex w-full cursor-pointer items-center rounded-md bg-gray-100 px-4 py-2 text-sm text-gray-900 hover:text-gray-900 aria-selected:bg-gray-100 aria-selected:text-gray-900"- >- Create tag{" "}- <span className="ml-1.5 rounded-md bg-gray-200 px-2 py-0.5 text-gray-800">- {inputValue}- </span>- </button>- )}- </Command.Empty>{availableTags?.map((tag) => (<Command.Itemkey={tag.id}@@ -260,6 +241,22 @@ export default function TagsSection({)}</Command.Item>))}++ {inputValue.length > 0 && !tagMatch && (+ <Command.Item+ key="create-tag"+ value={inputValue}+ onSelect={(tag) => createTag(tag)}+ className="group flex cursor-pointer items-center justify-between rounded-md px-4 py-2 text-sm text-gray-900 hover:bg-gray-100 hover:text-gray-900 active:bg-gray-200 aria-selected:bg-gray-100 aria-selected:text-gray-900"+ >+ <div className="flex items-center">+ Create tag{" "}+ <span className="ml-1.5 rounded-md bg-gray-200 px-2 py-0.5 text-gray-800">+ {inputValue}+ </span>+ </div>+ </Command.Item>+ )}</Command.List>)}</Command>