fix(app): allow creating sessions on touch devices (#12765)

This commit is contained in:
Kit Langton
2026-02-09 06:55:54 -05:00
committed by GitHub
parent 93a11ddedf
commit 993ac55e39

View File

@@ -2,6 +2,7 @@ import { useNavigate, useParams } from "@solidjs/router"
import { createEffect, createMemo, For, Show, type Accessor, type JSX } from "solid-js" import { createEffect, createMemo, For, Show, type Accessor, type JSX } from "solid-js"
import { createStore } from "solid-js/store" import { createStore } from "solid-js/store"
import { createSortable } from "@thisbeyond/solid-dnd" import { createSortable } from "@thisbeyond/solid-dnd"
import { createMediaQuery } from "@solid-primitives/media"
import { base64Encode } from "@opencode-ai/util/encode" import { base64Encode } from "@opencode-ai/util/encode"
import { getFilename } from "@opencode-ai/util/path" import { getFilename } from "@opencode-ai/util/path"
import { Button } from "@opencode-ai/ui/button" import { Button } from "@opencode-ai/ui/button"
@@ -114,7 +115,8 @@ export const SortableWorkspace = (props: {
const busy = createMemo(() => props.ctx.isBusy(props.directory)) const busy = createMemo(() => props.ctx.isBusy(props.directory))
const wasBusy = createMemo((prev) => prev || busy(), false) const wasBusy = createMemo((prev) => prev || busy(), false)
const loading = createMemo(() => open() && !booted() && sessions().length === 0 && !wasBusy()) const loading = createMemo(() => open() && !booted() && sessions().length === 0 && !wasBusy())
const showNew = createMemo(() => !loading() && (sessions().length === 0 || (active() && !params.id))) const touch = createMediaQuery("(hover: none)")
const showNew = createMemo(() => !loading() && (touch() || sessions().length === 0 || (active() && !params.id)))
const loadMore = async () => { const loadMore = async () => {
setWorkspaceStore("limit", (limit) => limit + 5) setWorkspaceStore("limit", (limit) => limit + 5)
await globalSync.project.loadSessions(props.directory) await globalSync.project.loadSessions(props.directory)
@@ -270,6 +272,7 @@ export const SortableWorkspace = (props: {
</DropdownMenu.Content> </DropdownMenu.Content>
</DropdownMenu.Portal> </DropdownMenu.Portal>
</DropdownMenu> </DropdownMenu>
<Show when={!touch()}>
<Tooltip value={language.t("command.session.new")} placement="top"> <Tooltip value={language.t("command.session.new")} placement="top">
<IconButton <IconButton
icon="plus-small" icon="plus-small"
@@ -287,6 +290,7 @@ export const SortableWorkspace = (props: {
}} }}
/> />
</Tooltip> </Tooltip>
</Show>
</div> </div>
</div> </div>
</div> </div>