Compare commits
4 Commits
codenomad/
...
codenomad/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36baac06b8 | ||
|
|
3678214e69 | ||
|
|
338e3d9d38 | ||
|
|
0c0f397db0 |
@@ -3,10 +3,15 @@ import { Component, JSX } from "solid-js"
|
|||||||
interface HintRowProps {
|
interface HintRowProps {
|
||||||
children: JSX.Element
|
children: JSX.Element
|
||||||
class?: string
|
class?: string
|
||||||
|
ariaHidden?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const HintRow: Component<HintRowProps> = (props) => {
|
const HintRow: Component<HintRowProps> = (props) => {
|
||||||
return <span class={`text-xs text-muted ${props.class || ""}`}>{props.children}</span>
|
return (
|
||||||
|
<span aria-hidden={props.ariaHidden} class={`text-xs text-muted ${props.class || ""}`}>
|
||||||
|
{props.children}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default HintRow
|
export default HintRow
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Show, type Accessor, type Component } from "solid-js"
|
import { Show, type Accessor, type Component } from "solid-js"
|
||||||
import type { SessionThread } from "../../../stores/session-state"
|
import type { SessionThread } from "../../../stores/session-state"
|
||||||
import type { Session } from "../../../types/session"
|
import type { Session } from "../../../types/session"
|
||||||
import type { KeyboardShortcut } from "../../../lib/keyboard-registry"
|
import { keyboardRegistry, type KeyboardShortcut } from "../../../lib/keyboard-registry"
|
||||||
import type { DrawerViewState } from "./types"
|
import type { DrawerViewState } from "./types"
|
||||||
|
|
||||||
import { PlusSquare, Search } from "lucide-solid"
|
import { PlusSquare, Search } from "lucide-solid"
|
||||||
@@ -13,7 +13,6 @@ import InfoOutlinedIcon from "@suid/icons-material/InfoOutlined"
|
|||||||
|
|
||||||
import SessionList from "../../session-list"
|
import SessionList from "../../session-list"
|
||||||
import KeyboardHint from "../../keyboard-hint"
|
import KeyboardHint from "../../keyboard-hint"
|
||||||
import Kbd from "../../kbd"
|
|
||||||
import WorktreeSelector from "../../worktree-selector"
|
import WorktreeSelector from "../../worktree-selector"
|
||||||
import AgentSelector from "../../agent-selector"
|
import AgentSelector from "../../agent-selector"
|
||||||
import ModelSelector from "../../model-selector"
|
import ModelSelector from "../../model-selector"
|
||||||
@@ -166,11 +165,17 @@ const SessionSidebar: Component<SessionSidebarProps> = (props) => (
|
|||||||
|
|
||||||
<ThinkingSelector instanceId={props.instanceId} currentModel={activeSession().model} />
|
<ThinkingSelector instanceId={props.instanceId} currentModel={activeSession().model} />
|
||||||
|
|
||||||
<div class="session-sidebar-selector-hints" aria-hidden="true">
|
<KeyboardHint
|
||||||
<Kbd shortcut="cmd+shift+a" />
|
class="session-sidebar-selector-hints"
|
||||||
<Kbd shortcut="cmd+shift+m" />
|
ariaHidden={true}
|
||||||
<Kbd shortcut="cmd+shift+t" />
|
shortcuts={[
|
||||||
</div>
|
keyboardRegistry.get("open-agent-selector"),
|
||||||
|
keyboardRegistry.get("focus-model"),
|
||||||
|
keyboardRegistry.get("focus-variant"),
|
||||||
|
].filter((shortcut): shortcut is KeyboardShortcut => Boolean(shortcut))}
|
||||||
|
separator=" "
|
||||||
|
showDescription={false}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Component, JSX, For } from "solid-js"
|
import { Component, JSX, For } from "solid-js"
|
||||||
|
import useMediaQuery from "@suid/material/useMediaQuery"
|
||||||
import { isMac } from "../lib/keyboard-utils"
|
import { isMac } from "../lib/keyboard-utils"
|
||||||
|
|
||||||
interface KbdProps {
|
interface KbdProps {
|
||||||
@@ -27,6 +28,9 @@ const SPECIAL_KEY_LABELS: Record<string, string> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Kbd: Component<KbdProps> = (props) => {
|
const Kbd: Component<KbdProps> = (props) => {
|
||||||
|
const desktopQuery = useMediaQuery("(min-width: 1280px)")
|
||||||
|
if (!desktopQuery()) return null
|
||||||
|
|
||||||
const parts = () => {
|
const parts = () => {
|
||||||
if (props.children) return [{ text: props.children, isModifier: false }]
|
if (props.children) return [{ text: props.children, isModifier: false }]
|
||||||
if (!props.shortcut) return []
|
if (!props.shortcut) return []
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
import { Component, For } from "solid-js"
|
import { Component, For } from "solid-js"
|
||||||
import { formatShortcut, isMac } from "../lib/keyboard-utils"
|
import useMediaQuery from "@suid/material/useMediaQuery"
|
||||||
import type { KeyboardShortcut } from "../lib/keyboard-registry"
|
import type { KeyboardShortcut } from "../lib/keyboard-registry"
|
||||||
import Kbd from "./kbd"
|
import Kbd from "./kbd"
|
||||||
import HintRow from "./hint-row"
|
import HintRow from "./hint-row"
|
||||||
|
|
||||||
const KeyboardHint: Component<{
|
const KeyboardHint: Component<{
|
||||||
shortcuts: KeyboardShortcut[]
|
shortcuts: KeyboardShortcut[]
|
||||||
separator?: string
|
separator?: string | null
|
||||||
showDescription?: boolean
|
showDescription?: boolean
|
||||||
|
class?: string
|
||||||
|
ariaHidden?: boolean
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
|
// Centralize layout gating here so call sites don't need to.
|
||||||
|
// We only show keyboard hint UI on desktop layouts.
|
||||||
|
const desktopQuery = useMediaQuery("(min-width: 1280px)")
|
||||||
|
|
||||||
function buildShortcutString(shortcut: KeyboardShortcut): string {
|
function buildShortcutString(shortcut: KeyboardShortcut): string {
|
||||||
const parts: string[] = []
|
const parts: string[] = []
|
||||||
|
|
||||||
@@ -26,12 +32,14 @@ const KeyboardHint: Component<{
|
|||||||
return parts.join("+")
|
return parts.join("+")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!desktopQuery()) return null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HintRow>
|
<HintRow class={props.class} ariaHidden={props.ariaHidden}>
|
||||||
<For each={props.shortcuts}>
|
<For each={props.shortcuts}>
|
||||||
{(shortcut, i) => (
|
{(shortcut, i) => (
|
||||||
<>
|
<>
|
||||||
{i() > 0 && <span class="mx-1">{props.separator || "•"}</span>}
|
{i() > 0 && props.separator !== null && <span class="mx-1">{props.separator ?? "•"}</span>}
|
||||||
{props.showDescription !== false && <span class="mr-1">{shortcut.description}</span>}
|
{props.showDescription !== false && <span class="mr-1">{shortcut.description}</span>}
|
||||||
<Kbd shortcut={buildShortcutString(shortcut)} />
|
<Kbd shortcut={buildShortcutString(shortcut)} />
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user