@@ -2,6 +2,7 @@ import { useNavigate, useParams } from "@solidjs/router"
22import { createEffect , createMemo , For , Show , type Accessor , type JSX } from "solid-js"
33import { createStore } from "solid-js/store"
44import { createSortable } from "@thisbeyond/solid-dnd"
5+ import { createMediaQuery } from "@solid-primitives/media"
56import { base64Encode } from "@opencode-ai/util/encode"
67import { getFilename } from "@opencode-ai/util/path"
78import { Button } from "@opencode-ai/ui/button"
@@ -114,7 +115,8 @@ export const SortableWorkspace = (props: {
114115 const busy = createMemo ( ( ) => props . ctx . isBusy ( props . directory ) )
115116 const wasBusy = createMemo ( ( prev ) => prev || busy ( ) , false )
116117 const loading = createMemo ( ( ) => open ( ) && ! booted ( ) && sessions ( ) . length === 0 && ! wasBusy ( ) )
117- const showNew = createMemo ( ( ) => ! loading ( ) && ( sessions ( ) . length === 0 || ( active ( ) && ! params . id ) ) )
118+ const touch = createMediaQuery ( "(hover: none)" )
119+ const showNew = createMemo ( ( ) => ! loading ( ) && ( touch ( ) || sessions ( ) . length === 0 || ( active ( ) && ! params . id ) ) )
118120 const loadMore = async ( ) => {
119121 setWorkspaceStore ( "limit" , ( limit ) => limit + 5 )
120122 await globalSync . project . loadSessions ( props . directory )
@@ -270,23 +272,25 @@ export const SortableWorkspace = (props: {
270272 </ DropdownMenu . Content >
271273 </ DropdownMenu . Portal >
272274 </ DropdownMenu >
273- < Tooltip value = { language . t ( "command.session.new" ) } placement = "top" >
274- < IconButton
275- icon = "plus-small"
276- variant = "ghost"
277- class = "size-6 rounded-md opacity-0 pointer-events-none group-hover/workspace:opacity-100 group-hover/workspace:pointer-events-auto group-focus-within/workspace:opacity-100 group-focus-within/workspace:pointer-events-auto"
278- data-action = "workspace-new-session"
279- data-workspace = { base64Encode ( props . directory ) }
280- aria-label = { language . t ( "command.session.new" ) }
281- onClick = { ( event ) => {
282- event . preventDefault ( )
283- event . stopPropagation ( )
284- props . ctx . setHoverSession ( undefined )
285- props . ctx . clearHoverProjectSoon ( )
286- navigate ( `/${ slug ( ) } /session` )
287- } }
288- />
289- </ Tooltip >
275+ < Show when = { ! touch ( ) } >
276+ < Tooltip value = { language . t ( "command.session.new" ) } placement = "top" >
277+ < IconButton
278+ icon = "plus-small"
279+ variant = "ghost"
280+ class = "size-6 rounded-md opacity-0 pointer-events-none group-hover/workspace:opacity-100 group-hover/workspace:pointer-events-auto group-focus-within/workspace:opacity-100 group-focus-within/workspace:pointer-events-auto"
281+ data-action = "workspace-new-session"
282+ data-workspace = { base64Encode ( props . directory ) }
283+ aria-label = { language . t ( "command.session.new" ) }
284+ onClick = { ( event ) => {
285+ event . preventDefault ( )
286+ event . stopPropagation ( )
287+ props . ctx . setHoverSession ( undefined )
288+ props . ctx . clearHoverProjectSoon ( )
289+ navigate ( `/${ slug ( ) } /session` )
290+ } }
291+ />
292+ </ Tooltip >
293+ </ Show >
290294 </ div >
291295 </ div >
292296 </ div >
0 commit comments