|
1 | | -import { A, useNavigate, useParams } from "@solidjs/router" |
2 | | -import { useGlobalSync } from "@/context/global-sync" |
3 | | -import { useLanguage } from "@/context/language" |
4 | | -import { useLayout, type LocalProject, getAvatarColors } from "@/context/layout" |
5 | | -import { useNotification } from "@/context/notification" |
6 | | -import { usePermission } from "@/context/permission" |
7 | | -import { base64Encode } from "@opencode-ai/util/encode" |
| 1 | +import type { Message, Session, TextPart, UserMessage } from "@opencode-ai/sdk/v2/client" |
8 | 2 | import { Avatar } from "@opencode-ai/ui/avatar" |
9 | 3 | import { HoverCard } from "@opencode-ai/ui/hover-card" |
10 | 4 | import { Icon } from "@opencode-ai/ui/icon" |
11 | 5 | import { IconButton } from "@opencode-ai/ui/icon-button" |
12 | 6 | import { MessageNav } from "@opencode-ai/ui/message-nav" |
13 | 7 | import { Spinner } from "@opencode-ai/ui/spinner" |
14 | 8 | import { Tooltip } from "@opencode-ai/ui/tooltip" |
| 9 | +import { base64Encode } from "@opencode-ai/util/encode" |
15 | 10 | import { getFilename } from "@opencode-ai/util/path" |
16 | | -import { type Message, type Session, type TextPart, type UserMessage } from "@opencode-ai/sdk/v2/client" |
17 | | -import { For, Match, Show, Switch, createMemo, onCleanup, type Accessor, type JSX } from "solid-js" |
| 11 | +import { A, useNavigate, useParams } from "@solidjs/router" |
| 12 | +import { type Accessor, createMemo, For, type JSX, Match, onCleanup, Show, Switch } from "solid-js" |
| 13 | +import { useGlobalSync } from "@/context/global-sync" |
| 14 | +import { useLanguage } from "@/context/language" |
| 15 | +import { getAvatarColors, type LocalProject, useLayout } from "@/context/layout" |
| 16 | +import { useNotification } from "@/context/notification" |
| 17 | +import { usePermission } from "@/context/permission" |
18 | 18 | import { agentColor } from "@/utils/agent" |
19 | | -import { hasProjectPermissions } from "./helpers" |
20 | 19 | import { sessionPermissionRequest } from "../session/composer/session-request-tree" |
| 20 | +import { hasProjectPermissions } from "./helpers" |
21 | 21 |
|
22 | 22 | const OPENCODE_PROJECT_ID = "4b0ea68d7af9a6031a7ffda7ad66e0cb83315750" |
23 | 23 |
|
@@ -231,7 +231,9 @@ export const SessionItem = (props: SessionItemProps): JSX.Element => { |
231 | 231 | const hoverEnabled = createMemo(() => (props.popover ?? true) && hoverAllowed()) |
232 | 232 | const isActive = createMemo(() => props.session.id === params.id) |
233 | 233 |
|
234 | | - const hoverPrefetch = { current: undefined as ReturnType<typeof setTimeout> | undefined } |
| 234 | + const hoverPrefetch = { |
| 235 | + current: undefined as ReturnType<typeof setTimeout> | undefined, |
| 236 | + } |
235 | 237 | const cancelHoverPrefetch = () => { |
236 | 238 | if (hoverPrefetch.current === undefined) return |
237 | 239 | clearTimeout(hoverPrefetch.current) |
@@ -300,17 +302,15 @@ export const SessionItem = (props: SessionItemProps): JSX.Element => { |
300 | 302 | setHoverSession={props.setHoverSession} |
301 | 303 | messageLabel={messageLabel} |
302 | 304 | onMessageSelect={(message) => { |
303 | | - if (!isActive()) { |
| 305 | + if (!isActive()) |
304 | 306 | layout.pendingMessage.set(`${base64Encode(props.session.directory)}/${props.session.id}`, message.id) |
305 | | - navigate(`${props.slug}/session/${props.session.id}`) |
306 | | - return |
307 | | - } |
308 | | - window.history.replaceState(null, "", `#message-${message.id}`) |
309 | | - window.dispatchEvent(new HashChangeEvent("hashchange")) |
| 307 | + |
| 308 | + navigate(`${props.slug}/session/${props.session.id}#message-${message.id}`) |
310 | 309 | }} |
311 | 310 | trigger={item} |
312 | 311 | /> |
313 | 312 | </Show> |
| 313 | + |
314 | 314 | <div |
315 | 315 | class={`absolute ${props.dense ? "top-0.5 right-0.5" : "top-1 right-1"} flex items-center gap-0.5 transition-opacity`} |
316 | 316 | classList={{ |
|
0 commit comments