setStore("iconHover", true)}
+ onMouseLeave={() => setStore("iconHover", false)}
+ >
{
- if (store.iconUrl && iconHover()) {
+ if (store.iconUrl && store.iconHover) {
clearIcon()
} else {
document.getElementById("icon-upload")?.click()
@@ -166,7 +169,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
"border-radius": "6px",
"z-index": 10,
"pointer-events": "none",
- opacity: iconHover() && !store.iconUrl ? 1 : 0,
+ opacity: store.iconHover && !store.iconUrl ? 1 : 0,
display: "flex",
"align-items": "center",
"justify-content": "center",
@@ -185,7 +188,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
"border-radius": "6px",
"z-index": 10,
"pointer-events": "none",
- opacity: iconHover() && store.iconUrl ? 1 : 0,
+ opacity: store.iconHover && store.iconUrl ? 1 : 0,
display: "flex",
"align-items": "center",
"justify-content": "center",
diff --git a/packages/app/src/components/session/session-sortable-terminal-tab.tsx b/packages/app/src/components/session/session-sortable-terminal-tab.tsx
index d16379e80a..75e9b22f99 100644
--- a/packages/app/src/components/session/session-sortable-terminal-tab.tsx
+++ b/packages/app/src/components/session/session-sortable-terminal-tab.tsx
@@ -1,5 +1,6 @@
import type { JSX } from "solid-js"
-import { createSignal, Show } from "solid-js"
+import { Show } from "solid-js"
+import { createStore } from "solid-js/store"
import { createSortable } from "@thisbeyond/solid-dnd"
import { IconButton } from "@opencode-ai/ui/icon-button"
import { Tabs } from "@opencode-ai/ui/tabs"
@@ -12,11 +13,13 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
const terminal = useTerminal()
const language = useLanguage()
const sortable = createSortable(props.terminal.id)
- const [editing, setEditing] = createSignal(false)
- const [title, setTitle] = createSignal(props.terminal.title)
- const [menuOpen, setMenuOpen] = createSignal(false)
- const [menuPosition, setMenuPosition] = createSignal({ x: 0, y: 0 })
- const [blurEnabled, setBlurEnabled] = createSignal(false)
+ const [store, setStore] = createStore({
+ editing: false,
+ title: props.terminal.title,
+ menuOpen: false,
+ menuPosition: { x: 0, y: 0 },
+ blurEnabled: false,
+ })
const isDefaultTitle = () => {
const number = props.terminal.titleNumber
@@ -47,7 +50,7 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
}
const focus = () => {
- if (editing()) return
+ if (store.editing) return
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur()
@@ -71,26 +74,26 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
e.preventDefault()
}
- setBlurEnabled(false)
- setTitle(props.terminal.title)
- setEditing(true)
+ setStore("blurEnabled", false)
+ setStore("title", props.terminal.title)
+ setStore("editing", true)
setTimeout(() => {
const input = document.getElementById(`terminal-title-input-${props.terminal.id}`) as HTMLInputElement
if (!input) return
input.focus()
input.select()
- setTimeout(() => setBlurEnabled(true), 100)
+ setTimeout(() => setStore("blurEnabled", true), 100)
}, 10)
}
const save = () => {
- if (!blurEnabled()) return
+ if (!store.blurEnabled) return
- const value = title().trim()
+ const value = store.title.trim()
if (value && value !== props.terminal.title) {
terminal.update({ id: props.terminal.id, title: value })
}
- setEditing(false)
+ setStore("editing", false)
}
const keydown = (e: KeyboardEvent) => {
@@ -101,14 +104,14 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
}
if (e.key === "Escape") {
e.preventDefault()
- setEditing(false)
+ setStore("editing", false)
}
}
const menu = (e: MouseEvent) => {
e.preventDefault()
- setMenuPosition({ x: e.clientX, y: e.clientY })
- setMenuOpen(true)
+ setStore("menuPosition", { x: e.clientX, y: e.clientY })
+ setStore("menuOpen", true)
}
return (
@@ -143,17 +146,17 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
/>
}
>
-
+
{label()}
-
+
setTitle(e.currentTarget.value)}
+ value={store.title}
+ onInput={(e) => setStore("title", e.currentTarget.value)}
onBlur={save}
onKeyDown={keydown}
onMouseDown={(e) => e.stopPropagation()}
@@ -161,13 +164,13 @@ export function SortableTerminalTab(props: { terminal: LocalPTY; onClose?: () =>
/>
-
+ setStore("menuOpen", open)}>
diff --git a/packages/app/src/components/settings-keybinds.tsx b/packages/app/src/components/settings-keybinds.tsx
index 4dc3971495..7ff3425ab2 100644
--- a/packages/app/src/components/settings-keybinds.tsx
+++ b/packages/app/src/components/settings-keybinds.tsx
@@ -1,4 +1,5 @@
-import { Component, For, Show, createMemo, createSignal, onCleanup, onMount } from "solid-js"
+import { Component, For, Show, createMemo, onCleanup, onMount } from "solid-js"
+import { createStore } from "solid-js/store"
import { Button } from "@opencode-ai/ui/button"
import { Icon } from "@opencode-ai/ui/icon"
import { IconButton } from "@opencode-ai/ui/icon-button"
@@ -111,24 +112,26 @@ export const SettingsKeybinds: Component = () => {
const language = useLanguage()
const settings = useSettings()
- const [active, setActive] = createSignal(null)
- const [filter, setFilter] = createSignal("")
+ const [store, setStore] = createStore({
+ active: null as string | null,
+ filter: "",
+ })
const stop = () => {
- if (!active()) return
- setActive(null)
+ if (!store.active) return
+ setStore("active", null)
command.keybinds(true)
}
const start = (id: string) => {
- if (active() === id) {
+ if (store.active === id) {
stop()
return
}
- if (active()) stop()
+ if (store.active) stop()
- setActive(id)
+ setStore("active", id)
command.keybinds(false)
}
@@ -203,7 +206,7 @@ export const SettingsKeybinds: Component = () => {
})
const filtered = createMemo(() => {
- const query = filter().toLowerCase().trim()
+ const query = store.filter.toLowerCase().trim()
if (!query) return grouped()
const map = list()
@@ -285,7 +288,7 @@ export const SettingsKeybinds: Component = () => {
onMount(() => {
const handle = (event: KeyboardEvent) => {
- const id = active()
+ const id = store.active
if (!id) return
event.preventDefault()
@@ -345,7 +348,7 @@ export const SettingsKeybinds: Component = () => {
})
onCleanup(() => {
- if (active()) command.keybinds(true)
+ if (store.active) command.keybinds(true)
})
return (
@@ -370,8 +373,8 @@ export const SettingsKeybinds: Component = () => {
setStore("filter", v)}
placeholder={language.t("settings.shortcuts.search.placeholder")}
spellcheck={false}
autocorrect="off"
@@ -379,8 +382,8 @@ export const SettingsKeybinds: Component = () => {
autocapitalize="off"
class="flex-1"
/>
-
- setFilter("")} />
+
+ setStore("filter", "")} />