+ {[...tags.values()].map((t) => (
+
+ setTags((m) => {
+ const newMap = new Map(m);
+ newMap.delete(t.name);
+ return newMap;
+ })
+ }
+ />
+ ))}
+
+ {
+ setTags((m) => {
+ if (m.has(val)) {
+ // Tag already exists
+ // Do nothing
+ return m;
+ }
+ const newMap = new Map(m);
+ newMap.set(val, { attachedBy: "human", name: val });
+ return newMap;
+ });
+ }}
+ />
+
+
+ );
+}
+
+export default function TagModal({
+ bookmark,
+ open,
+ setOpen,
+}: {
+ bookmark: ZBookmark;
+ open: boolean;
+ setOpen: (open: boolean) => void;
+}) {
+ const [tags, setTags] = useState(() => {
+ const m = new Map