From 9016796b51344f047363f9f4165d87324fbb26f5 Mon Sep 17 00:00:00 2001 From: Triston Armstrong Date: Sat, 5 Oct 2024 13:16:25 -0400 Subject: [PATCH] focus newly added card --- src/components/CardSelector.tsx | 1 - src/signals/images.ts | 2 ++ src/signals/notes.ts | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/CardSelector.tsx b/src/components/CardSelector.tsx index b71a4b6..31213ac 100644 --- a/src/components/CardSelector.tsx +++ b/src/components/CardSelector.tsx @@ -19,7 +19,6 @@ export function CardSelector() { function StickyNote() { function _handleClick(e: MouseEvent) { - NotesSigal.default.addNote({ type: "note", title: "New Note", diff --git a/src/signals/images.ts b/src/signals/images.ts index 6a35a8d..381b2aa 100644 --- a/src/signals/images.ts +++ b/src/signals/images.ts @@ -1,5 +1,6 @@ import { signal } from "kaioken" import { Card } from "../types" +import { focusedItem } from "." export type ImageCardType = Card<"image"> @@ -16,6 +17,7 @@ function addImage(data: Omit) { } images.value[newCard.id] = newCard images.notify() + focusedItem.value = newCard.id } function removeImage(id: ImageCardType["id"]) { diff --git a/src/signals/notes.ts b/src/signals/notes.ts index e117ba3..755fb69 100644 --- a/src/signals/notes.ts +++ b/src/signals/notes.ts @@ -1,5 +1,6 @@ import { signal } from "kaioken" import { Card } from "../types" +import { focusedItem } from "." export type NoteCardType = Card<"note"> @@ -16,6 +17,7 @@ function addNote(data: Omit) { } notes.value[newCard.id] = newCard notes.notify() + focusedItem.value = newCard.id } function removeNote(id: NoteCardType["id"]) {