Compare commits
25
Commits
No files matched your search
@@ -0,0 +1,79 @@
|
||||
---
|
||||
name: add-dark-mode
|
||||
description: Add dark mode with colors, shadows, and surfaces handled the way a designer would.
|
||||
---
|
||||
|
||||
# Add Dark Mode
|
||||
|
||||
Use this when the user wants to add dark mode support to an existing UI.
|
||||
|
||||
## Activation
|
||||
|
||||
### Use For
|
||||
|
||||
- adding dark mode to a page, section, component, or site
|
||||
- improving an existing dark mode treatment
|
||||
- converting a light-mode-only UI to support dark mode
|
||||
|
||||
### Do Not Use For
|
||||
|
||||
- brand-new design or layout work
|
||||
- standalone image dark-mode conversion
|
||||
- responsive behavior, component organization, or general visual polish without dark mode
|
||||
|
||||
## Load First
|
||||
|
||||
- No companion files are required.
|
||||
- Dark-mode design guidance is inline below.
|
||||
|
||||
## Progress Updates
|
||||
|
||||
Keep the user informed so longer runs do not look stuck.
|
||||
|
||||
- One-line status update before each major phase.
|
||||
- Concrete and lightweight: what you are doing now, not verbose logs.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Inspect the existing UI and project Tailwind conventions.
|
||||
2. Convert markup to include appropriate dark-mode classes.
|
||||
3. Audit rasterized images for dark-mode variants.
|
||||
4. For each rasterized image that needs a dark-mode variant, hand off to `dark-mode-image`, which MUST load and use the `imagegen` skill before creating or editing image assets.
|
||||
5. Save generated dark-mode images alongside the originals and wire them into the dark-mode UI.
|
||||
|
||||
## Dark Mode Rules
|
||||
|
||||
### Design Rules
|
||||
|
||||
- Dark mode is about maintaining the same contrast ratios as light mode, not simply inverting colors
|
||||
- Dark mode doesn't need to preserve every detail of the light mode design — it just needs to look good
|
||||
- Default dark mode to follow the operating system's `prefers-color-scheme` setting (Tailwind's built-in `dark:` behavior); only add a manual toggle when the user explicitly asks for one
|
||||
- Remove all shadows in dark mode — use `dark:shadow-none`
|
||||
- On dark-mode-only sites, add the `scheme-only-dark` class to `<html>` or the top-level element — ensures native elements like scrollbars, form controls, and `color-scheme` render in dark mode
|
||||
|
||||
### Component Rules
|
||||
|
||||
- Never keep large branded/colored panels in dark mode; instead use the same background color and add a light divider between sections
|
||||
- Style cards only slightly lighter than the page background (e.g. `dark:bg-gray-900` on a `dark:bg-gray-950` page); add a `dark:inset-ring dark:inset-ring-white/5` for definition
|
||||
- Make decorative quote marks in testimonials very faint (e.g. `dark:text-white/5`)
|
||||
- Never use multiple heading text colors in dark mode (e.g. dark gray + brand color); use a single light color like `white` or `gray-100` for all heading text
|
||||
|
||||
### Raster Image Rules
|
||||
|
||||
- When adding or improving dark mode, audit the page for rasterized images that need dark-mode versions: photos, screenshots, product mockups, decorative backgrounds, textures, and rasterized illustrations
|
||||
- Never use CSS filters (`invert`, `brightness`, `contrast`, `opacity`) as the final dark-mode treatment for raster images; always create real dark-mode image files
|
||||
- Generate dark-mode raster image variants with the `dark-mode-image` skill, which MUST load and use the `imagegen` skill before creating or editing any raster image assets
|
||||
|
||||
### SVG Rules
|
||||
|
||||
- For inline `<svg>` elements, style dark mode with Tailwind `dark:*` classes (e.g. `dark:fill-*`, `dark:stroke-*`, `dark:text-*`)
|
||||
- For external SVG files referenced via `<img>`, always create a dark-mode version alongside the original (e.g. `logo.svg` and `logo-dark.svg`); never substitute CSS filters (`invert`, `brightness`) or opacity adjustments for a true dark variant
|
||||
|
||||
## Guardrails
|
||||
|
||||
- Do not generate, edit, or replace raster image assets directly from this skill; `dark-mode-image` owns that work and MUST use the `imagegen` skill.
|
||||
- Require the `dark-mode-image` + `imagegen` handoff even when the image change seems simple, decorative, or incidental.
|
||||
|
||||
## Verify
|
||||
|
||||
- Check light and dark modes for contrast, missing variants, and images that still assume a light background.
|
||||
@@ -4,6 +4,8 @@ import type {
|
||||
SidebarThreadSortOrder,
|
||||
} from "@t3tools/contracts";
|
||||
import type { MenuAction } from "@react-native-menu/menu";
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
import { AsyncResult } from "effect/unstable/reactivity";
|
||||
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
|
||||
import { useCallback, useMemo, useRef } from "react";
|
||||
import { Platform, Pressable, Text as RNText, TextInput, View } from "react-native";
|
||||
@@ -14,6 +16,7 @@ import { ControlPillMenu } from "../../components/ControlPill";
|
||||
import { SymbolView } from "../../components/AppSymbol";
|
||||
import { T3Wordmark } from "../../components/T3Wordmark";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { mobilePreferencesAtom } from "../../state/preferences";
|
||||
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
|
||||
import { withNativeGlassHeaderItem } from "../layout/native-glass-header-items";
|
||||
import { createNativeMailSearchToolbarItem } from "../layout/native-mail-search-toolbar";
|
||||
@@ -21,6 +24,7 @@ import type { HomeProjectSortOrder } from "./homeThreadList";
|
||||
import {
|
||||
buildHomeListFilterMenu,
|
||||
type HomeListFilterMenuEnvironment,
|
||||
type HomeListFilterMenuProject,
|
||||
} from "./home-list-filter-menu";
|
||||
import {
|
||||
hasCustomHomeListOptions,
|
||||
@@ -33,13 +37,16 @@ export type HomeHeaderEnvironment = HomeListFilterMenuEnvironment;
|
||||
|
||||
export function HomeHeader(props: {
|
||||
readonly environments: ReadonlyArray<HomeHeaderEnvironment>;
|
||||
readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
|
||||
readonly searchQuery: string;
|
||||
readonly selectedEnvironmentId: EnvironmentId | null;
|
||||
readonly selectedProjectKey: string | null;
|
||||
readonly projectSortOrder: HomeProjectSortOrder;
|
||||
readonly threadSortOrder: SidebarThreadSortOrder;
|
||||
readonly projectGroupingMode: SidebarProjectGroupingMode;
|
||||
readonly onSearchQueryChange: (query: string) => void;
|
||||
readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
|
||||
readonly onProjectChange: (projectKey: string | null) => void;
|
||||
readonly onProjectSortOrderChange: (sortOrder: HomeProjectSortOrder) => void;
|
||||
readonly onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;
|
||||
readonly onProjectGroupingModeChange: (mode: SidebarProjectGroupingMode) => void;
|
||||
@@ -59,11 +66,24 @@ function checkedMenuState(checked: boolean) {
|
||||
return checked ? ("on" as const) : undefined;
|
||||
}
|
||||
|
||||
/** Thread List v2 lays the list out in fixed creation order, so the
|
||||
sort/group filter controls would be silently ignored — hide them and
|
||||
key the "customized" icon state off the environment filter alone. */
|
||||
function useThreadListV2FilterGate() {
|
||||
const preferencesResult = useAtomValue(mobilePreferencesAtom);
|
||||
return (
|
||||
AsyncResult.isSuccess(preferencesResult) && preferencesResult.value.threadListV2Enabled === true
|
||||
);
|
||||
}
|
||||
|
||||
function AndroidHomeHeader(props: HomeHeaderProps) {
|
||||
const insets = useSafeAreaInsets();
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const mutedColor = useThemeColor("--color-foreground-muted");
|
||||
const hasCustomListOptions = hasCustomHomeListOptions(props);
|
||||
const threadListV2Enabled = useThreadListV2FilterGate();
|
||||
const hasCustomListOptions = threadListV2Enabled
|
||||
? props.selectedEnvironmentId !== null || props.selectedProjectKey !== null
|
||||
: hasCustomHomeListOptions(props);
|
||||
const menuActions = useMemo<MenuAction[]>(
|
||||
() => [
|
||||
{
|
||||
@@ -82,40 +102,67 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "project-sort",
|
||||
title: "Sort projects",
|
||||
subactions: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
id: `project-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: checkedMenuState(props.projectSortOrder === option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "thread-sort",
|
||||
title: "Sort threads",
|
||||
subactions: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
id: `thread-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: checkedMenuState(props.threadSortOrder === option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "project-grouping",
|
||||
title: "Group projects",
|
||||
subactions: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
id: `project-grouping:${option.value}`,
|
||||
title: option.label,
|
||||
state: checkedMenuState(props.projectGroupingMode === option.value),
|
||||
})),
|
||||
},
|
||||
...(props.projects.length === 0
|
||||
? []
|
||||
: ([
|
||||
{
|
||||
id: "project",
|
||||
title: "Project",
|
||||
subactions: [
|
||||
{
|
||||
id: "project:all",
|
||||
title: "All projects",
|
||||
state: checkedMenuState(props.selectedProjectKey === null),
|
||||
},
|
||||
...props.projects.map((project) => ({
|
||||
id: `project:${project.key}`,
|
||||
title: project.label,
|
||||
state: checkedMenuState(props.selectedProjectKey === project.key),
|
||||
})),
|
||||
],
|
||||
},
|
||||
] satisfies MenuAction[])),
|
||||
...(threadListV2Enabled
|
||||
? []
|
||||
: ([
|
||||
{
|
||||
id: "project-sort",
|
||||
title: "Sort projects",
|
||||
subactions: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
id: `project-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: checkedMenuState(props.projectSortOrder === option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "thread-sort",
|
||||
title: "Sort threads",
|
||||
subactions: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
id: `thread-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: checkedMenuState(props.threadSortOrder === option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "project-grouping",
|
||||
title: "Group projects",
|
||||
subactions: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
id: `project-grouping:${option.value}`,
|
||||
title: option.label,
|
||||
state: checkedMenuState(props.projectGroupingMode === option.value),
|
||||
})),
|
||||
},
|
||||
] satisfies MenuAction[])),
|
||||
],
|
||||
[
|
||||
props.environments,
|
||||
props.projectGroupingMode,
|
||||
props.projectSortOrder,
|
||||
props.projects,
|
||||
props.selectedEnvironmentId,
|
||||
props.selectedProjectKey,
|
||||
props.threadSortOrder,
|
||||
threadListV2Enabled,
|
||||
],
|
||||
);
|
||||
const handleMenuAction = useCallback(
|
||||
@@ -137,6 +184,19 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (id === "project:all") {
|
||||
props.onProjectChange(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id.startsWith("project:")) {
|
||||
const projectKey = id.slice("project:".length);
|
||||
if (props.projects.some((project) => project.key === projectKey)) {
|
||||
props.onProjectChange(projectKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const projectSort = PROJECT_SORT_OPTIONS.find(
|
||||
(option) => id === `project-sort:${option.value}`,
|
||||
);
|
||||
@@ -255,17 +315,24 @@ function AndroidHomeHeader(props: HomeHeaderProps) {
|
||||
function IosHomeHeader(props: HomeHeaderProps) {
|
||||
const searchBarRef = useRef<SearchBarCommands>(null);
|
||||
const iconColor = useThemeColor("--color-icon");
|
||||
const hasCustomListOptions = hasCustomHomeListOptions(props);
|
||||
const threadListV2Enabled = useThreadListV2FilterGate();
|
||||
const hasCustomListOptions = threadListV2Enabled
|
||||
? props.selectedEnvironmentId !== null || props.selectedProjectKey !== null
|
||||
: hasCustomHomeListOptions(props);
|
||||
const focusSearch = useCallback(() => {
|
||||
searchBarRef.current?.focus();
|
||||
return searchBarRef.current !== null;
|
||||
}, []);
|
||||
useHardwareKeyboardCommand("focusSearch", focusSearch);
|
||||
const filterMenu = buildHomeListFilterMenu(props);
|
||||
const filterMenu = buildHomeListFilterMenu({
|
||||
...props,
|
||||
listOrganization: !threadListV2Enabled,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<NativeStackScreenOptions
|
||||
optionsVersion={filterMenu.items}
|
||||
options={{
|
||||
// Static header config (glass, title, fonts) lives in Stack.tsx
|
||||
// (GLASS_HEADER_OPTIONS). Only dynamic values are set here.
|
||||
@@ -366,6 +433,28 @@ function IosHomeHeader(props: HomeHeaderProps) {
|
||||
))}
|
||||
</NativeHeaderToolbar.Menu>
|
||||
|
||||
{props.projects.length > 0 ? (
|
||||
<NativeHeaderToolbar.Menu title="Project">
|
||||
<NativeHeaderToolbar.Label>Project</NativeHeaderToolbar.Label>
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
isOn={props.selectedProjectKey === null}
|
||||
onPress={() => props.onProjectChange(null)}
|
||||
subtitle="Show threads from every project"
|
||||
>
|
||||
<NativeHeaderToolbar.Label>All projects</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
{props.projects.map((project) => (
|
||||
<NativeHeaderToolbar.MenuAction
|
||||
key={project.key}
|
||||
isOn={props.selectedProjectKey === project.key}
|
||||
onPress={() => props.onProjectChange(project.key)}
|
||||
>
|
||||
<NativeHeaderToolbar.Label>{project.label}</NativeHeaderToolbar.Label>
|
||||
</NativeHeaderToolbar.MenuAction>
|
||||
))}
|
||||
</NativeHeaderToolbar.Menu>
|
||||
) : null}
|
||||
|
||||
<NativeHeaderToolbar.Menu title="Sort projects">
|
||||
<NativeHeaderToolbar.Label>Sort projects</NativeHeaderToolbar.Label>
|
||||
{PROJECT_SORT_OPTIONS.map((option) => (
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import * as Arr from "effect/Array";
|
||||
import * as Order from "effect/Order";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import { useMemo, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
|
||||
import { scopedProjectKey } from "../../lib/scopedEntities";
|
||||
import { useProjects, useThreadShells } from "../../state/entities";
|
||||
import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
|
||||
import { useWorkspaceState } from "../../state/workspace";
|
||||
@@ -58,6 +59,28 @@ export function HomeRouteScreen() {
|
||||
setThreadSortOrder,
|
||||
} = useHomeListOptions(availableEnvironmentIds);
|
||||
const selectedEnvironmentId = listOptions.selectedEnvironmentId;
|
||||
const [selectedProjectKey, setSelectedProjectKey] = useState<string | null>(null);
|
||||
const projectFilterOptions = useMemo(
|
||||
() =>
|
||||
projects
|
||||
.filter(
|
||||
(project) =>
|
||||
selectedEnvironmentId === null || project.environmentId === selectedEnvironmentId,
|
||||
)
|
||||
.map((project) => ({
|
||||
key: scopedProjectKey(project.environmentId, project.id),
|
||||
label: project.title,
|
||||
})),
|
||||
[projects, selectedEnvironmentId],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (
|
||||
selectedProjectKey !== null &&
|
||||
!projectFilterOptions.some((project) => project.key === selectedProjectKey)
|
||||
) {
|
||||
setSelectedProjectKey(null);
|
||||
}
|
||||
}, [projectFilterOptions, selectedProjectKey]);
|
||||
|
||||
// In split layouts the persistent sidebar IS the thread list — Home becomes
|
||||
// an empty detail pane so selecting a thread never transitions layouts.
|
||||
@@ -90,12 +113,15 @@ export function HomeRouteScreen() {
|
||||
<NativeStackScreenOptions options={{ title: "Threads", headerTitle: "Threads" }} />
|
||||
<HomeHeader
|
||||
environments={environments}
|
||||
projects={projectFilterOptions}
|
||||
searchQuery={searchQuery}
|
||||
selectedEnvironmentId={selectedEnvironmentId}
|
||||
selectedProjectKey={selectedProjectKey}
|
||||
projectSortOrder={listOptions.projectSortOrder}
|
||||
threadSortOrder={listOptions.threadSortOrder}
|
||||
projectGroupingMode={listOptions.projectGroupingMode}
|
||||
onEnvironmentChange={setSelectedEnvironmentId}
|
||||
onProjectChange={setSelectedProjectKey}
|
||||
onOpenSettings={() => navigation.navigate("SettingsSheet", { screen: "Settings" })}
|
||||
onProjectGroupingModeChange={setProjectGroupingMode}
|
||||
onProjectSortOrderChange={setProjectSortOrder}
|
||||
@@ -115,6 +141,7 @@ export function HomeRouteScreen() {
|
||||
onSettleThread={settleThread}
|
||||
onUnsettleThread={unsettleThread}
|
||||
onEnvironmentChange={setSelectedEnvironmentId}
|
||||
onProjectChange={setSelectedProjectKey}
|
||||
onOpenEnvironments={() =>
|
||||
navigation.navigate("SettingsSheet", { screen: "SettingsEnvironments" })
|
||||
}
|
||||
@@ -151,6 +178,7 @@ export function HomeRouteScreen() {
|
||||
savedConnectionsById={savedConnectionsById}
|
||||
searchQuery={searchQuery}
|
||||
selectedEnvironmentId={selectedEnvironmentId}
|
||||
selectedProjectKey={selectedProjectKey}
|
||||
threads={threads}
|
||||
threadSortOrder={listOptions.threadSortOrder}
|
||||
/>
|
||||
|
||||
@@ -38,7 +38,12 @@ import {
|
||||
ThreadListShowMoreRow,
|
||||
} from "../threads/thread-list-items";
|
||||
import { ThreadListV2Row } from "../threads/thread-list-v2-items";
|
||||
import { buildThreadListV2Items, type ThreadListV2Item } from "../threads/threadListV2";
|
||||
import {
|
||||
buildThreadListV2Items,
|
||||
THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
|
||||
THREAD_LIST_V2_SETTLED_PAGE_COUNT,
|
||||
type ThreadListV2Item,
|
||||
} from "../threads/threadListV2";
|
||||
import type { HomeListFilterMenuEnvironment } from "./home-list-filter-menu";
|
||||
import {
|
||||
buildHomeListLayout,
|
||||
@@ -65,11 +70,13 @@ interface HomeScreenProps {
|
||||
readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
|
||||
readonly searchQuery: string;
|
||||
readonly selectedEnvironmentId: EnvironmentId | null;
|
||||
readonly selectedProjectKey: string | null;
|
||||
readonly projectSortOrder: HomeProjectSortOrder;
|
||||
readonly threadSortOrder: SidebarThreadSortOrder;
|
||||
readonly projectGroupingMode: SidebarProjectGroupingMode;
|
||||
readonly onSearchQueryChange: (query: string) => void;
|
||||
readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
|
||||
readonly onProjectChange: (projectKey: string | null) => void;
|
||||
readonly onProjectSortOrderChange: (sortOrder: HomeProjectSortOrder) => void;
|
||||
readonly onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;
|
||||
readonly onProjectGroupingModeChange: (mode: SidebarProjectGroupingMode) => void;
|
||||
@@ -91,10 +98,6 @@ interface HomeScreenProps {
|
||||
/* ─── Layout constants ───────────────────────────────────────────────── */
|
||||
|
||||
const ESTIMATED_THREAD_ROW_HEIGHT = 72;
|
||||
// v2 settled-tail paging: recent history is the common lookup; the deep
|
||||
// tail stays behind an explicit Show more.
|
||||
const THREAD_LIST_V2_SETTLED_INITIAL_COUNT = 10;
|
||||
const THREAD_LIST_V2_SETTLED_PAGE_COUNT = 25;
|
||||
/**
|
||||
* Top spacing between the list and the Android custom header. The Android
|
||||
* header (AndroidHomeHeader) is rendered in-flow above this screen and
|
||||
@@ -169,80 +172,6 @@ function HomeTopContentSpacer() {
|
||||
return <View className="h-4" />;
|
||||
}
|
||||
|
||||
function ThreadListV2ProjectScope(props: {
|
||||
readonly projects: ReadonlyArray<EnvironmentProject>;
|
||||
readonly selectedKey: string | null;
|
||||
readonly onChange: (key: string | null) => void;
|
||||
}) {
|
||||
if (props.projects.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
horizontal
|
||||
contentContainerStyle={{
|
||||
gap: 8,
|
||||
paddingHorizontal: 16,
|
||||
paddingBottom: 8,
|
||||
paddingTop: Platform.OS === "ios" ? 12 : 4,
|
||||
}}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsHorizontalScrollIndicator={false}
|
||||
>
|
||||
{props.projects.length > 1 ? (
|
||||
<Pressable
|
||||
accessibilityLabel="Show all threads"
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ selected: props.selectedKey === null }}
|
||||
hitSlop={4}
|
||||
onPress={() => props.onChange(null)}
|
||||
className={cn(
|
||||
"min-h-8 items-center justify-center rounded-lg border px-3",
|
||||
props.selectedKey === null
|
||||
? "border-border bg-subtle-strong"
|
||||
: "border-black/15 dark:border-white/15",
|
||||
)}
|
||||
>
|
||||
<Text className="text-sm font-t3-medium text-foreground">All</Text>
|
||||
</Pressable>
|
||||
) : null}
|
||||
{props.projects.map((project) => {
|
||||
const key = scopedProjectKey(project.environmentId, project.id);
|
||||
const selected = props.selectedKey === key;
|
||||
return (
|
||||
<Pressable
|
||||
key={key}
|
||||
accessibilityLabel={`Show ${project.title} threads`}
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ selected }}
|
||||
hitSlop={4}
|
||||
onPress={() => props.onChange(selected ? null : key)}
|
||||
className={cn(
|
||||
"min-h-8 flex-row items-center gap-1.5 rounded-lg border py-1 pl-2 pr-3",
|
||||
selected ? "border-border bg-subtle-strong" : "border-black/15 dark:border-white/15",
|
||||
)}
|
||||
>
|
||||
<ProjectFavicon
|
||||
environmentId={project.environmentId}
|
||||
projectTitle={project.title}
|
||||
size={15}
|
||||
workspaceRoot={project.workspaceRoot}
|
||||
/>
|
||||
<Text
|
||||
className={cn(
|
||||
"max-w-36 text-sm font-t3-medium",
|
||||
selected ? "text-foreground" : "text-foreground-muted",
|
||||
)}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{project.title}
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
/* ─── Main screen ────────────────────────────────────────────────────── */
|
||||
|
||||
export function HomeScreen(props: HomeScreenProps) {
|
||||
@@ -314,12 +243,51 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
onScrollBeginDrag: handleScrollBeginDrag,
|
||||
});
|
||||
|
||||
const scopedProject = useMemo(
|
||||
() =>
|
||||
props.selectedProjectKey === null
|
||||
? null
|
||||
: (props.projects.find(
|
||||
(project) =>
|
||||
scopedProjectKey(project.environmentId, project.id) === props.selectedProjectKey &&
|
||||
(props.selectedEnvironmentId === null ||
|
||||
project.environmentId === props.selectedEnvironmentId),
|
||||
) ?? null),
|
||||
[props.projects, props.selectedEnvironmentId, props.selectedProjectKey],
|
||||
);
|
||||
const scopedProjects = useMemo(
|
||||
() => (scopedProject === null ? props.projects : [scopedProject]),
|
||||
[props.projects, scopedProject],
|
||||
);
|
||||
const scopedThreads = useMemo(
|
||||
() =>
|
||||
scopedProject === null
|
||||
? props.threads
|
||||
: props.threads.filter(
|
||||
(thread) =>
|
||||
thread.environmentId === scopedProject.environmentId &&
|
||||
thread.projectId === scopedProject.id,
|
||||
),
|
||||
[props.threads, scopedProject],
|
||||
);
|
||||
const scopedPendingTasks = useMemo(
|
||||
() =>
|
||||
scopedProject === null
|
||||
? props.pendingTasks
|
||||
: props.pendingTasks.filter(
|
||||
(pendingTask) =>
|
||||
pendingTask.message.environmentId === scopedProject.environmentId &&
|
||||
pendingTask.creation.projectId === scopedProject.id,
|
||||
),
|
||||
[props.pendingTasks, scopedProject],
|
||||
);
|
||||
|
||||
const projectGroups = useMemo(
|
||||
() =>
|
||||
buildHomeThreadGroups({
|
||||
projects: props.projects,
|
||||
threads: props.threads,
|
||||
pendingTasks: props.pendingTasks,
|
||||
projects: scopedProjects,
|
||||
threads: scopedThreads,
|
||||
pendingTasks: scopedPendingTasks,
|
||||
environmentId: props.selectedEnvironmentId,
|
||||
searchQuery: props.searchQuery,
|
||||
projectSortOrder: props.projectSortOrder,
|
||||
@@ -327,14 +295,14 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
projectGroupingMode: props.projectGroupingMode,
|
||||
}),
|
||||
[
|
||||
props.pendingTasks,
|
||||
props.projectGroupingMode,
|
||||
props.projects,
|
||||
props.projectSortOrder,
|
||||
props.searchQuery,
|
||||
props.selectedEnvironmentId,
|
||||
props.threadSortOrder,
|
||||
props.threads,
|
||||
scopedPendingTasks,
|
||||
scopedProjects,
|
||||
scopedThreads,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -365,7 +333,8 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
return map;
|
||||
}, [props.projects]);
|
||||
|
||||
const [v2ProjectScopeKey, setV2ProjectScopeKey] = useState<string | null>(null);
|
||||
const v2ProjectScopeKey = props.selectedProjectKey;
|
||||
const setV2ProjectScopeKey = props.onProjectChange;
|
||||
const v2ScopeProjects = useMemo(
|
||||
() =>
|
||||
props.selectedEnvironmentId === null
|
||||
@@ -382,12 +351,6 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
) ?? null),
|
||||
[v2ProjectScopeKey, v2ScopeProjects],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (v2ProjectScopeKey !== null && v2ScopedProject === null) {
|
||||
setV2ProjectScopeKey(null);
|
||||
}
|
||||
}, [v2ProjectScopeKey, v2ScopedProject]);
|
||||
|
||||
// Thread List v2 (beta): one flat list in creation order, no grouping.
|
||||
// Settled threads collapse into a recency tail below the card block.
|
||||
// Settled threads stay in the live shell stream (settled ≠ archived), so
|
||||
@@ -442,6 +405,10 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
const [nowMinute, setNowMinute] = useState(() => new Date().toISOString().slice(0, 16));
|
||||
useEffect(() => {
|
||||
if (!threadListV2Enabled) return;
|
||||
// Refresh immediately on enable: the mount-time value can be hours old
|
||||
// by the time the beta is switched on, which would misclassify the
|
||||
// inactivity auto-settle boundary until the first tick.
|
||||
setNowMinute(new Date().toISOString().slice(0, 16));
|
||||
const id = setInterval(() => setNowMinute(new Date().toISOString().slice(0, 16)), 60_000);
|
||||
return () => clearInterval(id);
|
||||
}, [threadListV2Enabled]);
|
||||
@@ -509,6 +476,11 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
(item.thread.session?.providerInstanceId ?? item.thread.modelSelection.instanceId),
|
||||
)?.driver ?? null
|
||||
}
|
||||
environmentLabel={
|
||||
Object.keys(props.savedConnectionsById).length > 1
|
||||
? (props.savedConnectionsById[item.thread.environmentId]?.environmentLabel ?? null)
|
||||
: null
|
||||
}
|
||||
onSelectThread={props.onSelectThread}
|
||||
onDeleteThread={handleDeleteThread}
|
||||
onArchiveThread={props.onArchiveThread}
|
||||
@@ -535,6 +507,7 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
projectCwdByKey,
|
||||
props.onArchiveThread,
|
||||
props.onSelectThread,
|
||||
props.savedConnectionsById,
|
||||
serverConfigs,
|
||||
settlementEnvironmentIds,
|
||||
],
|
||||
@@ -731,14 +704,11 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
pendingTask.creation.projectId === v2ScopedProject.id)) &&
|
||||
(v2SearchQuery.length === 0 || pendingTask.title.toLocaleLowerCase().includes(v2SearchQuery)),
|
||||
);
|
||||
// Project scoping lives in the header filter menu (no inline chip row on
|
||||
// mobile — the menu is the one filter surface).
|
||||
const v2ListHeader = (
|
||||
<>
|
||||
{listHeader}
|
||||
<ThreadListV2ProjectScope
|
||||
projects={v2ScopeProjects}
|
||||
selectedKey={v2ProjectScopeKey}
|
||||
onChange={setV2ProjectScopeKey}
|
||||
/>
|
||||
{v2PendingTasks.map((pendingTask, index) => (
|
||||
<PendingTaskListRow
|
||||
key={pendingTask.message.messageId}
|
||||
@@ -758,6 +728,11 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
const listEmpty = !hasResults ? (
|
||||
hasSearchQuery ? (
|
||||
<EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
|
||||
) : scopedProject !== null ? (
|
||||
<EmptyState
|
||||
title={`No threads in ${scopedProject.title}`}
|
||||
detail="Choose another project or create a new task."
|
||||
/>
|
||||
) : selectedEnvironmentLabel ? (
|
||||
<EmptyState
|
||||
title={`No threads in ${selectedEnvironmentLabel}`}
|
||||
@@ -792,7 +767,11 @@ export function HomeScreen(props: HomeScreenProps) {
|
||||
data={threadListV2Items}
|
||||
renderItem={renderV2Item}
|
||||
keyExtractor={v2KeyExtractor}
|
||||
extraData={{ projectByKey, serverConfigs }}
|
||||
extraData={{
|
||||
projectByKey,
|
||||
serverConfigs,
|
||||
savedConnectionsById: props.savedConnectionsById,
|
||||
}}
|
||||
ListHeaderComponent={v2ListHeader}
|
||||
ListFooterComponent={
|
||||
threadListV2Layout.hiddenSettledCount > 0 ? (
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { buildHomeListFilterMenu } from "./home-list-filter-menu";
|
||||
|
||||
describe("buildHomeListFilterMenu", () => {
|
||||
it("adds a project scope submenu that selects and clears the same scope as the chips", () => {
|
||||
const onProjectChange = vi.fn();
|
||||
const menu = buildHomeListFilterMenu({
|
||||
environments: [],
|
||||
projects: [
|
||||
{ key: "environment-1:project-1", label: "Codething" },
|
||||
{ key: "environment-1:project-2", label: "Website" },
|
||||
],
|
||||
selectedEnvironmentId: null,
|
||||
selectedProjectKey: "environment-1:project-1",
|
||||
projectSortOrder: "updated_at",
|
||||
threadSortOrder: "updated_at",
|
||||
projectGroupingMode: "repository",
|
||||
onEnvironmentChange: vi.fn(),
|
||||
onProjectChange,
|
||||
onProjectSortOrderChange: vi.fn(),
|
||||
onThreadSortOrderChange: vi.fn(),
|
||||
onProjectGroupingModeChange: vi.fn(),
|
||||
});
|
||||
|
||||
const projectMenu = menu.items.find(
|
||||
(item) => item.type === "submenu" && item.title === "Project",
|
||||
);
|
||||
expect(projectMenu).toMatchObject({
|
||||
type: "submenu",
|
||||
items: [
|
||||
{ title: "All projects", state: "off" },
|
||||
{ title: "Codething", state: "on" },
|
||||
{ title: "Website", state: "off" },
|
||||
],
|
||||
});
|
||||
if (projectMenu?.type !== "submenu") throw new Error("Expected project submenu");
|
||||
|
||||
projectMenu.items[0]?.onPress();
|
||||
projectMenu.items[2]?.onPress();
|
||||
expect(onProjectChange).toHaveBeenNthCalledWith(1, null);
|
||||
expect(onProjectChange).toHaveBeenNthCalledWith(2, "environment-1:project-2");
|
||||
});
|
||||
});
|
||||
@@ -16,6 +16,11 @@ export interface HomeListFilterMenuEnvironment {
|
||||
readonly label: string;
|
||||
}
|
||||
|
||||
export interface HomeListFilterMenuProject {
|
||||
readonly key: string;
|
||||
readonly label: string;
|
||||
}
|
||||
|
||||
type HomeListFilterMenuAction = {
|
||||
readonly type: "action";
|
||||
readonly title: string;
|
||||
@@ -37,15 +42,22 @@ export interface HomeListFilterMenu {
|
||||
|
||||
export function buildHomeListFilterMenu(props: {
|
||||
readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
|
||||
readonly projects: ReadonlyArray<HomeListFilterMenuProject>;
|
||||
readonly selectedEnvironmentId: EnvironmentId | null;
|
||||
readonly selectedProjectKey: string | null;
|
||||
readonly projectSortOrder: HomeProjectSortOrder;
|
||||
readonly threadSortOrder: SidebarThreadSortOrder;
|
||||
readonly projectGroupingMode: SidebarProjectGroupingMode;
|
||||
readonly onEnvironmentChange: (environmentId: EnvironmentId | null) => void;
|
||||
readonly onProjectChange: (projectKey: string | null) => void;
|
||||
readonly onProjectSortOrderChange: (sortOrder: HomeProjectSortOrder) => void;
|
||||
readonly onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;
|
||||
readonly onProjectGroupingModeChange: (mode: SidebarProjectGroupingMode) => void;
|
||||
readonly onOpenSettings?: () => void;
|
||||
/** False hides the sort/group submenus. Thread List v2 uses a fixed
|
||||
creation-order layout, so offering those controls while it silently
|
||||
ignores them would be a lie; the environment filter still applies. */
|
||||
readonly listOrganization?: boolean;
|
||||
}): HomeListFilterMenu {
|
||||
const items: Array<HomeListFilterMenuAction | HomeListFilterMenuSubmenu> = [];
|
||||
|
||||
@@ -57,61 +69,86 @@ export function buildHomeListFilterMenu(props: {
|
||||
});
|
||||
}
|
||||
|
||||
items.push(
|
||||
{
|
||||
items.push({
|
||||
type: "submenu",
|
||||
title: "Environment",
|
||||
items: [
|
||||
{
|
||||
type: "action",
|
||||
title: "All environments",
|
||||
subtitle: "Show threads from every environment",
|
||||
state: props.selectedEnvironmentId === null ? "on" : "off",
|
||||
onPress: () => props.onEnvironmentChange(null),
|
||||
},
|
||||
...props.environments.map((environment) => ({
|
||||
type: "action" as const,
|
||||
title: environment.label,
|
||||
state:
|
||||
props.selectedEnvironmentId === environment.environmentId
|
||||
? ("on" as const)
|
||||
: ("off" as const),
|
||||
onPress: () => props.onEnvironmentChange(environment.environmentId),
|
||||
})),
|
||||
],
|
||||
});
|
||||
|
||||
if (props.projects.length > 0) {
|
||||
items.push({
|
||||
type: "submenu",
|
||||
title: "Environment",
|
||||
title: "Project",
|
||||
items: [
|
||||
{
|
||||
type: "action",
|
||||
title: "All environments",
|
||||
subtitle: "Show threads from every environment",
|
||||
state: props.selectedEnvironmentId === null ? "on" : "off",
|
||||
onPress: () => props.onEnvironmentChange(null),
|
||||
title: "All projects",
|
||||
subtitle: "Show threads from every project",
|
||||
state: props.selectedProjectKey === null ? "on" : "off",
|
||||
onPress: () => props.onProjectChange(null),
|
||||
},
|
||||
...props.environments.map((environment) => ({
|
||||
...props.projects.map((project) => ({
|
||||
type: "action" as const,
|
||||
title: environment.label,
|
||||
state:
|
||||
props.selectedEnvironmentId === environment.environmentId
|
||||
? ("on" as const)
|
||||
: ("off" as const),
|
||||
onPress: () => props.onEnvironmentChange(environment.environmentId),
|
||||
title: project.label,
|
||||
state: props.selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
|
||||
onPress: () => props.onProjectChange(project.key),
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "submenu",
|
||||
title: "Sort projects",
|
||||
items: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
type: "action",
|
||||
title: option.label,
|
||||
state: props.projectSortOrder === option.value ? "on" : "off",
|
||||
onPress: () => props.onProjectSortOrderChange(option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
type: "submenu",
|
||||
title: "Sort threads",
|
||||
items: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
type: "action",
|
||||
title: option.label,
|
||||
state: props.threadSortOrder === option.value ? "on" : "off",
|
||||
onPress: () => props.onThreadSortOrderChange(option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
type: "submenu",
|
||||
title: "Group projects",
|
||||
items: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
type: "action",
|
||||
title: option.label,
|
||||
subtitle: option.subtitle,
|
||||
state: props.projectGroupingMode === option.value ? "on" : "off",
|
||||
onPress: () => props.onProjectGroupingModeChange(option.value),
|
||||
})),
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (props.listOrganization !== false) {
|
||||
items.push(
|
||||
{
|
||||
type: "submenu",
|
||||
title: "Sort projects",
|
||||
items: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
type: "action",
|
||||
title: option.label,
|
||||
state: props.projectSortOrder === option.value ? "on" : "off",
|
||||
onPress: () => props.onProjectSortOrderChange(option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
type: "submenu",
|
||||
title: "Sort threads",
|
||||
items: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
type: "action",
|
||||
title: option.label,
|
||||
state: props.threadSortOrder === option.value ? "on" : "off",
|
||||
onPress: () => props.onThreadSortOrderChange(option.value),
|
||||
})),
|
||||
},
|
||||
{
|
||||
type: "submenu",
|
||||
title: "Group projects",
|
||||
items: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
type: "action",
|
||||
title: option.label,
|
||||
subtitle: option.subtitle,
|
||||
state: props.projectGroupingMode === option.value ? "on" : "off",
|
||||
onPress: () => props.onProjectGroupingModeChange(option.value),
|
||||
})),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
title: "Thread list options",
|
||||
|
||||
@@ -27,5 +27,8 @@ describe("home list options", () => {
|
||||
hasCustomHomeListOptions({ ...defaults, selectedEnvironmentId: "environment-1" as never }),
|
||||
).toBe(true);
|
||||
expect(hasCustomHomeListOptions({ ...defaults, projectGroupingMode: "separate" })).toBe(true);
|
||||
expect(
|
||||
hasCustomHomeListOptions({ ...defaults, selectedProjectKey: "environment-1:project-1" }),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -93,13 +93,16 @@ export function HomeListOptionsProvider({ children }: PropsWithChildren) {
|
||||
return createElement(HomeListOptionsContext, { value }, children);
|
||||
}
|
||||
|
||||
export function hasCustomHomeListOptions(options: HomeListOptions): boolean {
|
||||
export function hasCustomHomeListOptions(
|
||||
options: HomeListOptions & { readonly selectedProjectKey?: string | null },
|
||||
): boolean {
|
||||
const defaultProjectSortOrder =
|
||||
DEFAULT_SIDEBAR_PROJECT_SORT_ORDER === "manual"
|
||||
? "updated_at"
|
||||
: DEFAULT_SIDEBAR_PROJECT_SORT_ORDER;
|
||||
return (
|
||||
options.selectedEnvironmentId !== null ||
|
||||
(options.selectedProjectKey !== null && options.selectedProjectKey !== undefined) ||
|
||||
options.projectSortOrder !== defaultProjectSortOrder ||
|
||||
options.threadSortOrder !== DEFAULT_SIDEBAR_THREAD_SORT_ORDER ||
|
||||
options.projectGroupingMode !== DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE
|
||||
|
||||
@@ -5,9 +5,12 @@ import type {
|
||||
} from "@t3tools/client-runtime/state/shell";
|
||||
import { LegendList } from "@legendapp/list/react-native";
|
||||
import type { MenuAction } from "@react-native-menu/menu";
|
||||
import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
import { AsyncResult } from "effect/unstable/reactivity";
|
||||
import type { EnvironmentId } from "@t3tools/contracts";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
|
||||
import { Platform, StyleSheet, TextInput, View, useColorScheme } from "react-native";
|
||||
import { Platform, Pressable, StyleSheet, TextInput, View, useColorScheme } from "react-native";
|
||||
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
||||
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
@@ -22,7 +25,9 @@ import { NativeStackScreenOptions } from "../../native/StackHeader";
|
||||
import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
|
||||
import { useThemeColor } from "../../lib/useThemeColor";
|
||||
import { useProjects, useThreadShells } from "../../state/entities";
|
||||
import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
|
||||
import { mobilePreferencesAtom } from "../../state/preferences";
|
||||
import { environmentServerConfigsAtom } from "../../state/server";
|
||||
import { usePendingNewTasks, type PendingNewTask } from "../../state/use-pending-new-tasks";
|
||||
import { useWorkspaceState } from "../../state/workspace";
|
||||
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
|
||||
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
|
||||
@@ -59,6 +64,27 @@ import {
|
||||
ThreadListRow,
|
||||
ThreadListShowMoreRow,
|
||||
} from "./thread-list-items";
|
||||
import { ThreadListV2Row } from "./thread-list-v2-items";
|
||||
import {
|
||||
buildThreadListV2Items,
|
||||
THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
|
||||
THREAD_LIST_V2_SETTLED_PAGE_COUNT,
|
||||
type ThreadListV2Item,
|
||||
} from "./threadListV2";
|
||||
|
||||
/** The sidebar list serves both lists: v1 grouped items or, when the Thread
|
||||
List v2 beta is on, queued offline tasks, flat v2 rows, and a settled
|
||||
"Show more" pager. */
|
||||
type SidebarListItem =
|
||||
| HomeListItem
|
||||
| {
|
||||
readonly type: "v2-pending-task";
|
||||
readonly key: string;
|
||||
readonly pendingTask: PendingNewTask;
|
||||
readonly isLast: boolean;
|
||||
}
|
||||
| { readonly type: "v2-thread"; readonly key: string; readonly item: ThreadListV2Item }
|
||||
| { readonly type: "v2-show-more"; readonly key: string; readonly hiddenCount: number };
|
||||
|
||||
/**
|
||||
* Shared capsule behind the sidebar header buttons — a native liquid-glass
|
||||
@@ -169,7 +195,12 @@ function ThreadNavigationSidebarPane(
|
||||
const openSwipeableRef = useRef<SwipeableMethods | null>(null);
|
||||
const headerIsOverContentRef = useRef(false);
|
||||
const sidebarScrollGesture = useMemo(() => Gesture.Native(), []);
|
||||
const { archiveThread, confirmDeleteThread } = useThreadListActions();
|
||||
const { archiveThread, confirmDeleteThread, settleThread, unsettleThread } =
|
||||
useThreadListActions();
|
||||
const preferencesResult = useAtomValue(mobilePreferencesAtom);
|
||||
const threadListV2Enabled =
|
||||
AsyncResult.isSuccess(preferencesResult) &&
|
||||
preferencesResult.value.threadListV2Enabled === true;
|
||||
const pendingTasks = usePendingNewTasks();
|
||||
const { openPendingTask, confirmDeletePendingTask } = usePendingTaskListActions();
|
||||
const environments = useMemo(
|
||||
@@ -193,19 +224,77 @@ function ThreadNavigationSidebarPane(
|
||||
setProjectSortOrder,
|
||||
setThreadSortOrder,
|
||||
} = useHomeListOptions(availableEnvironmentIds);
|
||||
const [selectedProjectKey, setSelectedProjectKey] = useState<string | null>(null);
|
||||
const projectFilterOptions = useMemo(
|
||||
() =>
|
||||
projects
|
||||
.filter(
|
||||
(project) =>
|
||||
options.selectedEnvironmentId === null ||
|
||||
project.environmentId === options.selectedEnvironmentId,
|
||||
)
|
||||
.map((project) => ({
|
||||
key: scopedProjectKey(project.environmentId, project.id),
|
||||
label: project.title,
|
||||
})),
|
||||
[options.selectedEnvironmentId, projects],
|
||||
);
|
||||
const selectedProject = useMemo(
|
||||
() =>
|
||||
selectedProjectKey === null
|
||||
? null
|
||||
: (projects.find(
|
||||
(project) => scopedProjectKey(project.environmentId, project.id) === selectedProjectKey,
|
||||
) ?? null),
|
||||
[projects, selectedProjectKey],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (
|
||||
selectedProjectKey !== null &&
|
||||
!projectFilterOptions.some((project) => project.key === selectedProjectKey)
|
||||
) {
|
||||
setSelectedProjectKey(null);
|
||||
}
|
||||
}, [projectFilterOptions, selectedProjectKey]);
|
||||
const scopedProjects = useMemo(
|
||||
() => (selectedProject === null ? projects : [selectedProject]),
|
||||
[projects, selectedProject],
|
||||
);
|
||||
const scopedThreads = useMemo(
|
||||
() =>
|
||||
selectedProject === null
|
||||
? threads
|
||||
: threads.filter(
|
||||
(thread) =>
|
||||
thread.environmentId === selectedProject.environmentId &&
|
||||
thread.projectId === selectedProject.id,
|
||||
),
|
||||
[selectedProject, threads],
|
||||
);
|
||||
const scopedPendingTasks = useMemo(
|
||||
() =>
|
||||
selectedProject === null
|
||||
? pendingTasks
|
||||
: pendingTasks.filter(
|
||||
(pendingTask) =>
|
||||
pendingTask.message.environmentId === selectedProject.environmentId &&
|
||||
pendingTask.creation.projectId === selectedProject.id,
|
||||
),
|
||||
[pendingTasks, selectedProject],
|
||||
);
|
||||
const groups = useMemo(
|
||||
() =>
|
||||
buildHomeThreadGroups({
|
||||
projects,
|
||||
threads,
|
||||
pendingTasks,
|
||||
projects: scopedProjects,
|
||||
threads: scopedThreads,
|
||||
pendingTasks: scopedPendingTasks,
|
||||
environmentId: options.selectedEnvironmentId,
|
||||
searchQuery: props.searchQuery,
|
||||
projectSortOrder: options.projectSortOrder,
|
||||
threadSortOrder: options.threadSortOrder,
|
||||
projectGroupingMode: options.projectGroupingMode,
|
||||
}),
|
||||
[options, pendingTasks, projects, props.searchQuery, threads],
|
||||
[options, props.searchQuery, scopedPendingTasks, scopedProjects, scopedThreads],
|
||||
);
|
||||
const [groupDisplayStates, setGroupDisplayStates] = useState<
|
||||
ReadonlyMap<string, HomeGroupDisplayState>
|
||||
@@ -237,6 +326,153 @@ function ThreadNavigationSidebarPane(
|
||||
}
|
||||
return map;
|
||||
}, [projects]);
|
||||
const projectByKey = useMemo(() => {
|
||||
const map = new Map<string, EnvironmentProject>();
|
||||
for (const project of projects) {
|
||||
map.set(scopedProjectKey(project.environmentId, project.id), project);
|
||||
}
|
||||
return map;
|
||||
}, [projects]);
|
||||
|
||||
// Thread List v2 (beta) support — same model as the compact Home list
|
||||
// (HomeScreen.tsx): flat creation-order card block + settled recency tail.
|
||||
// PR states stream in per-row; merged/closed PRs auto-settle their thread
|
||||
// on the next partition.
|
||||
const [changeRequestStateByKey, setChangeRequestStateByKey] = useState<
|
||||
ReadonlyMap<string, "open" | "closed" | "merged">
|
||||
>(() => new Map());
|
||||
const handleChangeRequestState = useCallback(
|
||||
(threadKey: string, state: "open" | "closed" | "merged" | null) => {
|
||||
setChangeRequestStateByKey((current) => {
|
||||
if ((current.get(threadKey) ?? null) === state) return current;
|
||||
const next = new Map(current);
|
||||
if (state === null) {
|
||||
next.delete(threadKey);
|
||||
} else {
|
||||
next.set(threadKey, state);
|
||||
}
|
||||
return next;
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
// The settled tail renders in pages; expansion resets when the filter
|
||||
// context changes so environment/search flips never inherit a deep page.
|
||||
const [settledVisibleCount, setSettledVisibleCount] = useState(
|
||||
THREAD_LIST_V2_SETTLED_INITIAL_COUNT,
|
||||
);
|
||||
const settledResetKey = `${options.selectedEnvironmentId ?? "all"}:${selectedProjectKey ?? "all"}:${props.searchQuery.trim()}`;
|
||||
const lastSettledResetKeyRef = useRef(settledResetKey);
|
||||
if (lastSettledResetKeyRef.current !== settledResetKey) {
|
||||
lastSettledResetKeyRef.current = settledResetKey;
|
||||
setSettledVisibleCount(THREAD_LIST_V2_SETTLED_INITIAL_COUNT);
|
||||
}
|
||||
const showMoreSettled = useCallback(
|
||||
() => setSettledVisibleCount((count) => count + THREAD_LIST_V2_SETTLED_PAGE_COUNT),
|
||||
[],
|
||||
);
|
||||
// now ticks per minute so the inactivity auto-settle boundary is actually
|
||||
// crossed while the pane stays open; without a clock dependency the
|
||||
// partition memoizes a frozen "now".
|
||||
const [nowMinute, setNowMinute] = useState(() => new Date().toISOString().slice(0, 16));
|
||||
useEffect(() => {
|
||||
if (!threadListV2Enabled) return;
|
||||
// Refresh immediately on enable: the mount-time value can be hours old
|
||||
// by the time the beta is switched on, which would misclassify the
|
||||
// inactivity auto-settle boundary until the first tick.
|
||||
setNowMinute(new Date().toISOString().slice(0, 16));
|
||||
const id = setInterval(() => setNowMinute(new Date().toISOString().slice(0, 16)), 60_000);
|
||||
return () => clearInterval(id);
|
||||
}, [threadListV2Enabled]);
|
||||
// Threads on servers without the settlement capability never classify as
|
||||
// settled (the user could neither un-settle nor pin them).
|
||||
const serverConfigs = useAtomValue(environmentServerConfigsAtom);
|
||||
const settlementEnvironmentIds = useMemo(() => {
|
||||
const supported = new Set<EnvironmentId>();
|
||||
for (const [environmentId, config] of serverConfigs) {
|
||||
if (config.environment.capabilities.threadSettlement === true) {
|
||||
supported.add(environmentId);
|
||||
}
|
||||
}
|
||||
return supported;
|
||||
}, [serverConfigs]);
|
||||
const threadListV2Layout = useMemo(() => {
|
||||
if (!threadListV2Enabled) return { items: [], hiddenSettledCount: 0 };
|
||||
return buildThreadListV2Items({
|
||||
threads: threads.filter((thread) => thread.archivedAt === null),
|
||||
environmentId: options.selectedEnvironmentId,
|
||||
projectRef:
|
||||
selectedProject === null
|
||||
? null
|
||||
: {
|
||||
environmentId: selectedProject.environmentId,
|
||||
projectId: selectedProject.id,
|
||||
},
|
||||
searchQuery: props.searchQuery,
|
||||
changeRequestStateByKey,
|
||||
settlementEnvironmentIds,
|
||||
settledLimit: settledVisibleCount,
|
||||
now: `${nowMinute}:00.000Z`,
|
||||
});
|
||||
}, [
|
||||
changeRequestStateByKey,
|
||||
nowMinute,
|
||||
options.selectedEnvironmentId,
|
||||
props.searchQuery,
|
||||
settledVisibleCount,
|
||||
settlementEnvironmentIds,
|
||||
threadListV2Enabled,
|
||||
threads,
|
||||
selectedProject,
|
||||
]);
|
||||
const listItems = useMemo<readonly SidebarListItem[]>(() => {
|
||||
if (!threadListV2Enabled) return listLayout.items;
|
||||
// Queued offline tasks render above the thread rows (mirrors the
|
||||
// compact Home v2 list): they are not thread shells, so the v2 item
|
||||
// builder never sees them, but they must stay visible and deletable
|
||||
// while their environment is offline. Same environment scope and
|
||||
// search filter as the list.
|
||||
const v2SearchQuery = props.searchQuery.trim().toLocaleLowerCase();
|
||||
const v2PendingTasks = pendingTasks.filter(
|
||||
(pendingTask) =>
|
||||
(options.selectedEnvironmentId === null ||
|
||||
pendingTask.message.environmentId === options.selectedEnvironmentId) &&
|
||||
(selectedProject === null ||
|
||||
(pendingTask.message.environmentId === selectedProject.environmentId &&
|
||||
pendingTask.creation.projectId === selectedProject.id)) &&
|
||||
(v2SearchQuery.length === 0 ||
|
||||
pendingTask.title.toLocaleLowerCase().includes(v2SearchQuery)),
|
||||
);
|
||||
const items: SidebarListItem[] = v2PendingTasks.map((pendingTask, index) => ({
|
||||
type: "v2-pending-task" as const,
|
||||
key: `v2-pending:${pendingTask.message.messageId}`,
|
||||
pendingTask,
|
||||
isLast: index === v2PendingTasks.length - 1,
|
||||
}));
|
||||
for (const item of threadListV2Layout.items) {
|
||||
items.push({
|
||||
type: "v2-thread" as const,
|
||||
key: scopedThreadKey(item.thread.environmentId, item.thread.id),
|
||||
item,
|
||||
});
|
||||
}
|
||||
if (threadListV2Layout.hiddenSettledCount > 0) {
|
||||
items.push({
|
||||
type: "v2-show-more",
|
||||
key: "v2-show-more",
|
||||
hiddenCount: threadListV2Layout.hiddenSettledCount,
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}, [
|
||||
listLayout.items,
|
||||
options.selectedEnvironmentId,
|
||||
pendingTasks,
|
||||
props.searchQuery,
|
||||
selectedProject,
|
||||
threadListV2Enabled,
|
||||
threadListV2Layout,
|
||||
]);
|
||||
const showsConnectionStatus = shouldShowWorkspaceConnectionStatus(catalogState);
|
||||
const listMenuActions = useMemo<MenuAction[]>(
|
||||
() => [
|
||||
@@ -260,36 +496,64 @@ function ThreadNavigationSidebarPane(
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "project-sort",
|
||||
title: "Sort projects",
|
||||
subactions: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
id: `project-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: options.projectSortOrder === option.value ? "on" : "off",
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "thread-sort",
|
||||
title: "Sort threads",
|
||||
subactions: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
id: `thread-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: options.threadSortOrder === option.value ? "on" : "off",
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "project-grouping",
|
||||
title: "Group projects",
|
||||
subactions: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
id: `project-grouping:${option.value}`,
|
||||
title: option.label,
|
||||
subtitle: option.subtitle,
|
||||
state: options.projectGroupingMode === option.value ? "on" : "off",
|
||||
})),
|
||||
},
|
||||
...(projectFilterOptions.length === 0
|
||||
? []
|
||||
: ([
|
||||
{
|
||||
id: "project",
|
||||
title: "Project",
|
||||
subactions: [
|
||||
{
|
||||
id: "project:all",
|
||||
title: "All projects",
|
||||
subtitle: "Show threads from every project",
|
||||
state: selectedProjectKey === null ? "on" : "off",
|
||||
},
|
||||
...projectFilterOptions.map((project) => ({
|
||||
id: `project:${project.key}`,
|
||||
title: project.label,
|
||||
state: selectedProjectKey === project.key ? ("on" as const) : ("off" as const),
|
||||
})),
|
||||
],
|
||||
},
|
||||
] satisfies MenuAction[])),
|
||||
// v2 lays the list out in fixed creation order — offering sort/group
|
||||
// controls it silently ignores would be a lie. Environment still
|
||||
// scopes the v2 partition, so it stays.
|
||||
...(threadListV2Enabled
|
||||
? []
|
||||
: ([
|
||||
{
|
||||
id: "project-sort",
|
||||
title: "Sort projects",
|
||||
subactions: PROJECT_SORT_OPTIONS.map((option) => ({
|
||||
id: `project-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: options.projectSortOrder === option.value ? "on" : "off",
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "thread-sort",
|
||||
title: "Sort threads",
|
||||
subactions: THREAD_SORT_OPTIONS.map((option) => ({
|
||||
id: `thread-sort:${option.value}`,
|
||||
title: option.label,
|
||||
state: options.threadSortOrder === option.value ? "on" : "off",
|
||||
})),
|
||||
},
|
||||
{
|
||||
id: "project-grouping",
|
||||
title: "Group projects",
|
||||
subactions: PROJECT_GROUPING_OPTIONS.map((option) => ({
|
||||
id: `project-grouping:${option.value}`,
|
||||
title: option.label,
|
||||
subtitle: option.subtitle,
|
||||
state: options.projectGroupingMode === option.value ? "on" : "off",
|
||||
})),
|
||||
},
|
||||
] satisfies MenuAction[])),
|
||||
],
|
||||
[environments, options],
|
||||
[environments, options, projectFilterOptions, selectedProjectKey, threadListV2Enabled],
|
||||
);
|
||||
const handleListMenuAction = useCallback(
|
||||
({ nativeEvent }: { readonly nativeEvent: { readonly event: string } }) => {
|
||||
@@ -305,6 +569,17 @@ function ThreadNavigationSidebarPane(
|
||||
if (environment) setSelectedEnvironmentId(environment.environmentId);
|
||||
return;
|
||||
}
|
||||
if (event === "project:all") {
|
||||
setSelectedProjectKey(null);
|
||||
return;
|
||||
}
|
||||
if (event.startsWith("project:")) {
|
||||
const projectKey = event.slice("project:".length);
|
||||
if (projectFilterOptions.some((project) => project.key === projectKey)) {
|
||||
setSelectedProjectKey(projectKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const projectSort = PROJECT_SORT_OPTIONS.find(
|
||||
(option) => `project-sort:${option.value}` === event,
|
||||
);
|
||||
@@ -326,6 +601,7 @@ function ThreadNavigationSidebarPane(
|
||||
},
|
||||
[
|
||||
environments,
|
||||
projectFilterOptions,
|
||||
setProjectGroupingMode,
|
||||
setProjectSortOrder,
|
||||
setSelectedEnvironmentId,
|
||||
@@ -382,7 +658,44 @@ function ThreadNavigationSidebarPane(
|
||||
onScroll: handleScroll,
|
||||
onScrollBeginDrag: handleScrollBeginDrag,
|
||||
});
|
||||
const listExtraData = props.selectedThreadKey ?? "";
|
||||
const listExtraData = useMemo(
|
||||
() => ({
|
||||
selectedThreadKey: props.selectedThreadKey ?? "",
|
||||
savedConnectionsById,
|
||||
serverConfigs,
|
||||
}),
|
||||
[props.selectedThreadKey, savedConnectionsById, serverConfigs],
|
||||
);
|
||||
const sidebarItemsAreEqual = useCallback(
|
||||
(previous: SidebarListItem, item: SidebarListItem): boolean => {
|
||||
if (previous.type === "v2-thread" && item.type === "v2-thread") {
|
||||
return (
|
||||
previous.key === item.key &&
|
||||
previous.item.thread === item.item.thread &&
|
||||
previous.item.variant === item.item.variant &&
|
||||
previous.item.showSettledDivider === item.item.showSettledDivider
|
||||
);
|
||||
}
|
||||
if (previous.type === "v2-show-more" && item.type === "v2-show-more") {
|
||||
return previous.hiddenCount === item.hiddenCount;
|
||||
}
|
||||
if (previous.type === "v2-pending-task" && item.type === "v2-pending-task") {
|
||||
return previous.pendingTask === item.pendingTask && previous.isLast === item.isLast;
|
||||
}
|
||||
if (
|
||||
previous.type === "v2-thread" ||
|
||||
previous.type === "v2-show-more" ||
|
||||
previous.type === "v2-pending-task" ||
|
||||
item.type === "v2-thread" ||
|
||||
item.type === "v2-show-more" ||
|
||||
item.type === "v2-pending-task"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return homeListItemsAreEqual(previous, item);
|
||||
},
|
||||
[],
|
||||
);
|
||||
const focusSearch = useCallback(() => {
|
||||
const focus = () => {
|
||||
if (props.nativeChrome) {
|
||||
@@ -401,8 +714,78 @@ function ThreadNavigationSidebarPane(
|
||||
}, [props.nativeChrome, props.onRequestVisibility, props.visible]);
|
||||
useHardwareKeyboardCommand("focusSearch", focusSearch);
|
||||
const renderListItem = useCallback(
|
||||
({ item }: { readonly item: HomeListItem }) => {
|
||||
({ item }: { readonly item: SidebarListItem }) => {
|
||||
switch (item.type) {
|
||||
case "v2-pending-task":
|
||||
return (
|
||||
<PendingTaskListRow
|
||||
variant="sidebar"
|
||||
pendingTask={item.pendingTask}
|
||||
environmentLabel={
|
||||
savedConnectionsById[item.pendingTask.message.environmentId]?.environmentLabel ??
|
||||
null
|
||||
}
|
||||
isLast={item.isLast}
|
||||
onSelectPendingTask={openPendingTask}
|
||||
onDeletePendingTask={confirmDeletePendingTask}
|
||||
/>
|
||||
);
|
||||
case "v2-thread": {
|
||||
const thread = item.item.thread;
|
||||
const scopeKey = scopedProjectKey(thread.environmentId, thread.projectId);
|
||||
return (
|
||||
<ThreadListV2Row
|
||||
thread={thread}
|
||||
variant={item.item.variant}
|
||||
showSettledDivider={item.item.showSettledDivider}
|
||||
project={projectByKey.get(scopeKey) ?? null}
|
||||
providerDriver={
|
||||
serverConfigs
|
||||
.get(thread.environmentId)
|
||||
?.providers.find(
|
||||
(provider) =>
|
||||
provider.instanceId ===
|
||||
(thread.session?.providerInstanceId ?? thread.modelSelection.instanceId),
|
||||
)?.driver ?? null
|
||||
}
|
||||
environmentLabel={
|
||||
Object.keys(savedConnectionsById).length > 1
|
||||
? (savedConnectionsById[thread.environmentId]?.environmentLabel ?? null)
|
||||
: null
|
||||
}
|
||||
pane="sidebar"
|
||||
selected={
|
||||
scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
|
||||
}
|
||||
fullSwipeWidth={props.width - 20}
|
||||
onSelectThread={handleSelectThread}
|
||||
onDeleteThread={confirmDeleteThread}
|
||||
onArchiveThread={archiveThread}
|
||||
settlementSupported={settlementEnvironmentIds.has(thread.environmentId)}
|
||||
onSettleThread={settleThread}
|
||||
onUnsettleThread={unsettleThread}
|
||||
onChangeRequestState={handleChangeRequestState}
|
||||
projectCwd={projectCwdByKey.get(scopeKey) ?? null}
|
||||
onSwipeableClose={handleSwipeableClose}
|
||||
onSwipeableWillOpen={handleSwipeableWillOpen}
|
||||
simultaneousSwipeGesture={sidebarScrollGesture}
|
||||
/>
|
||||
);
|
||||
}
|
||||
case "v2-show-more":
|
||||
return (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={`Show ${Math.min(item.hiddenCount, THREAD_LIST_V2_SETTLED_PAGE_COUNT)} more settled threads`}
|
||||
onPress={showMoreSettled}
|
||||
className="mx-4 mt-2 items-center rounded-lg border border-dashed border-border py-2.5"
|
||||
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
|
||||
>
|
||||
<Text className="text-xs font-t3-medium text-foreground-muted">
|
||||
Show more ({item.hiddenCount} settled hidden)
|
||||
</Text>
|
||||
</Pressable>
|
||||
);
|
||||
case "header":
|
||||
return (
|
||||
<ThreadListGroupHeader
|
||||
@@ -478,42 +861,61 @@ function ThreadNavigationSidebarPane(
|
||||
archiveThread,
|
||||
confirmDeletePendingTask,
|
||||
confirmDeleteThread,
|
||||
handleChangeRequestState,
|
||||
handleSelectThread,
|
||||
handleSwipeableClose,
|
||||
handleSwipeableWillOpen,
|
||||
openPendingTask,
|
||||
projectByKey,
|
||||
projectCwdByKey,
|
||||
props.onNewThreadInProject,
|
||||
props.selectedThreadKey,
|
||||
props.width,
|
||||
savedConnectionsById,
|
||||
serverConfigs,
|
||||
settleThread,
|
||||
settlementEnvironmentIds,
|
||||
showMoreSettled,
|
||||
sidebarScrollGesture,
|
||||
unsettleThread,
|
||||
updateGroupDisplay,
|
||||
],
|
||||
);
|
||||
const filterIcon = hasCustomHomeListOptions(options)
|
||||
// v2 ignores the sort/group options, so only the environment filter can
|
||||
// light the "customized" state while the beta is on.
|
||||
const filterCustomized = threadListV2Enabled
|
||||
? options.selectedEnvironmentId !== null || selectedProjectKey !== null
|
||||
: hasCustomHomeListOptions({ ...options, selectedProjectKey });
|
||||
const filterIcon = filterCustomized
|
||||
? "line.3.horizontal.decrease.circle.fill"
|
||||
: "line.3.horizontal.decrease.circle";
|
||||
const filterMenu = useMemo(
|
||||
() =>
|
||||
buildHomeListFilterMenu({
|
||||
environments,
|
||||
projects: projectFilterOptions,
|
||||
selectedEnvironmentId: options.selectedEnvironmentId,
|
||||
selectedProjectKey,
|
||||
projectSortOrder: options.projectSortOrder,
|
||||
threadSortOrder: options.threadSortOrder,
|
||||
projectGroupingMode: options.projectGroupingMode,
|
||||
onEnvironmentChange: setSelectedEnvironmentId,
|
||||
onProjectChange: setSelectedProjectKey,
|
||||
onProjectSortOrderChange: setProjectSortOrder,
|
||||
onThreadSortOrderChange: setThreadSortOrder,
|
||||
onProjectGroupingModeChange: setProjectGroupingMode,
|
||||
listOrganization: !threadListV2Enabled,
|
||||
}),
|
||||
[
|
||||
environments,
|
||||
options,
|
||||
projectFilterOptions,
|
||||
selectedProjectKey,
|
||||
setProjectGroupingMode,
|
||||
setProjectSortOrder,
|
||||
setSelectedEnvironmentId,
|
||||
setThreadSortOrder,
|
||||
threadListV2Enabled,
|
||||
],
|
||||
);
|
||||
const nativeHeaderItems = useMemo(
|
||||
@@ -531,7 +933,9 @@ function ThreadNavigationSidebarPane(
|
||||
? "Loading threads…"
|
||||
: props.searchQuery.trim().length > 0
|
||||
? "No matching threads"
|
||||
: "No threads yet"}
|
||||
: selectedProject !== null
|
||||
? `No threads in ${selectedProject.title}`
|
||||
: "No threads yet"}
|
||||
</Text>
|
||||
);
|
||||
|
||||
@@ -539,6 +943,7 @@ function ThreadNavigationSidebarPane(
|
||||
return (
|
||||
<>
|
||||
<NativeStackScreenOptions
|
||||
optionsVersion={nativeHeaderItems}
|
||||
options={{
|
||||
headerSearchBarOptions: {
|
||||
ref: searchBarRef,
|
||||
@@ -564,12 +969,12 @@ function ThreadNavigationSidebarPane(
|
||||
<SwipeableScrollGateProvider enabled={swipeEnabled}>
|
||||
<GestureDetector gesture={sidebarScrollGesture}>
|
||||
<LegendList
|
||||
data={listLayout.items}
|
||||
data={listItems}
|
||||
drawDistance={500}
|
||||
estimatedItemSize={64}
|
||||
extraData={listExtraData}
|
||||
getItemType={(item) => item.type}
|
||||
itemsAreEqual={homeListItemsAreEqual}
|
||||
itemsAreEqual={sidebarItemsAreEqual}
|
||||
keyExtractor={(item) => item.key}
|
||||
renderItem={renderListItem}
|
||||
automaticallyAdjustsScrollIndicatorInsets={NATIVE_LIQUID_GLASS_SUPPORTED}
|
||||
@@ -625,12 +1030,12 @@ function ThreadNavigationSidebarPane(
|
||||
<SwipeableScrollGateProvider enabled={swipeEnabled}>
|
||||
<GestureDetector gesture={sidebarScrollGesture}>
|
||||
<LegendList
|
||||
data={listLayout.items}
|
||||
data={listItems}
|
||||
drawDistance={500}
|
||||
estimatedItemSize={64}
|
||||
extraData={listExtraData}
|
||||
getItemType={(item) => item.type}
|
||||
itemsAreEqual={homeListItemsAreEqual}
|
||||
itemsAreEqual={sidebarItemsAreEqual}
|
||||
keyExtractor={(item) => item.key}
|
||||
renderItem={renderListItem}
|
||||
contentContainerStyle={[
|
||||
|
||||
@@ -19,8 +19,10 @@ import { ThreadSwipeable } from "../home/thread-swipe-actions";
|
||||
import { resolveThreadListV2Status, type ThreadListV2Status } from "./threadListV2";
|
||||
|
||||
/**
|
||||
* Thread List v2 rows mirror the web sidebar's compact tonal cards and
|
||||
* receded settled tail while retaining native swipe and long-press actions.
|
||||
* Thread List v2 renders one flat native list: rich edge-to-edge rows for
|
||||
* active work and a receded settled tail, all with native swipe and
|
||||
* long-press actions. State reads through colored status labels and text
|
||||
* hierarchy rather than card fills.
|
||||
*/
|
||||
|
||||
const MONO_FONT = Platform.select({
|
||||
@@ -29,12 +31,15 @@ const MONO_FONT = Platform.select({
|
||||
default: "monospace",
|
||||
});
|
||||
|
||||
// Status hues follow the system-wide convention set by sidebar v1 and the
|
||||
// Live Activity/widgets (amber approval, indigo input, sky working) so a
|
||||
// thread reads the same color everywhere it surfaces.
|
||||
const STATUS_LABEL_BY_STATUS: Partial<
|
||||
Record<ThreadListV2Status, { label: string; className: string }>
|
||||
> = {
|
||||
approval: { label: "Approval", className: "text-amber-700 dark:text-amber-300" },
|
||||
input: { label: "Input", className: "text-amber-700 dark:text-amber-300" },
|
||||
working: { label: "Working", className: "text-blue-600 dark:text-blue-400" },
|
||||
input: { label: "Input", className: "text-indigo-600 dark:text-indigo-300" },
|
||||
working: { label: "Working", className: "text-sky-600 dark:text-sky-400" },
|
||||
failed: { label: "Failed", className: "text-red-700 dark:text-red-300" },
|
||||
};
|
||||
|
||||
@@ -60,10 +65,20 @@ const LEGACY_MENU_ACTIONS: MenuAction[] = [
|
||||
{ id: "delete", title: "Delete", image: "trash", attributes: { destructive: true } },
|
||||
];
|
||||
|
||||
export const ThreadListV2SettledDivider = memo(function ThreadListV2SettledDivider() {
|
||||
/** Rounded-row radius shared with the v1 sidebar rows. */
|
||||
const SIDEBAR_V2_ROW_RADIUS = 12;
|
||||
|
||||
export const ThreadListV2SettledDivider = memo(function ThreadListV2SettledDivider(props: {
|
||||
readonly pane?: "screen" | "sidebar";
|
||||
}) {
|
||||
const borderColor = useThemeColor("--color-border");
|
||||
return (
|
||||
<View className="mb-1.5 mt-4 flex-row items-center gap-2.5 px-5">
|
||||
<View
|
||||
className={cn(
|
||||
"mb-1.5 mt-4 flex-row items-center gap-2.5",
|
||||
props.pane === "sidebar" ? "px-3" : "px-5",
|
||||
)}
|
||||
>
|
||||
<Text className="text-xs font-t3-medium text-foreground-tertiary">Settled</Text>
|
||||
<View className="h-px flex-1" style={{ backgroundColor: borderColor }} />
|
||||
</View>
|
||||
@@ -76,6 +91,22 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
|
||||
readonly showSettledDivider: boolean;
|
||||
readonly project: EnvironmentProject | null;
|
||||
readonly providerDriver: string | null;
|
||||
/** Which machine hosts the thread. Null when only one environment is
|
||||
connected — repeating the same label on every row is noise. Mirrors
|
||||
the web sidebar's remote-environment cloud icon, but as text since
|
||||
phones have no hover tooltips. */
|
||||
readonly environmentLabel: string | null;
|
||||
/** Hosting surface. "screen" (default) renders the compact Home idiom:
|
||||
flat edge-to-edge rows on the screen background with inset hairlines.
|
||||
"sidebar" renders the iPad split-view idiom: rounded rows blending
|
||||
into the drawer surface, selection filled with the accent color —
|
||||
matching the v1 sidebar rows. */
|
||||
readonly pane?: "screen" | "sidebar";
|
||||
/** Highlights the thread open in the detail pane (iPad split view). The
|
||||
compact Home list never sets it — phones navigate away on select. */
|
||||
readonly selected?: boolean;
|
||||
/** Override for narrow panes (iPad sidebar); defaults to window width. */
|
||||
readonly fullSwipeWidth?: number;
|
||||
readonly onSelectThread: (thread: EnvironmentThreadShell) => void;
|
||||
readonly onDeleteThread: (thread: EnvironmentThreadShell) => void;
|
||||
readonly onSettleThread: (thread: EnvironmentThreadShell) => void;
|
||||
@@ -117,6 +148,11 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
|
||||
}, [onChangeRequestState, prState, threadKey]);
|
||||
|
||||
const screenColor = useThemeColor("--color-screen");
|
||||
const drawerColor = useThemeColor("--color-drawer");
|
||||
const pressedBackgroundColor = useThemeColor("--color-subtle");
|
||||
const selectedBackgroundColor = useThemeColor("--color-user-bubble");
|
||||
const sidebarPane = props.pane === "sidebar";
|
||||
const selected = props.selected === true;
|
||||
|
||||
const status = resolveThreadListV2Status(thread);
|
||||
const statusLabel = STATUS_LABEL_BY_STATUS[status];
|
||||
@@ -174,99 +210,184 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
|
||||
thread.title,
|
||||
]);
|
||||
|
||||
// The sidebar pane fills selected rows with the accent color (matching the
|
||||
// v1 sidebar), so every piece of row text needs a white-on-accent variant.
|
||||
const cardContent = (
|
||||
<>
|
||||
<View className="flex-row items-center gap-1.5">
|
||||
{props.project ? (
|
||||
<ProjectFavicon
|
||||
environmentId={thread.environmentId}
|
||||
size={15}
|
||||
projectTitle={props.project.title}
|
||||
workspaceRoot={props.project.workspaceRoot}
|
||||
/>
|
||||
) : null}
|
||||
<Text
|
||||
className={cn(
|
||||
"flex-1 text-sm font-t3-medium",
|
||||
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
|
||||
)}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{props.project?.title ?? ""}
|
||||
</Text>
|
||||
<Text
|
||||
className={cn(
|
||||
"text-xs tabular-nums",
|
||||
selected ? "text-white" : (statusLabel?.className ?? "text-foreground-tertiary"),
|
||||
)}
|
||||
>
|
||||
{statusLabel?.label ?? timeLabel}
|
||||
</Text>
|
||||
</View>
|
||||
<Text
|
||||
className={cn(
|
||||
"mt-1 text-base font-t3-medium",
|
||||
selected ? "text-user-bubble-foreground" : "text-foreground",
|
||||
)}
|
||||
numberOfLines={2}
|
||||
>
|
||||
{thread.title}
|
||||
</Text>
|
||||
<View className="mt-1 flex-row items-center gap-2">
|
||||
{status === "failed" && thread.session?.lastError ? (
|
||||
<Text
|
||||
className={cn(
|
||||
"flex-1 text-xs",
|
||||
selected
|
||||
? "text-user-bubble-foreground-muted"
|
||||
: "text-red-600/80 dark:text-red-400/80",
|
||||
)}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{thread.session.lastError}
|
||||
</Text>
|
||||
) : thread.branch || props.environmentLabel ? (
|
||||
/* "branch · machine" share one truncating line. The machine sits
|
||||
last so a tight fit cuts the repetitive label, not the branch —
|
||||
and machine-only fills the row for non-git projects. */
|
||||
<Text
|
||||
className={cn(
|
||||
"flex-1 text-xs",
|
||||
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
|
||||
)}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{thread.branch ? (
|
||||
<Text
|
||||
className={cn(
|
||||
"text-xs",
|
||||
selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
|
||||
)}
|
||||
style={{ fontFamily: MONO_FONT }}
|
||||
>
|
||||
{thread.branch}
|
||||
</Text>
|
||||
) : null}
|
||||
{thread.branch && props.environmentLabel ? " · " : null}
|
||||
{props.environmentLabel ? (
|
||||
<Text
|
||||
className={cn(
|
||||
"text-xs",
|
||||
selected ? "text-user-bubble-foreground-muted" : "text-foreground-tertiary",
|
||||
)}
|
||||
>
|
||||
{props.environmentLabel}
|
||||
</Text>
|
||||
) : null}
|
||||
</Text>
|
||||
) : (
|
||||
<View className="flex-1" />
|
||||
)}
|
||||
{pr ? (
|
||||
<Text
|
||||
accessibilityLabel={pr.accessibilityLabel}
|
||||
className={cn("text-xs", selected ? "text-white" : pr.textClassName)}
|
||||
style={{ fontFamily: MONO_FONT }}
|
||||
>
|
||||
#{pr.label}
|
||||
</Text>
|
||||
) : null}
|
||||
{props.providerDriver ? (
|
||||
<View className="opacity-60">
|
||||
<ProviderIcon provider={props.providerDriver} size={14} />
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
|
||||
const rowContent = (close: () => void) =>
|
||||
variant === "card" ? (
|
||||
<Pressable
|
||||
accessibilityHint={`Opens the thread. Swipe left to ${primaryAction.label.toLowerCase()}.`}
|
||||
accessibilityLabel={thread.title}
|
||||
accessibilityRole="button"
|
||||
accessibilityState={{ selected }}
|
||||
onPress={() => {
|
||||
close();
|
||||
onSelectThread(thread);
|
||||
}}
|
||||
style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })}
|
||||
style={
|
||||
sidebarPane
|
||||
? ({ pressed }) => ({
|
||||
backgroundColor: selected
|
||||
? selectedBackgroundColor
|
||||
: pressed
|
||||
? pressedBackgroundColor
|
||||
: drawerColor,
|
||||
borderRadius: SIDEBAR_V2_ROW_RADIUS,
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 10,
|
||||
})
|
||||
: ({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })
|
||||
}
|
||||
>
|
||||
<View className="bg-screen px-4 py-1">
|
||||
<View
|
||||
className={cn(
|
||||
"overflow-hidden",
|
||||
status === "ready"
|
||||
? "bg-black/[0.025] dark:bg-white/[0.025]"
|
||||
: "bg-black/[0.04] dark:bg-white/[0.04]",
|
||||
)}
|
||||
style={{ borderRadius: 12, borderCurve: "continuous", minHeight: 84 }}
|
||||
>
|
||||
<View className="px-3 py-2.5">
|
||||
<View className="flex-row items-center gap-1.5">
|
||||
{props.project ? (
|
||||
<ProjectFavicon
|
||||
environmentId={thread.environmentId}
|
||||
size={15}
|
||||
projectTitle={props.project.title}
|
||||
workspaceRoot={props.project.workspaceRoot}
|
||||
/>
|
||||
) : null}
|
||||
<Text
|
||||
className="flex-1 text-sm font-t3-medium text-foreground-muted"
|
||||
numberOfLines={1}
|
||||
>
|
||||
{props.project?.title ?? ""}
|
||||
</Text>
|
||||
<Text
|
||||
className={cn(
|
||||
"text-xs tabular-nums",
|
||||
statusLabel?.className ?? "text-foreground-tertiary",
|
||||
)}
|
||||
>
|
||||
{statusLabel?.label ?? timeLabel}
|
||||
</Text>
|
||||
</View>
|
||||
<Text className="mt-1 text-base font-t3-medium text-foreground" numberOfLines={2}>
|
||||
{thread.title}
|
||||
</Text>
|
||||
<View className="mt-1 flex-row items-center gap-2">
|
||||
{status === "failed" && thread.session?.lastError ? (
|
||||
<Text
|
||||
className="flex-1 text-xs text-red-600/80 dark:text-red-400/80"
|
||||
numberOfLines={1}
|
||||
>
|
||||
{thread.session.lastError}
|
||||
</Text>
|
||||
) : thread.branch ? (
|
||||
<Text
|
||||
className="flex-1 text-xs text-foreground-muted"
|
||||
numberOfLines={1}
|
||||
style={{ fontFamily: MONO_FONT }}
|
||||
>
|
||||
{thread.branch}
|
||||
</Text>
|
||||
) : (
|
||||
<View className="flex-1" />
|
||||
)}
|
||||
{props.providerDriver ? (
|
||||
<View className="opacity-60">
|
||||
<ProviderIcon provider={props.providerDriver} size={14} />
|
||||
</View>
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
{sidebarPane ? (
|
||||
cardContent
|
||||
) : (
|
||||
/* Flat native list rows: no tonal containers — colored status
|
||||
labels and text hierarchy carry state, an inset hairline
|
||||
separates rows. The opaque screen background stays so swipe
|
||||
actions reveal behind the row. */
|
||||
<View className="bg-screen">
|
||||
<View className="px-5 py-2.5">{cardContent}</View>
|
||||
<View className="ml-5 h-px bg-border-subtle" />
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</Pressable>
|
||||
) : (
|
||||
<Pressable
|
||||
accessibilityHint={`Opens the thread. Swipe left to ${primaryAction.label.toLowerCase()}.`}
|
||||
accessibilityLabel={thread.title}
|
||||
accessibilityRole="button"
|
||||
className="bg-screen"
|
||||
accessibilityState={{ selected }}
|
||||
className={sidebarPane ? undefined : "bg-screen"}
|
||||
onPress={() => {
|
||||
close();
|
||||
onSelectThread(thread);
|
||||
}}
|
||||
style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })}
|
||||
style={
|
||||
sidebarPane
|
||||
? ({ pressed }) => ({
|
||||
backgroundColor: selected
|
||||
? selectedBackgroundColor
|
||||
: pressed
|
||||
? pressedBackgroundColor
|
||||
: drawerColor,
|
||||
borderRadius: SIDEBAR_V2_ROW_RADIUS,
|
||||
})
|
||||
: ({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })
|
||||
}
|
||||
>
|
||||
{/* Settled history recedes: dimmed favicon + muted title. */}
|
||||
<View className="min-h-[44px] flex-row items-center gap-2.5 px-5 py-2">
|
||||
<View
|
||||
className={cn(
|
||||
"min-h-[44px] flex-row items-center gap-2.5 py-2",
|
||||
sidebarPane ? "px-3" : "px-5",
|
||||
)}
|
||||
>
|
||||
{props.project ? (
|
||||
<View className="opacity-40">
|
||||
<ProjectFavicon
|
||||
@@ -277,11 +398,20 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
|
||||
/>
|
||||
</View>
|
||||
) : null}
|
||||
<Text className="flex-1 text-base text-foreground-muted" numberOfLines={1}>
|
||||
<Text
|
||||
className={cn(
|
||||
"flex-1 text-base",
|
||||
selected ? "text-user-bubble-foreground" : "text-foreground-muted",
|
||||
)}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{thread.title}
|
||||
</Text>
|
||||
<Text
|
||||
className="text-sm tabular-nums text-foreground-tertiary"
|
||||
className={cn(
|
||||
"text-sm tabular-nums",
|
||||
selected ? "text-user-bubble-foreground-muted" : "text-foreground-tertiary",
|
||||
)}
|
||||
style={{ fontFamily: MONO_FONT }}
|
||||
>
|
||||
{relativeTime(thread.latestUserMessageAt ?? thread.updatedAt ?? thread.createdAt)}
|
||||
@@ -292,14 +422,17 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
|
||||
|
||||
return (
|
||||
<>
|
||||
{props.showSettledDivider ? <ThreadListV2SettledDivider /> : null}
|
||||
{props.showSettledDivider ? <ThreadListV2SettledDivider pane={props.pane} /> : null}
|
||||
<ThreadSwipeable
|
||||
backgroundColor={screenColor}
|
||||
backgroundColor={sidebarPane ? drawerColor : screenColor}
|
||||
containerStyle={
|
||||
sidebarPane ? { borderRadius: SIDEBAR_V2_ROW_RADIUS, overflow: "hidden" } : undefined
|
||||
}
|
||||
enableTrackpadSwipe
|
||||
// Full swipe commits the advertised lifecycle action (Settle /
|
||||
// Un-settle), never the destructive delete.
|
||||
fullSwipeAction="primary"
|
||||
fullSwipeWidth={windowWidth - 32}
|
||||
fullSwipeWidth={props.fullSwipeWidth ?? windowWidth - 32}
|
||||
onDelete={handleDelete}
|
||||
onSwipeableClose={props.onSwipeableClose}
|
||||
onSwipeableWillOpen={props.onSwipeableWillOpen}
|
||||
|
||||
@@ -12,6 +12,12 @@ import type { EnvironmentId, ProjectId } from "@t3tools/contracts";
|
||||
*/
|
||||
export type ThreadListV2Status = "approval" | "input" | "working" | "failed" | "ready";
|
||||
|
||||
// Settled-tail paging: recent history is the common lookup; the deep tail
|
||||
// stays behind an explicit Show more. Shared by the compact Home list and
|
||||
// the iPad sidebar so both page identically.
|
||||
export const THREAD_LIST_V2_SETTLED_INITIAL_COUNT = 10;
|
||||
export const THREAD_LIST_V2_SETTLED_PAGE_COUNT = 25;
|
||||
|
||||
export function resolveThreadListV2Status(
|
||||
thread: Pick<EnvironmentThreadShell, "hasPendingApprovals" | "hasPendingUserInput" | "session">,
|
||||
): ThreadListV2Status {
|
||||
|
||||
@@ -142,6 +142,13 @@ function stabilizeOptionFunctions(
|
||||
|
||||
export function NativeStackScreenOptions(props: {
|
||||
readonly options?: AppNativeStackNavigationOptions;
|
||||
/**
|
||||
* Causes dynamic native header factories to be reapplied when their closed-over
|
||||
* menu content changes. Factory functions are intentionally stabilized, so
|
||||
* their source alone cannot capture a menu that was initially empty while
|
||||
* asynchronous data was loading.
|
||||
*/
|
||||
readonly optionsVersion?: unknown;
|
||||
readonly listeners?: Record<string, (event: never) => void>;
|
||||
readonly name?: string;
|
||||
}) {
|
||||
@@ -163,7 +170,7 @@ export function NativeStackScreenOptions(props: {
|
||||
if (!navigation || !stableOptions) {
|
||||
return;
|
||||
}
|
||||
const signature = optionsSignature(stableOptions);
|
||||
const signature = optionsSignature([stableOptions, props.optionsVersion]);
|
||||
// Avoid re-entering navigation state when semantically equal options are
|
||||
// reapplied every layout (common when callers pass unstable object literals).
|
||||
if (lastAppliedOptionsSignatureRef.current === signature) {
|
||||
@@ -171,7 +178,7 @@ export function NativeStackScreenOptions(props: {
|
||||
}
|
||||
lastAppliedOptionsSignatureRef.current = signature;
|
||||
navigation.setOptions(stableOptions);
|
||||
}, [navigation, stableOptions]);
|
||||
}, [navigation, props.optionsVersion, stableOptions]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!navigation || !props.listeners) {
|
||||
|
||||
@@ -84,7 +84,7 @@ function SidebarControl() {
|
||||
"pointer-events-auto",
|
||||
isSidebarVisible &&
|
||||
stageBackdropVariant &&
|
||||
"hover:bg-white/15 [&_svg]:text-white/85! [&_svg]:hover:text-white!",
|
||||
"[:hover,[data-pressed]]:bg-white/15 focus-visible:ring-white/90 focus-visible:ring-offset-blue-700 [&_svg]:stroke-white/90! [&_svg]:opacity-100! [&_svg]:hover:stroke-white!",
|
||||
)}
|
||||
aria-label="Toggle main sidebar"
|
||||
/>
|
||||
@@ -106,6 +106,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
|
||||
const pathname = useLocation({ select: (location) => location.pathname });
|
||||
const isOnSettings = pathname === "/settings" || pathname.startsWith("/settings/");
|
||||
const useSidebarV2 = sidebarV2Enabled && !isOnSettings;
|
||||
const useSidebarV2Theme = useSidebarV2 || isOnSettings;
|
||||
const isMacosDesktop = isElectron && isMacPlatform(navigator.platform);
|
||||
const [sidebarWidth, setSidebarWidth] = useState(readInitialThreadSidebarWidth);
|
||||
const sidebarMaximumWidth = resolveThreadSidebarMaximumWidth(window.innerWidth);
|
||||
@@ -164,10 +165,9 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
|
||||
<Sidebar
|
||||
side="left"
|
||||
collapsible="offcanvas"
|
||||
className={cn(
|
||||
"border-r border-border text-foreground",
|
||||
useSidebarV2 ? "app-sidebar" : "bg-card",
|
||||
)}
|
||||
data-app-sidebar=""
|
||||
data-sidebar-version={useSidebarV2Theme ? "v2" : "v1"}
|
||||
className="border-r border-sidebar-border bg-sidebar text-sidebar-foreground"
|
||||
resizable={{
|
||||
maxWidth: sidebarMaximumWidth,
|
||||
minWidth: THREAD_SIDEBAR_MIN_WIDTH,
|
||||
|
||||
@@ -248,7 +248,7 @@ export const BranchToolbar = memo(function BranchToolbar({
|
||||
if (!hasActiveThread || !activeProject) return null;
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-3xl items-center gap-2 px-2.5 pb-3 pt-1 sm:px-3">
|
||||
<div className="chat-composer-context-strip -mt-2 mx-auto flex w-[calc(100%-1.5rem)] max-w-[calc(48rem-1.5rem)] items-center gap-2 pt-3 pe-2 pb-1 ps-2">
|
||||
{isMobile ? (
|
||||
<MobileRunContextSelector
|
||||
envLocked={envLocked}
|
||||
|
||||
@@ -2288,6 +2288,11 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
const defaultInstanceId = defaultInstanceIdForDriver(selectedProvider);
|
||||
return providerStatuses.find((status) => status.instanceId === defaultInstanceId) ?? null;
|
||||
}, [activeProviderInstanceId, providerStatuses, selectedProvider]);
|
||||
const hasTimelineTopBanner =
|
||||
Boolean(threadError) ||
|
||||
(activeProviderStatus !== null &&
|
||||
activeProviderStatus.status !== "ready" &&
|
||||
activeProviderStatus.status !== "disabled");
|
||||
const activeProjectCwd = activeProject?.workspaceRoot ?? null;
|
||||
const activeThreadWorktreePath = activeThread?.worktreePath ?? null;
|
||||
const activeWorkspaceRoot = activeThreadWorktreePath ?? activeProjectCwd ?? undefined;
|
||||
@@ -5199,7 +5204,7 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
<header
|
||||
data-chat-header
|
||||
className={cn(
|
||||
"border-b border-border transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none",
|
||||
"bg-background transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none",
|
||||
isElectron
|
||||
? cn(
|
||||
"workspace-topbar drag-region relative px-3 sm:px-5",
|
||||
@@ -5235,8 +5240,6 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
/>
|
||||
</header>
|
||||
|
||||
{/* Error banner */}
|
||||
<ProviderStatusBanner status={activeProviderStatus} />
|
||||
<ThreadErrorBanner
|
||||
error={threadError}
|
||||
onDismiss={() => setThreadError(activeThread.id, null)}
|
||||
@@ -5245,6 +5248,10 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
<div className="flex min-h-0 min-w-0 flex-1">
|
||||
{/* Chat column */}
|
||||
<div className="relative flex min-h-0 min-w-0 flex-1 flex-col">
|
||||
{/* Provider status overlays the timeline without changing its content height. */}
|
||||
<div className="pointer-events-none absolute inset-x-0 top-0 z-20">
|
||||
<ProviderStatusBanner status={activeProviderStatus} />
|
||||
</div>
|
||||
{/* Messages Wrapper */}
|
||||
<div className="relative flex min-h-0 flex-1 flex-col">
|
||||
{/* Messages — LegendList handles virtualization and scrolling internally */}
|
||||
@@ -5281,6 +5288,7 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
onIsAtEndChange={onIsAtEndChange}
|
||||
onManualNavigation={cancelTimelineLiveFollowForUserNavigation}
|
||||
hideEmptyPlaceholder={isDraftHeroState}
|
||||
topFadeEnabled={!hasTimelineTopBanner}
|
||||
/>
|
||||
|
||||
{/* scroll to end pill — shown when user has scrolled away from the live edge */}
|
||||
@@ -5313,17 +5321,6 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
: "pointer-events-none absolute inset-x-0 bottom-0 z-20 pt-1.5 sm:pt-2"
|
||||
}
|
||||
>
|
||||
{!isDraftHeroState ? (
|
||||
<div
|
||||
key="docked-composer-blur"
|
||||
aria-hidden="true"
|
||||
className="chat-composer-horizontal-inset pointer-events-none absolute inset-x-0 top-1.5 bottom-0 z-0 sm:top-2"
|
||||
>
|
||||
<div className="relative mx-auto h-full w-full max-w-3xl overflow-clip rounded-t-[20px]">
|
||||
<div className="chat-composer-shared-blur absolute -inset-8" />
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div
|
||||
ref={attachDraftHeroTransitionGroupRef}
|
||||
className="chat-composer-horizontal-inset w-full"
|
||||
@@ -5361,7 +5358,7 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
>
|
||||
<div
|
||||
ref={attachDraftHeroComposerAnchorRef}
|
||||
className="relative z-10 mx-auto w-full max-w-3xl"
|
||||
className="relative z-10 isolate mx-auto w-full max-w-3xl before:pointer-events-none before:absolute before:inset-x-0 before:bottom-0 before:-z-10 before:h-2 before:rounded-b-[22px] before:bg-background"
|
||||
>
|
||||
<ChatComposer
|
||||
composerRef={composerRef}
|
||||
@@ -5444,12 +5441,8 @@ function ChatViewContent(props: ChatViewProps) {
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
"chat-composer-lower-chrome relative z-10",
|
||||
isGitRepo
|
||||
? "pb-[calc(env(safe-area-inset-bottom)+0.25rem)]"
|
||||
: "pb-[calc(env(safe-area-inset-bottom)+0.75rem)] sm:pb-[calc(env(safe-area-inset-bottom)+1rem)]",
|
||||
)}
|
||||
data-terminal-open={terminalUiState.terminalOpen ? "true" : undefined}
|
||||
className="chat-composer-lower-chrome relative z-0 pb-[calc(env(safe-area-inset-bottom)+1rem)] sm:pb-[calc(env(safe-area-inset-bottom)+1.25rem)]"
|
||||
>
|
||||
{isGitRepo && (
|
||||
<div className="pointer-events-auto">
|
||||
|
||||
@@ -3,10 +3,38 @@ import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools
|
||||
import type { Thread } from "../types";
|
||||
import {
|
||||
buildThreadActionItems,
|
||||
enumerateCommandPaletteItems,
|
||||
filterCommandPaletteGroups,
|
||||
type CommandPaletteGroup,
|
||||
} from "./CommandPalette.logic";
|
||||
|
||||
describe("enumerateCommandPaletteItems", () => {
|
||||
it("assigns positional jump shortcuts to the first nine displayed items", () => {
|
||||
const items = Array.from({ length: 10 }, (_, index) => ({
|
||||
kind: "action" as const,
|
||||
value: `project-${index + 1}`,
|
||||
searchTerms: [],
|
||||
title: `Project ${index + 1}`,
|
||||
icon: null,
|
||||
shortcutCommand: "chat.new" as const,
|
||||
run: async () => undefined,
|
||||
}));
|
||||
|
||||
expect(enumerateCommandPaletteItems(items).map((item) => item.shortcutCommand)).toEqual([
|
||||
"thread.jump.1",
|
||||
"thread.jump.2",
|
||||
"thread.jump.3",
|
||||
"thread.jump.4",
|
||||
"thread.jump.5",
|
||||
"thread.jump.6",
|
||||
"thread.jump.7",
|
||||
"thread.jump.8",
|
||||
"thread.jump.9",
|
||||
undefined,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
const LOCAL_ENVIRONMENT_ID = EnvironmentId.make("environment-local");
|
||||
const PROJECT_ID = ProjectId.make("project-1");
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { type KeybindingCommand, type FilesystemBrowseEntry } from "@t3tools/contracts";
|
||||
import {
|
||||
type KeybindingCommand,
|
||||
type FilesystemBrowseEntry,
|
||||
THREAD_JUMP_KEYBINDING_COMMANDS,
|
||||
} from "@t3tools/contracts";
|
||||
import type { SidebarThreadSortOrder } from "@t3tools/contracts/settings";
|
||||
import * as Arr from "effect/Array";
|
||||
import * as Result from "effect/Result";
|
||||
@@ -52,6 +56,18 @@ export interface CommandPaletteView {
|
||||
readonly initialQuery?: string;
|
||||
}
|
||||
|
||||
export function enumerateCommandPaletteItems(
|
||||
items: ReadonlyArray<CommandPaletteActionItem>,
|
||||
): CommandPaletteActionItem[] {
|
||||
return items.map((item, index) => {
|
||||
const shortcutCommand = THREAD_JUMP_KEYBINDING_COMMANDS[index];
|
||||
if (shortcutCommand) return { ...item, shortcutCommand };
|
||||
|
||||
const { shortcutCommand: _shortcutCommand, ...itemWithoutShortcut } = item;
|
||||
return itemWithoutShortcut;
|
||||
});
|
||||
}
|
||||
|
||||
export type CommandPaletteMode = "root" | "root-browse" | "submenu" | "submenu-browse";
|
||||
|
||||
export function filterBrowseEntries(input: {
|
||||
|
||||
@@ -95,6 +95,7 @@ import {
|
||||
buildProjectActionItems,
|
||||
buildRootGroups,
|
||||
buildThreadActionItems,
|
||||
enumerateCommandPaletteItems,
|
||||
type CommandPaletteActionItem,
|
||||
type CommandPaletteSubmenuItem,
|
||||
type CommandPaletteView,
|
||||
@@ -112,7 +113,7 @@ import { ProjectFavicon } from "./ProjectFavicon";
|
||||
import { ThreadRowLeadingStatus, ThreadRowTrailingStatus } from "./ThreadStatusIndicators";
|
||||
import { primaryServerKeybindingsAtom, primaryServerProvidersAtom } from "../state/server";
|
||||
import { resolveDefaultProviderModelSelection } from "../providerInstances";
|
||||
import { resolveShortcutCommand } from "../keybindings";
|
||||
import { resolveShortcutCommand, threadJumpIndexFromCommand } from "../keybindings";
|
||||
import {
|
||||
Command,
|
||||
CommandDialog,
|
||||
@@ -686,29 +687,30 @@ function OpenCommandPaletteDialog(props: {
|
||||
|
||||
const projectThreadItems = useMemo(
|
||||
() =>
|
||||
buildProjectActionItems({
|
||||
projects,
|
||||
valuePrefix: "new-thread-in",
|
||||
shortcutCommand: "chat.new",
|
||||
icon: (project) => (
|
||||
<ProjectFavicon
|
||||
environmentId={project.environmentId}
|
||||
cwd={project.workspaceRoot}
|
||||
className={ITEM_ICON_CLASS}
|
||||
/>
|
||||
),
|
||||
runProject: async (project) => {
|
||||
await startNewThreadInProjectFromContext(
|
||||
{
|
||||
activeDraftThread,
|
||||
activeThread: activeThread ?? undefined,
|
||||
defaultProjectRef,
|
||||
handleNewThread,
|
||||
},
|
||||
scopeProjectRef(project.environmentId, project.id),
|
||||
);
|
||||
},
|
||||
}),
|
||||
enumerateCommandPaletteItems(
|
||||
buildProjectActionItems({
|
||||
projects,
|
||||
valuePrefix: "new-thread-in",
|
||||
icon: (project) => (
|
||||
<ProjectFavicon
|
||||
environmentId={project.environmentId}
|
||||
cwd={project.workspaceRoot}
|
||||
className={ITEM_ICON_CLASS}
|
||||
/>
|
||||
),
|
||||
runProject: async (project) => {
|
||||
await startNewThreadInProjectFromContext(
|
||||
{
|
||||
activeDraftThread,
|
||||
activeThread: activeThread ?? undefined,
|
||||
defaultProjectRef,
|
||||
handleNewThread,
|
||||
},
|
||||
scopeProjectRef(project.environmentId, project.id),
|
||||
);
|
||||
},
|
||||
}),
|
||||
),
|
||||
[activeDraftThread, activeThread, defaultProjectRef, handleNewThread, projects],
|
||||
);
|
||||
|
||||
@@ -997,7 +999,13 @@ function OpenCommandPaletteDialog(props: {
|
||||
: projectThreadItems;
|
||||
pushPaletteView({
|
||||
addonIcon: <SquarePenIcon className={ADDON_ICON_CLASS} />,
|
||||
groups: [{ value: "projects", label: "Projects", items: prioritized }],
|
||||
groups: [
|
||||
{
|
||||
value: "projects",
|
||||
label: "Projects",
|
||||
items: enumerateCommandPaletteItems(prioritized),
|
||||
},
|
||||
],
|
||||
});
|
||||
}, [
|
||||
clearOpenIntent,
|
||||
@@ -1545,6 +1553,22 @@ function OpenCommandPaletteDialog(props: {
|
||||
}
|
||||
|
||||
function handleKeyDown(event: KeyboardEvent<HTMLInputElement>): void {
|
||||
const command = resolveShortcutCommand(event, keybindings, {
|
||||
platform: navigator.platform,
|
||||
context: { modelPickerOpen: false },
|
||||
});
|
||||
if (threadJumpIndexFromCommand(command ?? "") !== null) {
|
||||
const matchingItem = displayedGroups
|
||||
.flatMap((group) => group.items)
|
||||
.find((item) => item.shortcutCommand === command);
|
||||
if (matchingItem) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
executeItem(matchingItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (addProjectCloneFlow?.step === "repository" && event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
void submitAddProjectCloneFlow();
|
||||
@@ -1855,7 +1879,7 @@ function OpenCommandPaletteDialog(props: {
|
||||
<span className="truncate text-foreground text-sm">
|
||||
{remoteProjectContext.title}
|
||||
</span>
|
||||
<span className="truncate text-muted-foreground/70 text-xs">
|
||||
<span className="truncate text-muted-foreground/85 text-xs">
|
||||
{remoteProjectContext.description}
|
||||
</span>
|
||||
</span>
|
||||
@@ -1896,37 +1920,35 @@ function OpenCommandPaletteDialog(props: {
|
||||
<Kbd>
|
||||
<ArrowDownIcon />
|
||||
</Kbd>
|
||||
<span className={cn("text-muted-foreground/80")}>Navigate</span>
|
||||
<span>Navigate</span>
|
||||
</KbdGroup>
|
||||
{addProjectCloneFlow?.step === "repository" ? (
|
||||
<KbdGroup className="items-center gap-1.5">
|
||||
<Kbd>Enter</Kbd>
|
||||
<span className={cn("text-muted-foreground/80")}>
|
||||
{remoteProjectButtonLabel ?? "Continue"}
|
||||
</span>
|
||||
<span>{remoteProjectButtonLabel ?? "Continue"}</span>
|
||||
</KbdGroup>
|
||||
) : !canSubmitBrowsePath || hasHighlightedBrowseItem ? (
|
||||
<KbdGroup className="items-center gap-1.5">
|
||||
<Kbd>Enter</Kbd>
|
||||
<span className={cn("text-muted-foreground/80")}>Select</span>
|
||||
<span>Select</span>
|
||||
</KbdGroup>
|
||||
) : null}
|
||||
{isSubmenu ? (
|
||||
<KbdGroup className="items-center gap-1.5">
|
||||
<Kbd>Backspace</Kbd>
|
||||
<span className={cn("text-muted-foreground/80")}>Back</span>
|
||||
<span>Back</span>
|
||||
</KbdGroup>
|
||||
) : null}
|
||||
<KbdGroup className="items-center gap-1.5">
|
||||
<Kbd>Esc</Kbd>
|
||||
<span className={cn("text-muted-foreground/80")}>Close</span>
|
||||
<span>Close</span>
|
||||
</KbdGroup>
|
||||
</div>
|
||||
{canOpenProjectFromFileManager ? (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="xs"
|
||||
className="h-auto px-2 text-xs text-muted-foreground/80 hover:bg-transparent hover:text-foreground"
|
||||
className="h-auto px-2 text-muted-foreground text-xs hover:bg-transparent hover:text-foreground"
|
||||
disabled={isPickingProjectFolder}
|
||||
onClick={() => {
|
||||
void handleOpenProjectFromFileManager();
|
||||
|
||||
@@ -75,7 +75,7 @@ function DisabledCommandPaletteResultRow(props: {
|
||||
{props.item.titleLeadingContent}
|
||||
<span className="truncate">{props.item.title}</span>
|
||||
</span>
|
||||
<span className="truncate text-muted-foreground/70 text-xs">
|
||||
<span className="truncate text-muted-foreground/85 text-xs">
|
||||
{props.item.description}
|
||||
</span>
|
||||
</span>
|
||||
@@ -121,7 +121,7 @@ function CommandPaletteResultRow(props: {
|
||||
{props.item.titleLeadingContent}
|
||||
<span className="truncate">{props.item.title}</span>
|
||||
</span>
|
||||
<span className="truncate text-muted-foreground/70 text-xs">
|
||||
<span className="truncate text-muted-foreground/85 text-xs">
|
||||
{props.item.description}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -521,27 +521,37 @@ export default function DiffPanel({
|
||||
<ChevronDownIcon className="size-3.5 shrink-0 text-muted-foreground" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="w-60">
|
||||
<DropdownMenuItem onClick={() => selectGitScope("unstaged")}>
|
||||
<DropdownMenuItem
|
||||
className={
|
||||
selectedTurnId === null && selectedGitScope === "unstaged"
|
||||
? "bg-foreground/[0.08]"
|
||||
: undefined
|
||||
}
|
||||
onClick={() => selectGitScope("unstaged")}
|
||||
>
|
||||
<span>Working tree</span>
|
||||
{selectedTurnId === null && selectedGitScope === "unstaged" && (
|
||||
<CheckIcon className="ml-auto" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onClick={() => selectGitScope("branch")}>
|
||||
<span>Branch changes</span>
|
||||
{selectedTurnId === null && selectedGitScope === "branch" && (
|
||||
<CheckIcon className="ml-auto" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
className={
|
||||
selectedTurnId === null && selectedGitScope === "branch"
|
||||
? "bg-foreground/[0.08]"
|
||||
: undefined
|
||||
}
|
||||
onClick={() => selectGitScope("branch")}
|
||||
>
|
||||
<span>Branch changes</span>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
className={
|
||||
selectedTurnId !== null && selectedTurn?.turnId === latestTurn?.turnId
|
||||
? "bg-foreground/[0.08]"
|
||||
: undefined
|
||||
}
|
||||
onClick={() => {
|
||||
if (latestTurn) selectTurn(latestTurn.turnId);
|
||||
}}
|
||||
>
|
||||
<span>Latest turn</span>
|
||||
{selectedTurnId !== null && selectedTurn?.turnId === latestTurn?.turnId && (
|
||||
<CheckIcon className="ml-auto" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger>Turn</DropdownMenuSubTrigger>
|
||||
@@ -554,13 +564,15 @@ export default function DiffPanel({
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
key={summary.turnId}
|
||||
className={
|
||||
summary.turnId === selectedTurn?.turnId ? "bg-foreground/[0.08]" : undefined
|
||||
}
|
||||
onClick={() => selectTurn(summary.turnId)}
|
||||
>
|
||||
<span>Turn {turnCount}</span>
|
||||
<span className="ml-auto text-xs tabular-nums text-muted-foreground">
|
||||
{formatShortTimestamp(summary.completedAt, settings.timestampFormat)}
|
||||
</span>
|
||||
{summary.turnId === selectedTurn?.turnId && <CheckIcon className="ml-1" />}
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -544,9 +544,9 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
|
||||
|
||||
return (
|
||||
<Dialog open={props.open} onOpenChange={handleOpenChange}>
|
||||
<DialogPopup className="max-w-xl overflow-hidden">
|
||||
<div className="flex min-h-0 flex-col overflow-hidden border-foreground/10 bg-background shadow-2xl">
|
||||
<DialogHeader className="border-b border-border/70 bg-background">
|
||||
<DialogPopup className="workflow-dialog-surface max-w-xl overflow-hidden before:hidden">
|
||||
<div className="flex min-h-0 flex-col overflow-hidden border-foreground/10 bg-transparent">
|
||||
<DialogHeader className="border-b border-border/70 bg-foreground/[0.025]">
|
||||
<DialogTitle>Publish repository</DialogTitle>
|
||||
<DialogDescription>
|
||||
Pick where to host it, then point us at a repo to push to.
|
||||
@@ -913,7 +913,7 @@ function PublishRepositoryDialog(props: PublishRepositoryDialogProps) {
|
||||
</AnimatedHeight>
|
||||
</DialogPanel>
|
||||
|
||||
<DialogFooter>
|
||||
<DialogFooter className="dark:border-white/5 dark:bg-white/[0.025]">
|
||||
{publishWizardStep === 2 ? (
|
||||
<Button size="sm" onClick={() => handleOpenChange(false)}>
|
||||
Done
|
||||
@@ -1736,7 +1736,7 @@ export default function GitActionsControl({
|
||||
>
|
||||
<ChevronDownIcon aria-hidden="true" className="size-4" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="w-full">
|
||||
<MenuPopup align="end" className="command-menu-surface w-full">
|
||||
{gitActionMenuItems.map((item) => {
|
||||
const disabledReason = getMenuActionDisabledReason({
|
||||
item,
|
||||
@@ -1825,7 +1825,7 @@ export default function GitActionsControl({
|
||||
}
|
||||
}}
|
||||
>
|
||||
<DialogPopup>
|
||||
<DialogPopup className="workflow-dialog-surface before:hidden">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{COMMIT_DIALOG_TITLE}</DialogTitle>
|
||||
<DialogDescription>{COMMIT_DIALOG_DESCRIPTION}</DialogDescription>
|
||||
@@ -1955,7 +1955,7 @@ export default function GitActionsControl({
|
||||
/>
|
||||
</div>
|
||||
</DialogPanel>
|
||||
<DialogFooter>
|
||||
<DialogFooter className="dark:border-white/5 dark:bg-white/[0.025]">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@@ -1998,14 +1998,14 @@ export default function GitActionsControl({
|
||||
}
|
||||
}}
|
||||
>
|
||||
<DialogPopup className="max-w-xl">
|
||||
<DialogPopup className="workflow-dialog-surface max-w-xl before:hidden">
|
||||
<DialogHeader>
|
||||
<DialogTitle>
|
||||
{pendingDefaultBranchActionCopy?.title ?? "Run action on default refName?"}
|
||||
</DialogTitle>
|
||||
<DialogDescription>{pendingDefaultBranchActionCopy?.description}</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogFooter className="sm:flex-wrap sm:items-center">
|
||||
<DialogFooter className="dark:border-white/5 dark:bg-white/[0.025] sm:flex-wrap sm:items-center">
|
||||
<Button
|
||||
className="w-full sm:mr-auto sm:w-auto"
|
||||
variant="outline"
|
||||
|
||||
@@ -276,7 +276,7 @@ export default function ProjectScriptsControl({
|
||||
>
|
||||
<ChevronDownIcon className="size-4" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end">
|
||||
<MenuPopup align="end" className="command-menu-surface">
|
||||
{scripts.map((script) => {
|
||||
const shortcutLabel = shortcutLabelForCommand(
|
||||
keybindings,
|
||||
@@ -364,7 +364,7 @@ export default function ProjectScriptsControl({
|
||||
}}
|
||||
open={dialogOpen}
|
||||
>
|
||||
<DialogPopup>
|
||||
<DialogPopup className="workflow-dialog-surface before:hidden">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{isEditing ? "Edit Action" : "Add Action"}</DialogTitle>
|
||||
<DialogDescription>
|
||||
@@ -389,7 +389,7 @@ export default function ProjectScriptsControl({
|
||||
>
|
||||
<ScriptIcon icon={icon} className="size-4.5" />
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup align="start">
|
||||
<PopoverPopup align="start" className="command-menu-surface">
|
||||
<div className="grid grid-cols-3 gap-2">
|
||||
{SCRIPT_ICONS.map((entry) => {
|
||||
const isSelected = entry.id === icon;
|
||||
@@ -480,7 +480,7 @@ export default function ProjectScriptsControl({
|
||||
{validationError && <p className="text-sm text-destructive">{validationError}</p>}
|
||||
</form>
|
||||
</DialogPanel>
|
||||
<DialogFooter>
|
||||
<DialogFooter className="dark:border-white/5 dark:bg-white/[0.025]">
|
||||
{isEditing && (
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
@@ -157,7 +157,7 @@ function RightPanelEmptyState(props: {
|
||||
key={action.label}
|
||||
type="button"
|
||||
onClick={action.onClick}
|
||||
className="flex min-h-28 w-full flex-col items-start rounded-lg border border-border/80 bg-card/40 p-4 text-left transition hover:border-border hover:bg-accent/60"
|
||||
className="flex min-h-28 w-full flex-col items-start rounded-lg border border-border/80 bg-card p-4 text-left transition hover:border-border hover:bg-accent/60 dark:border-transparent dark:shadow-none dark:inset-ring-1 dark:inset-ring-white/5"
|
||||
>
|
||||
{content}
|
||||
</button>
|
||||
@@ -166,7 +166,7 @@ function RightPanelEmptyState(props: {
|
||||
const disabledCard = (
|
||||
<button
|
||||
type="button"
|
||||
className="flex min-h-28 w-full cursor-not-allowed flex-col items-start rounded-lg border border-border/80 bg-card/40 p-4 text-left opacity-40"
|
||||
className="flex min-h-28 w-full cursor-not-allowed flex-col items-start rounded-lg border border-border/80 bg-card p-4 text-left opacity-40 dark:border-transparent dark:shadow-none dark:inset-ring-1 dark:inset-ring-white/5"
|
||||
aria-disabled="true"
|
||||
>
|
||||
{content}
|
||||
|
||||
@@ -834,26 +834,24 @@ describe("resolveThreadStatusPill", () => {
|
||||
});
|
||||
|
||||
describe("resolveThreadRowClassName", () => {
|
||||
it("uses the darker selected palette when a thread is both selected and active", () => {
|
||||
it("uses the active sidebar surface when a thread is both selected and active", () => {
|
||||
const className = resolveThreadRowClassName({ isActive: true, isSelected: true });
|
||||
expect(className).toContain("bg-primary/22");
|
||||
expect(className).toContain("hover:bg-primary/26");
|
||||
expect(className).toContain("dark:bg-primary/30");
|
||||
expect(className).not.toContain("bg-accent/85");
|
||||
expect(className).toContain("bg-sidebar-row-active");
|
||||
expect(className).toContain("text-sidebar-foreground");
|
||||
expect(className).not.toContain("bg-primary");
|
||||
});
|
||||
|
||||
it("uses selected hover colors for selected threads", () => {
|
||||
const className = resolveThreadRowClassName({ isActive: false, isSelected: true });
|
||||
expect(className).toContain("bg-primary/15");
|
||||
expect(className).toContain("hover:bg-primary/19");
|
||||
expect(className).toContain("dark:bg-primary/22");
|
||||
expect(className).not.toContain("hover:bg-accent");
|
||||
expect(className).toContain("bg-sidebar-row-selected");
|
||||
expect(className).toContain("hover:bg-sidebar-row-active");
|
||||
expect(className).not.toContain("bg-primary");
|
||||
});
|
||||
|
||||
it("keeps the accent palette for active-only threads", () => {
|
||||
it("uses the active sidebar surface for active-only threads", () => {
|
||||
const className = resolveThreadRowClassName({ isActive: true, isSelected: false });
|
||||
expect(className).toContain("bg-accent/85");
|
||||
expect(className).toContain("hover:bg-accent");
|
||||
expect(className).toContain("bg-sidebar-row-active");
|
||||
expect(className).toContain("hover:bg-sidebar-row-active");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -391,30 +391,33 @@ export function resolveThreadRowClassName(input: {
|
||||
isSelected: boolean;
|
||||
}): string {
|
||||
const baseClassName =
|
||||
"h-6 w-full translate-x-0 cursor-pointer justify-start px-2 text-left select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring sm:h-7";
|
||||
"h-8 w-full translate-x-0 cursor-pointer justify-start rounded-md px-2 text-left text-sm select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring";
|
||||
|
||||
if (input.isSelected && input.isActive) {
|
||||
return cn(
|
||||
baseClassName,
|
||||
"bg-primary/22 text-foreground font-medium hover:bg-primary/26 hover:text-foreground dark:bg-primary/30 dark:hover:bg-primary/36",
|
||||
"bg-sidebar-row-active text-sidebar-foreground font-medium hover:bg-sidebar-row-active hover:text-sidebar-foreground",
|
||||
);
|
||||
}
|
||||
|
||||
if (input.isSelected) {
|
||||
return cn(
|
||||
baseClassName,
|
||||
"bg-primary/15 text-foreground hover:bg-primary/19 hover:text-foreground dark:bg-primary/22 dark:hover:bg-primary/28",
|
||||
"bg-sidebar-row-selected text-sidebar-foreground hover:bg-sidebar-row-active hover:text-sidebar-foreground",
|
||||
);
|
||||
}
|
||||
|
||||
if (input.isActive) {
|
||||
return cn(
|
||||
baseClassName,
|
||||
"bg-accent/85 text-foreground font-medium hover:bg-accent hover:text-foreground dark:bg-accent/55 dark:hover:bg-accent/70",
|
||||
"bg-sidebar-row-active text-sidebar-foreground font-medium hover:bg-sidebar-row-active hover:text-sidebar-foreground",
|
||||
);
|
||||
}
|
||||
|
||||
return cn(baseClassName, "text-muted-foreground hover:bg-accent hover:text-foreground");
|
||||
return cn(
|
||||
baseClassName,
|
||||
"text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
|
||||
);
|
||||
}
|
||||
|
||||
// ── Sidebar v2 status model ─────────────────────────────────────────
|
||||
|
||||
@@ -707,7 +707,7 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr
|
||||
{renamingThreadKey === threadKey ? (
|
||||
<input
|
||||
ref={handleRenameInputRef}
|
||||
className="min-w-0 flex-1 truncate text-base sm:text-xs bg-transparent outline-none border border-ring rounded px-0.5"
|
||||
className="min-w-0 flex-1 truncate rounded border border-ring bg-transparent px-0.5 text-sm outline-none"
|
||||
value={renamingTitle}
|
||||
onChange={handleRenameInputChange}
|
||||
onKeyDown={handleRenameInputKeyDown}
|
||||
@@ -720,7 +720,7 @@ export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThr
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<span
|
||||
className="min-w-0 flex-1 truncate text-xs"
|
||||
className="min-w-0 flex-1 truncate text-sm"
|
||||
data-testid={`thread-title-${thread.id}`}
|
||||
>
|
||||
{thread.title}
|
||||
@@ -975,13 +975,13 @@ const SidebarProjectThreadList = memo(function SidebarProjectThreadList(
|
||||
return (
|
||||
<SidebarMenuSub
|
||||
ref={attachThreadListAutoAnimateRef}
|
||||
className="mx-0.5 my-0 w-full translate-x-0 gap-0.5 overflow-hidden px-1 py-0 sm:mx-1 sm:px-1.5"
|
||||
className="mx-0.5 my-0 w-full translate-x-0 gap-0.5 overflow-hidden border-l-0 px-1 py-0 sm:mx-1 sm:px-1.5"
|
||||
>
|
||||
{shouldShowThreadPanel && showEmptyThreadState ? (
|
||||
<SidebarMenuSubItem className="w-full" data-thread-selection-safe>
|
||||
<div
|
||||
data-thread-selection-safe
|
||||
className="flex h-6 w-full translate-x-0 items-center px-2 text-left text-[10px] text-muted-foreground/60"
|
||||
className="flex h-8 w-full translate-x-0 items-center px-2 text-left text-xs text-sidebar-muted-foreground/75"
|
||||
>
|
||||
<span>No threads yet</span>
|
||||
</div>
|
||||
@@ -1027,7 +1027,7 @@ const SidebarProjectThreadList = memo(function SidebarProjectThreadList(
|
||||
render={showMoreButtonRender}
|
||||
data-thread-selection-safe
|
||||
size="sm"
|
||||
className="h-6 w-full translate-x-0 justify-start px-2 text-left text-[10px] text-muted-foreground/60 hover:bg-accent hover:text-muted-foreground/80"
|
||||
className="h-8 w-full translate-x-0 justify-start px-2 text-left text-xs text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
|
||||
onClick={() => {
|
||||
expandThreadListForProject(projectKey);
|
||||
}}
|
||||
@@ -1045,7 +1045,7 @@ const SidebarProjectThreadList = memo(function SidebarProjectThreadList(
|
||||
render={showLessButtonRender}
|
||||
data-thread-selection-safe
|
||||
size="sm"
|
||||
className="h-6 w-full translate-x-0 justify-start px-2 text-left text-[10px] text-muted-foreground/60 hover:bg-accent hover:text-muted-foreground/80"
|
||||
className="h-8 w-full translate-x-0 justify-start px-2 text-left text-xs text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
|
||||
onClick={() => {
|
||||
collapseThreadListForProject(projectKey);
|
||||
}}
|
||||
@@ -2245,7 +2245,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
<SidebarMenuButton
|
||||
ref={isManualProjectSorting ? dragHandleProps?.setActivatorNodeRef : undefined}
|
||||
size="sm"
|
||||
className={`gap-2 px-2 py-1.5 pr-8 text-left hover:bg-accent group-hover/project-header:bg-accent group-hover/project-header:text-sidebar-accent-foreground max-sm:pr-14 ${
|
||||
className={`h-8 gap-2 rounded-md px-2 py-1.5 pr-8 text-left hover:bg-sidebar-row-hover group-hover/project-header:bg-sidebar-row-hover group-hover/project-header:text-sidebar-foreground max-sm:pr-14 ${
|
||||
isManualProjectSorting ? "cursor-grab active:cursor-grabbing" : "cursor-pointer"
|
||||
}`}
|
||||
{...(isManualProjectSorting && dragHandleProps ? dragHandleProps.attributes : {})}
|
||||
@@ -2285,7 +2285,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
)}
|
||||
<ProjectFavicon environmentId={project.environmentId} cwd={project.workspaceRoot} />
|
||||
<span className="flex min-w-0 flex-1 items-center gap-2">
|
||||
<span className="truncate text-xs font-medium text-foreground/90">
|
||||
<span className="truncate text-sm font-medium text-sidebar-foreground/90">
|
||||
{project.displayName}
|
||||
</span>
|
||||
{project.groupedProjectCount > 1 ? (
|
||||
@@ -2892,13 +2892,13 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
render={
|
||||
<SidebarMenuButton
|
||||
size="sm"
|
||||
className="gap-2 px-2 py-1.5 text-muted-foreground/70 hover:bg-accent hover:text-foreground focus-visible:ring-0"
|
||||
className="h-8 gap-2 rounded-md px-2 py-1.5 text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-0"
|
||||
data-testid="command-palette-trigger"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<SearchIcon className="size-3.5 text-muted-foreground/70" />
|
||||
<span className="flex-1 truncate text-left text-xs">Search</span>
|
||||
<SearchIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
|
||||
<span className="flex-1 truncate text-left text-sm font-medium">Search</span>
|
||||
{commandPaletteShortcutLabel ? (
|
||||
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px]">
|
||||
{commandPaletteShortcutLabel}
|
||||
@@ -2934,9 +2934,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
<LocalSecondaryStatus />
|
||||
<SidebarGroup className="px-2 py-2">
|
||||
<div className="mb-1 flex items-center justify-between pl-2 pr-1.5">
|
||||
<span className="text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60">
|
||||
Projects
|
||||
</span>
|
||||
<span className="text-xs font-medium text-sidebar-muted-foreground/80">Projects</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<ProjectSortMenu
|
||||
projectSortOrder={projectSortOrder}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { StageBackdropArt, StageBackdropButtonArt } from "./SidebarStageBackdrop";
|
||||
|
||||
describe("SidebarStageBackdrop", () => {
|
||||
it.each(["nightly", "dev"] as const)(
|
||||
"uses unique SVG definition ids when %s artwork is rendered more than once",
|
||||
(variant) => {
|
||||
const markup = renderToStaticMarkup(
|
||||
<>
|
||||
<StageBackdropArt variant={variant} />
|
||||
<StageBackdropButtonArt variant={variant} />
|
||||
</>,
|
||||
);
|
||||
const ids = Array.from(markup.matchAll(/\sid="([^"]+)"/g), (match) => match[1]);
|
||||
|
||||
expect(ids.length).toBeGreaterThan(0);
|
||||
expect(new Set(ids).size).toBe(ids.length);
|
||||
},
|
||||
);
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
import { useId } from "react";
|
||||
|
||||
import { APP_STAGE_LABEL } from "../branding";
|
||||
import { resolveServerBackedAppStageLabel } from "../branding.logic";
|
||||
@@ -47,6 +48,10 @@ export function StageBackdropArt({ variant }: { variant: SidebarStageBackdropVar
|
||||
return variant === "nightly" ? <NightlySkyArt /> : <DevBlueprintArt />;
|
||||
}
|
||||
|
||||
export function StageBackdropButtonArt({ variant }: { variant: SidebarStageBackdropVariant }) {
|
||||
return variant === "nightly" ? <NightlySkyArt compact /> : <DevBlueprintArt compact />;
|
||||
}
|
||||
|
||||
const NIGHTLY_STARS: ReadonlyArray<{
|
||||
cx: number;
|
||||
cy: number;
|
||||
@@ -78,18 +83,26 @@ const NIGHTLY_SPARKLES: ReadonlyArray<{ x: number; y: number }> = [
|
||||
{ x: 246, y: 26 },
|
||||
];
|
||||
|
||||
function NightlySkyArt() {
|
||||
function NightlySkyArt({ compact = false }: { compact?: boolean }) {
|
||||
const idPrefix = useId().replaceAll(":", "");
|
||||
const skyId = `${idPrefix}-stage-night-sky`;
|
||||
const glowId = `${idPrefix}-stage-night-glow`;
|
||||
const cloudId = `${idPrefix}-stage-night-cloud`;
|
||||
const softId = `${idPrefix}-stage-night-soft`;
|
||||
const starsId = `${idPrefix}-stage-night-stars`;
|
||||
const glowsId = `${idPrefix}-stage-night-glows`;
|
||||
|
||||
return (
|
||||
<svg
|
||||
className="h-full w-full"
|
||||
fill="none"
|
||||
preserveAspectRatio="xMinYMin slice"
|
||||
viewBox={STAGE_BACKDROP_VIEW_BOX}
|
||||
viewBox={compact ? "96 0 8192 96" : STAGE_BACKDROP_VIEW_BOX}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="stage-night-sky"
|
||||
id={skyId}
|
||||
x1="24"
|
||||
y1="0"
|
||||
x2="264"
|
||||
@@ -102,7 +115,7 @@ function NightlySkyArt() {
|
||||
<stop offset="1" stopColor="#32155B" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
id="stage-night-glow"
|
||||
id={glowId}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
@@ -113,29 +126,15 @@ function NightlySkyArt() {
|
||||
<stop offset="0.5" stopColor="#283075" stopOpacity="0.16" />
|
||||
<stop offset="1" stopColor="#111635" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<linearGradient
|
||||
id="stage-night-cloud"
|
||||
x1="0"
|
||||
y1="60"
|
||||
x2="288"
|
||||
y2="96"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
<linearGradient id={cloudId} x1="0" y1="60" x2="288" y2="96" gradientUnits="userSpaceOnUse">
|
||||
<stop stopColor="#4EA4FF" stopOpacity="0.5" />
|
||||
<stop offset="0.52" stopColor="#696FEA" stopOpacity="0.62" />
|
||||
<stop offset="1" stopColor="#A85BEA" stopOpacity="0.5" />
|
||||
</linearGradient>
|
||||
<filter
|
||||
id="stage-night-soft"
|
||||
x="-24"
|
||||
y="-24"
|
||||
width="336"
|
||||
height="144"
|
||||
filterUnits="userSpaceOnUse"
|
||||
>
|
||||
<filter id={softId} x="-24" y="-24" width="336" height="144" filterUnits="userSpaceOnUse">
|
||||
<feGaussianBlur stdDeviation="4" />
|
||||
</filter>
|
||||
<pattern id="stage-night-stars" width="288" height="96" patternUnits="userSpaceOnUse">
|
||||
<pattern id={starsId} width="288" height="96" patternUnits="userSpaceOnUse">
|
||||
<g fill="#E4EAFF">
|
||||
{NIGHTLY_STARS.map((star) => (
|
||||
<circle
|
||||
@@ -156,25 +155,25 @@ function NightlySkyArt() {
|
||||
))}
|
||||
</g>
|
||||
</pattern>
|
||||
<pattern id="stage-night-glows" width="640" height="96" patternUnits="userSpaceOnUse">
|
||||
<rect width="640" height="96" fill="url(#stage-night-glow)" />
|
||||
<pattern id={glowsId} width="640" height="96" patternUnits="userSpaceOnUse">
|
||||
<rect width="640" height="96" fill={`url(#${glowId})`} />
|
||||
</pattern>
|
||||
</defs>
|
||||
|
||||
<rect width="100%" height="96" fill="url(#stage-night-sky)" />
|
||||
<rect width="100%" height="96" fill="url(#stage-night-glows)" />
|
||||
<rect width="100%" height="96" fill="url(#stage-night-stars)" />
|
||||
<rect width="100%" height="96" fill={`url(#${skyId})`} />
|
||||
<rect width="100%" height="96" fill={`url(#${glowsId})`} />
|
||||
<rect width="100%" height="96" fill={`url(#${starsId})`} />
|
||||
|
||||
<g filter="url(#stage-night-soft)">
|
||||
<g filter={`url(#${softId})`}>
|
||||
<path
|
||||
d="M-12 88C-12 74 0 63 14 63C18 50 30 41 44 41C58 41 70 49 74 62C79 57 86 54 94 54C110 54 123 66 124 82C132 83 138 88 141 96H-12V88Z"
|
||||
fill="url(#stage-night-cloud)"
|
||||
fill={`url(#${cloudId})`}
|
||||
/>
|
||||
</g>
|
||||
<g filter="url(#stage-night-soft)">
|
||||
<g filter={`url(#${softId})`}>
|
||||
<path
|
||||
d="M150 96C151 84 161 75 173 75C176 64 186 57 198 57C210 57 220 64 223 75C231 75 238 80 241 87C250 87 257 91 260 96H150Z"
|
||||
fill="url(#stage-night-cloud)"
|
||||
fill={`url(#${cloudId})`}
|
||||
fillOpacity="0.8"
|
||||
/>
|
||||
</g>
|
||||
@@ -182,18 +181,29 @@ function NightlySkyArt() {
|
||||
);
|
||||
}
|
||||
|
||||
function DevBlueprintArt() {
|
||||
function DevBlueprintArt({ compact = false }: { compact?: boolean }) {
|
||||
const idPrefix = useId().replaceAll(":", "");
|
||||
const paperId = `${idPrefix}-stage-bp-paper`;
|
||||
const glowId = `${idPrefix}-stage-bp-glow`;
|
||||
const celesteGlowId = `${idPrefix}-stage-bp-glow-celeste`;
|
||||
const violetGlowId = `${idPrefix}-stage-bp-glow-violet`;
|
||||
const minorGridId = `${idPrefix}-stage-bp-grid-minor`;
|
||||
const majorGridId = `${idPrefix}-stage-bp-grid-major`;
|
||||
const rulerId = `${idPrefix}-stage-bp-ruler`;
|
||||
const glowsId = `${idPrefix}-stage-bp-glows`;
|
||||
const annotationsId = `${idPrefix}-stage-bp-annotations`;
|
||||
|
||||
return (
|
||||
<svg
|
||||
className="stage-blueprint h-full w-full"
|
||||
fill="none"
|
||||
preserveAspectRatio="xMinYMin slice"
|
||||
viewBox={STAGE_BACKDROP_VIEW_BOX}
|
||||
viewBox={compact ? "64 0 8192 96" : STAGE_BACKDROP_VIEW_BOX}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="stage-bp-paper"
|
||||
id={paperId}
|
||||
x1="60"
|
||||
y1="0"
|
||||
x2="220"
|
||||
@@ -206,7 +216,7 @@ function DevBlueprintArt() {
|
||||
<stop offset="1" style={{ stopColor: "var(--stage-bp-top)" }} />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
id="stage-bp-glow"
|
||||
id={glowId}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
@@ -218,7 +228,7 @@ function DevBlueprintArt() {
|
||||
<stop offset="1" stopColor="#276AF1" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="stage-bp-glow-celeste"
|
||||
id={celesteGlowId}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
@@ -230,7 +240,7 @@ function DevBlueprintArt() {
|
||||
<stop offset="1" stopColor="#277EF1" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<radialGradient
|
||||
id="stage-bp-glow-violet"
|
||||
id={violetGlowId}
|
||||
cx="0"
|
||||
cy="0"
|
||||
r="1"
|
||||
@@ -241,13 +251,13 @@ function DevBlueprintArt() {
|
||||
<stop offset="0.52" stopColor="#7C8BFF" stopOpacity="0.14" />
|
||||
<stop offset="1" stopColor="#3155DF" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<pattern id="stage-bp-grid-minor" width="8" height="8" patternUnits="userSpaceOnUse">
|
||||
<pattern id={minorGridId} width="8" height="8" patternUnits="userSpaceOnUse">
|
||||
<path d="M8 0H0V8" stroke="#EAF6FF" strokeOpacity="0.14" strokeWidth="0.5" />
|
||||
</pattern>
|
||||
<pattern id="stage-bp-grid-major" width="32" height="32" patternUnits="userSpaceOnUse">
|
||||
<pattern id={majorGridId} width="32" height="32" patternUnits="userSpaceOnUse">
|
||||
<path d="M32 0H0V32" stroke="#EAF6FF" strokeOpacity="0.26" strokeWidth="0.6" />
|
||||
</pattern>
|
||||
<pattern id="stage-bp-ruler" width="32" height="6" patternUnits="userSpaceOnUse">
|
||||
<pattern id={rulerId} width="32" height="6" patternUnits="userSpaceOnUse">
|
||||
<path
|
||||
d="M4 0V2.5M12 0V2.5M20 0V4M28 0V2.5"
|
||||
stroke="#DDF7FF"
|
||||
@@ -255,12 +265,12 @@ function DevBlueprintArt() {
|
||||
strokeWidth="0.5"
|
||||
/>
|
||||
</pattern>
|
||||
<pattern id="stage-bp-glows" width="768" height="96" patternUnits="userSpaceOnUse">
|
||||
<rect width="768" height="96" fill="url(#stage-bp-glow)" />
|
||||
<rect width="768" height="96" fill="url(#stage-bp-glow-celeste)" />
|
||||
<rect width="768" height="96" fill="url(#stage-bp-glow-violet)" />
|
||||
<pattern id={glowsId} width="768" height="96" patternUnits="userSpaceOnUse">
|
||||
<rect width="768" height="96" fill={`url(#${glowId})`} />
|
||||
<rect width="768" height="96" fill={`url(#${celesteGlowId})`} />
|
||||
<rect width="768" height="96" fill={`url(#${violetGlowId})`} />
|
||||
</pattern>
|
||||
<pattern id="stage-bp-annotations" width="768" height="96" patternUnits="userSpaceOnUse">
|
||||
<pattern id={annotationsId} width="768" height="96" patternUnits="userSpaceOnUse">
|
||||
<g stroke="#DDF7FF" strokeLinecap="round" strokeOpacity="0.6" strokeWidth="0.7">
|
||||
<path d="M180 64H264" strokeDasharray="5 4" />
|
||||
<path d="M180 61V67M264 61V67" />
|
||||
@@ -309,12 +319,12 @@ function DevBlueprintArt() {
|
||||
</pattern>
|
||||
</defs>
|
||||
|
||||
<rect width="100%" height="96" fill="url(#stage-bp-paper)" />
|
||||
<rect width="100%" height="96" fill="url(#stage-bp-glows)" />
|
||||
<rect width="100%" height="96" fill="url(#stage-bp-grid-minor)" />
|
||||
<rect width="100%" height="96" fill="url(#stage-bp-grid-major)" />
|
||||
<rect width="100%" height="6" fill="url(#stage-bp-ruler)" />
|
||||
<rect width="100%" height="96" fill="url(#stage-bp-annotations)" />
|
||||
<rect width="100%" height="96" fill={`url(#${paperId})`} />
|
||||
<rect width="100%" height="96" fill={`url(#${glowsId})`} />
|
||||
<rect width="100%" height="96" fill={`url(#${minorGridId})`} />
|
||||
<rect width="100%" height="96" fill={`url(#${majorGridId})`} />
|
||||
<rect width="100%" height="6" fill={`url(#${rulerId})`} />
|
||||
<rect width="100%" height="96" fill={`url(#${annotationsId})`} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -41,7 +41,7 @@ export const ChangedFilesCard = memo(function ChangedFilesCard(props: {
|
||||
const summaryStat = useMemo(() => summarizeTurnDiffStats(files), [files]);
|
||||
|
||||
return (
|
||||
<div className="mt-4 rounded-2xl border border-input bg-background p-2 pt-4 shadow-xs/5 not-dark:bg-clip-padding dark:bg-input/32">
|
||||
<div className="mt-4 rounded-2xl bg-background p-2 pt-4 shadow-xs/5 not-dark:bg-clip-padding dark:bg-input/32">
|
||||
<div className="sticky top-0 z-10 mb-3 flex items-center justify-between gap-2 bg-background px-2 before:absolute before:inset-x-0 before:-top-4 before:h-4 before:bg-background before:content-[''] dark:bg-[color-mix(in_srgb,var(--foreground)_2.5%,var(--background))] dark:before:bg-[color-mix(in_srgb,var(--foreground)_2.5%,var(--background))]">
|
||||
<p className="flex items-center gap-1 whitespace-nowrap font-medium text-foreground text-xs leading-4">
|
||||
<span>
|
||||
|
||||
@@ -99,7 +99,6 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
|
||||
import { toastManager } from "../ui/toast";
|
||||
import {
|
||||
BotIcon,
|
||||
CheckIcon,
|
||||
CircleAlertIcon,
|
||||
ListTodoIcon,
|
||||
PencilRulerIcon,
|
||||
@@ -280,7 +279,6 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
|
||||
{runtimeModeOptions.map((mode) => {
|
||||
const option = runtimeModeConfig[mode];
|
||||
const OptionIcon = option.icon;
|
||||
const isSelected = props.runtimeMode === mode;
|
||||
return (
|
||||
<SelectItem key={mode} value={mode} hideIndicator className="min-w-64 py-2">
|
||||
<div className="flex min-w-0 items-center gap-3">
|
||||
@@ -293,12 +291,6 @@ const ComposerFooterModeControls = memo(function ComposerFooterModeControls(prop
|
||||
{option.description}
|
||||
</span>
|
||||
</div>
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
"size-4 text-blue-400",
|
||||
isSelected ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</SelectItem>
|
||||
);
|
||||
@@ -2162,10 +2154,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
ref={composerSurfaceRef}
|
||||
data-chat-composer-mobile-collapsed={isComposerCollapsedMobile ? "true" : "false"}
|
||||
className={cn(
|
||||
"chat-composer-glass rounded-[20px] border transition-[background-color] duration-200 has-focus-visible:border-foreground/40",
|
||||
isDragOverComposer
|
||||
? "border-primary/70 bg-accent/45"
|
||||
: "border-black/12 dark:border-white/12",
|
||||
"chat-composer-glass rounded-[20px] transition-[background-color] duration-200",
|
||||
isDragOverComposer ? "bg-accent/45 ring-1 ring-primary/70" : null,
|
||||
projectSelectionRequired ? "opacity-75" : null,
|
||||
composerProviderState.composerSurfaceClassName,
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { memo, type PointerEventHandler } from "react";
|
||||
import { ChevronDownIcon, ChevronLeftIcon } from "lucide-react";
|
||||
import { cn } from "~/lib/utils";
|
||||
import { StageBackdropButtonArt, useSidebarStageBackdropVariant } from "../SidebarStageBackdrop";
|
||||
import { Button } from "../ui/button";
|
||||
import { Menu, MenuItem, MenuPopup, MenuTrigger } from "../ui/menu";
|
||||
import { Spinner } from "../ui/spinner";
|
||||
@@ -71,6 +72,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
|
||||
const pointerFocusProps = preserveComposerFocusOnPointerDown
|
||||
? { onPointerDown: preventPointerFocus }
|
||||
: undefined;
|
||||
const stageBackdropVariant = useSidebarStageBackdropVariant();
|
||||
|
||||
if (pendingAction) {
|
||||
return (
|
||||
@@ -196,7 +198,12 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
|
||||
return (
|
||||
<button
|
||||
type="submit"
|
||||
className="flex h-9 w-9 enabled:cursor-pointer items-center justify-center rounded-full bg-primary/90 text-primary-foreground shadow-xs enabled:shadow-primary/24 enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] transition-all duration-150 hover:bg-primary hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-30 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8"
|
||||
className={cn(
|
||||
"relative isolate flex h-9 w-9 items-center justify-center overflow-hidden rounded-full text-primary-foreground shadow-xs transition-all duration-150 enabled:cursor-pointer enabled:inset-shadow-[0_1px_--theme(--color-white/16%)] hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none disabled:pointer-events-none disabled:opacity-30 disabled:shadow-none disabled:hover:scale-100 sm:h-8 sm:w-8",
|
||||
stageBackdropVariant
|
||||
? "bg-transparent enabled:shadow-black/24 enabled:hover:brightness-110"
|
||||
: "bg-primary/90 enabled:shadow-primary/24 hover:bg-primary",
|
||||
)}
|
||||
{...pointerFocusProps}
|
||||
disabled={isSendBusy || isConnecting || isEnvironmentUnavailable || !hasSendableContent}
|
||||
aria-label={
|
||||
@@ -211,6 +218,11 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
|
||||
: "Send message"
|
||||
}
|
||||
>
|
||||
{stageBackdropVariant ? (
|
||||
<span className="absolute inset-0 -z-10" aria-hidden="true">
|
||||
<StageBackdropButtonArt variant={stageBackdropVariant} />
|
||||
</span>
|
||||
) : null}
|
||||
{isConnecting || isSendBusy ? (
|
||||
<Spinner className="size-3.5" aria-hidden="true" />
|
||||
) : (
|
||||
|
||||
@@ -25,7 +25,9 @@ export function ContextWindowMeter(props: {
|
||||
const totalProcessedTokens = usage.totalProcessedTokens ?? null;
|
||||
const showTotalProcessed = totalProcessedTokens !== null && totalProcessedTokens > 0;
|
||||
const isOverloaded = normalizedPercentage > 90;
|
||||
const usageColor = isOverloaded ? "var(--color-red-500)" : "var(--color-blue-500)";
|
||||
const usageColor = isOverloaded
|
||||
? "var(--color-red-500)"
|
||||
: "color-mix(in oklab, var(--color-muted-foreground) 72%, transparent)";
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
@@ -37,7 +39,7 @@ export function ContextWindowMeter(props: {
|
||||
<button
|
||||
type="button"
|
||||
className={cn(
|
||||
"inline-flex size-6 cursor-pointer items-center justify-center rounded-full border border-transparent text-muted-foreground outline-none transition-colors",
|
||||
"inline-flex size-7 cursor-pointer items-center justify-center rounded-full border border-transparent text-muted-foreground outline-none transition-colors",
|
||||
"hover:bg-accent data-[pressed]:bg-accent",
|
||||
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
||||
)}
|
||||
@@ -47,7 +49,7 @@ export function ContextWindowMeter(props: {
|
||||
: `Context window ${formatContextWindowTokens(usage.usedTokens)} tokens used`
|
||||
}
|
||||
>
|
||||
<span className="relative flex size-4 items-center justify-center">
|
||||
<span className="relative flex size-5 items-center justify-center">
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
className="-rotate-90 absolute inset-0 size-full transform-gpu"
|
||||
@@ -58,7 +60,7 @@ export function ContextWindowMeter(props: {
|
||||
cy="12"
|
||||
r={radius}
|
||||
fill="none"
|
||||
stroke="color-mix(in oklab, var(--color-muted-foreground) 35%, transparent)"
|
||||
stroke="color-mix(in oklab, var(--color-muted-foreground) 24%, transparent)"
|
||||
strokeWidth="3"
|
||||
/>
|
||||
<circle
|
||||
@@ -78,7 +80,12 @@ export function ContextWindowMeter(props: {
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
<PopoverPopup tooltipStyle side="top" align="end" className="w-64 max-w-none p-0">
|
||||
<PopoverPopup
|
||||
tooltipStyle
|
||||
side="top"
|
||||
align="end"
|
||||
className="dropdown-glass w-64 max-w-none border-0! bg-secondary! p-0 shadow-none! before:hidden"
|
||||
>
|
||||
<div className="flex flex-col gap-2 p-3">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="font-medium text-muted-foreground text-xs">Context Window</div>
|
||||
|
||||
@@ -219,6 +219,23 @@ function buildUserTimelineEntry(text: string) {
|
||||
}
|
||||
|
||||
describe("MessagesTimeline", () => {
|
||||
it("uses the larger leading inset only when the top fade is enabled", async () => {
|
||||
const { MessagesTimeline } = await import("./MessagesTimeline");
|
||||
const timelineEntries = [buildUserTimelineEntry("Hello")];
|
||||
|
||||
const compactMarkup = renderToStaticMarkup(
|
||||
<MessagesTimeline {...buildProps()} timelineEntries={timelineEntries} />,
|
||||
);
|
||||
const fadedMarkup = renderToStaticMarkup(
|
||||
<MessagesTimeline {...buildProps()} timelineEntries={timelineEntries} topFadeEnabled />,
|
||||
);
|
||||
|
||||
expect(compactMarkup).toContain('class="h-3 sm:h-4"');
|
||||
expect(compactMarkup).not.toContain("chat-timeline-scroll-fade");
|
||||
expect(fadedMarkup).toContain('class="h-10 sm:h-12"');
|
||||
expect(fadedMarkup).toContain("chat-timeline-scroll-fade");
|
||||
});
|
||||
|
||||
it("keeps assistant changed-files headers sticky below the thread header", async () => {
|
||||
const { MessagesTimeline } = await import("./MessagesTimeline");
|
||||
const assistantMessageId = MessageId.make("message-assistant-with-files");
|
||||
|
||||
@@ -150,6 +150,7 @@ interface TimelineRowActivityState {
|
||||
const TimelineRowCtx = createContext<TimelineRowSharedState>(null!);
|
||||
const TimelineRowActivityCtx = createContext<TimelineRowActivityState>(null!);
|
||||
const TIMELINE_LIST_HEADER = <div className="h-3 sm:h-4" />;
|
||||
const TIMELINE_LIST_FADE_HEADER = <div className="h-10 sm:h-12" />;
|
||||
const TIMELINE_LIST_FOOTER = <div className="h-3 sm:h-4" />;
|
||||
const EMPTY_TIMELINE_SKILLS: ReadonlyArray<Pick<ServerProviderSkill, "name" | "displayName">> = [];
|
||||
|
||||
@@ -185,6 +186,7 @@ interface MessagesTimelineProps {
|
||||
onIsAtEndChange: (isAtEnd: boolean) => void;
|
||||
onManualNavigation: () => void;
|
||||
hideEmptyPlaceholder?: boolean;
|
||||
topFadeEnabled?: boolean;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -219,6 +221,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
|
||||
onIsAtEndChange,
|
||||
onManualNavigation,
|
||||
hideEmptyPlaceholder = false,
|
||||
topFadeEnabled = false,
|
||||
}: MessagesTimelineProps) {
|
||||
const [expandedTurnIds, setExpandedTurnIds] = useState<ReadonlySet<TurnId>>(new Set());
|
||||
const [expandedWorkGroupIds, setExpandedWorkGroupIds] = useState<ReadonlySet<string>>(new Set());
|
||||
@@ -510,8 +513,11 @@ export const MessagesTimeline = memo(function MessagesTimeline({
|
||||
size: false,
|
||||
}}
|
||||
onScroll={handleScroll}
|
||||
className="scrollbar-gutter-both h-full min-h-0 overflow-x-hidden overscroll-y-contain px-3 [overflow-anchor:none] sm:px-5"
|
||||
ListHeaderComponent={TIMELINE_LIST_HEADER}
|
||||
className={cn(
|
||||
"scrollbar-gutter-both h-full min-h-0 overflow-x-hidden overscroll-y-contain px-3 [overflow-anchor:none] sm:px-5",
|
||||
topFadeEnabled && "chat-timeline-scroll-fade",
|
||||
)}
|
||||
ListHeaderComponent={topFadeEnabled ? TIMELINE_LIST_FADE_HEADER : TIMELINE_LIST_HEADER}
|
||||
ListFooterComponent={TIMELINE_LIST_FOOTER}
|
||||
/>
|
||||
<TimelineMinimap
|
||||
@@ -797,7 +803,7 @@ function TimelineMinimap({
|
||||
transform: `translateY(${activeTooltipTranslate})`,
|
||||
}}
|
||||
>
|
||||
<span className="block rounded-xl border border-border/70 bg-popover/95 p-3 text-left text-popover-foreground shadow-xl shadow-black/25 backdrop-blur">
|
||||
<span className="dropdown-glass block rounded-xl p-3 text-left text-popover-foreground shadow-xl shadow-black/25">
|
||||
<span className="block max-w-full overflow-hidden text-ellipsis whitespace-nowrap text-sm font-medium leading-5">
|
||||
{activeItem.userText ?? "User message"}
|
||||
</span>
|
||||
@@ -886,7 +892,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
|
||||
|
||||
return (
|
||||
<div className="group flex flex-col items-end gap-1">
|
||||
<div className="relative max-w-[80%] rounded-2xl border border-border bg-secondary p-3">
|
||||
<div className="relative max-w-[80%] rounded-2xl bg-secondary p-3">
|
||||
{regularImages.length > 0 && (
|
||||
<div className="mb-2 grid max-w-[420px] grid-cols-2 gap-2">
|
||||
{regularImages.map((image: NonNullable<TimelineMessage["attachments"]>[number]) => (
|
||||
@@ -1279,7 +1285,7 @@ function AssistantChangedFilesSectionInner({
|
||||
const summaryStat = summarizeTurnDiffStats(checkpointFiles);
|
||||
|
||||
return (
|
||||
<div className="mt-4 rounded-2xl border border-input bg-background p-2 pt-4 shadow-xs/5 not-dark:bg-clip-padding dark:bg-input/32">
|
||||
<div className="mt-4 rounded-2xl bg-background p-2 pt-4 shadow-xs/5 not-dark:bg-clip-padding dark:bg-input/32">
|
||||
<div className="sticky top-2 z-10 mb-3 flex items-center justify-between gap-2 bg-background px-2 before:absolute before:inset-x-0 before:-top-4 before:h-4 before:bg-background before:content-[''] dark:bg-[color-mix(in_srgb,var(--foreground)_2.5%,var(--background))] dark:before:bg-[color-mix(in_srgb,var(--foreground)_2.5%,var(--background))]">
|
||||
<p className="flex items-center gap-1 whitespace-nowrap font-medium text-foreground text-xs leading-4">
|
||||
<span>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { type ProviderDriverKind, type ProviderInstanceId } from "@t3tools/contracts";
|
||||
import { memo } from "react";
|
||||
import { CheckIcon, StarIcon } from "lucide-react";
|
||||
import { StarIcon } from "lucide-react";
|
||||
import {
|
||||
getDisplayModelName,
|
||||
getTriggerDisplayModelLabel,
|
||||
@@ -51,7 +51,7 @@ export const ModelListRow = memo(function ModelListRow(props: {
|
||||
contentClassName="flex w-full items-center gap-3"
|
||||
className={cn(
|
||||
"group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2.5 transition-[background-color,box-shadow,color]",
|
||||
"data-highlighted:bg-muted/56 data-selected:bg-transparent data-selected:text-foreground data-selected:ring-0",
|
||||
"data-highlighted:bg-muted/56 data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0",
|
||||
props.disabledReason &&
|
||||
"data-disabled:pointer-events-auto data-disabled:cursor-not-allowed data-disabled:hover:bg-transparent",
|
||||
)}
|
||||
@@ -66,7 +66,6 @@ export const ModelListRow = memo(function ModelListRow(props: {
|
||||
props.preferShortName ? { preferShortName: true } : undefined,
|
||||
)}
|
||||
</div>
|
||||
{props.isSelected ? <CheckIcon className="size-3.5 shrink-0 text-blue-400" /> : null}
|
||||
{props.showNewBadge ? (
|
||||
<span
|
||||
className="shrink-0 rounded border border-amber-500/35 bg-amber-500/15 px-0.5 py-px text-[10px] font-bold uppercase leading-none tracking-wide text-amber-800 dark:border-amber-400/30 dark:bg-amber-400/12 dark:text-amber-200"
|
||||
|
||||
@@ -521,7 +521,7 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
return (
|
||||
<TooltipProvider delay={0}>
|
||||
<div
|
||||
className="relative flex h-screen max-h-96 w-screen max-w-100 flex-row overflow-hidden rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]"
|
||||
className="dropdown-glass model-picker-surface relative flex h-screen max-h-96 w-screen max-w-100 flex-row overflow-hidden rounded-xl text-popover-foreground"
|
||||
data-model-picker-content="true"
|
||||
>
|
||||
{/* Sidebar */}
|
||||
@@ -568,23 +568,18 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
handleModelSelect(slug, instanceId);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
"flex min-h-0 flex-1 flex-col overflow-hidden bg-muted/40",
|
||||
showSidebar && "border-l",
|
||||
)}
|
||||
>
|
||||
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
|
||||
{/* Search bar */}
|
||||
<div className="px-4 pt-2.5">
|
||||
<div className="-translate-y-px border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring">
|
||||
<div className="-translate-y-px rounded-lg bg-accent px-2 py-1">
|
||||
<ComboboxInput
|
||||
ref={searchInputRef}
|
||||
className="[&_input]:h-6.5 [&_input]:font-sans [&_input]:leading-6.5"
|
||||
inputClassName="rounded-none bg-transparent text-sm"
|
||||
inputClassName="rounded-none bg-transparent text-sm placeholder:text-muted-foreground/80"
|
||||
placeholder="Search models..."
|
||||
showTrigger={false}
|
||||
startAddon={
|
||||
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground/55" />
|
||||
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground/80" />
|
||||
}
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
|
||||
@@ -97,10 +97,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
|
||||
}, [props.instanceEntries, props.selectedInstanceId, showFavorites]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="w-12 shrink-0 overflow-hidden border-r bg-muted/30"
|
||||
data-model-picker-sidebar="true"
|
||||
>
|
||||
<div className="w-12 shrink-0 overflow-hidden bg-muted/60" data-model-picker-sidebar="true">
|
||||
<div className="h-full overflow-y-auto overscroll-contain [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
||||
<div
|
||||
ref={sidebarContentRef}
|
||||
@@ -118,7 +115,7 @@ export const ModelPickerSidebar = memo(function ModelPickerSidebar(props: {
|
||||
) : null}
|
||||
{/* Favorites section */}
|
||||
{showFavorites ? (
|
||||
<div className="mb-1 border-b pb-1">
|
||||
<div className="mb-1 pb-1">
|
||||
<div className="relative w-full">
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
|
||||
@@ -27,7 +27,7 @@ export const ProviderStatusBanner = memo(function ProviderStatusBanner({
|
||||
: `${providerName} provider has limited availability.`));
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-fit max-w-[calc(100%-2rem)] pt-3">
|
||||
<div className="pointer-events-auto mx-auto w-fit max-w-[calc(100%-2rem)] pt-3">
|
||||
<div
|
||||
className={cn(
|
||||
"inline-flex items-center gap-3 rounded-xl border px-3.5 py-3 text-card-foreground text-sm",
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
} from "@t3tools/shared/model";
|
||||
import { memo, useCallback, useState } from "react";
|
||||
import type { VariantProps } from "class-variance-authority";
|
||||
import { CheckIcon, ChevronDownIcon } from "lucide-react";
|
||||
import { ChevronDownIcon } from "lucide-react";
|
||||
import { Button, buttonVariants } from "../ui/button";
|
||||
import {
|
||||
Menu,
|
||||
@@ -337,9 +337,6 @@ export const TraitsMenuContent = memo(function TraitsMenuContentImpl({
|
||||
</>
|
||||
) : null}
|
||||
</span>
|
||||
{option.id === selectedValue ? (
|
||||
<CheckIcon className="size-3.5 shrink-0 text-blue-400" />
|
||||
) : null}
|
||||
</span>
|
||||
</MenuRadioItem>
|
||||
))}
|
||||
@@ -370,9 +367,6 @@ export const TraitsMenuContent = memo(function TraitsMenuContentImpl({
|
||||
<MenuRadioItem key={value} value={value} hideIndicator>
|
||||
<span className="flex w-full min-w-0 items-center justify-between gap-3">
|
||||
<span>{value === "on" ? "On" : "Off"}</span>
|
||||
{value === selectedValue ? (
|
||||
<CheckIcon className="size-3.5 shrink-0 text-blue-400" />
|
||||
) : null}
|
||||
</span>
|
||||
</MenuRadioItem>
|
||||
))}
|
||||
|
||||
@@ -28,7 +28,7 @@ function ConfiguredT3ConnectSidebarAvatar() {
|
||||
appearance={{
|
||||
elements: {
|
||||
avatarBox: "size-7",
|
||||
userButtonTrigger: "rounded-lg p-1 hover:bg-sidebar-accent",
|
||||
userButtonTrigger: "rounded-lg p-1 hover:bg-sidebar-row-hover",
|
||||
},
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -369,7 +369,7 @@ function formatDesktopSshConnectionError(error: unknown): string {
|
||||
return withoutTaggedErrorPrefix.trim() || fallback;
|
||||
}
|
||||
|
||||
const ENDPOINT_ROW_CLASSNAME = "border-t border-border/60 px-4 py-2.5 first:border-t-0 sm:px-5";
|
||||
const ENDPOINT_ROW_CLASSNAME = "rounded-xl px-3 py-2.5 sm:px-4";
|
||||
|
||||
type AccessSectionPresentation = "current" | "endpoint-rail";
|
||||
|
||||
@@ -379,10 +379,7 @@ function accessRowClassName(_presentation: AccessSectionPresentation) {
|
||||
|
||||
function endpointRowClassName(presentation: AccessSectionPresentation, isAvailable: boolean) {
|
||||
if (presentation === "endpoint-rail") {
|
||||
return cn(
|
||||
"relative border-t border-border/60 px-4 py-3 first:border-t-0 sm:px-5",
|
||||
!isAvailable && "bg-muted/20",
|
||||
);
|
||||
return cn("relative rounded-xl px-3 py-3 sm:px-4", !isAvailable && "bg-muted/15");
|
||||
}
|
||||
|
||||
return cn(ENDPOINT_ROW_CLASSNAME, !isAvailable && "bg-muted/24");
|
||||
@@ -1512,7 +1509,7 @@ const DesktopSshHostRow = memo(function DesktopSshHostRow({
|
||||
const buttonLabel = connectingHostAlias === target.alias ? "Adding…" : "Add environment";
|
||||
|
||||
return (
|
||||
<div className="border-t border-border/60 px-4 py-3 first:border-t-0 sm:px-5">
|
||||
<div className="rounded-xl px-3 py-3 sm:px-4">
|
||||
<div className={ITEM_ROW_INNER_CLASSNAME}>
|
||||
<div className="min-w-0 flex-1">
|
||||
<h3 className="truncate text-sm font-medium text-foreground">{target.alias}</h3>
|
||||
|
||||
@@ -531,7 +531,7 @@ export function ProviderInstanceCard({
|
||||
const titleHeadNode = (
|
||||
<>
|
||||
{titleIconNode}
|
||||
<h3 className="truncate text-[13px] font-semibold tracking-[-0.01em] text-foreground">
|
||||
<h3 className="truncate text-sm font-medium tracking-[-0.005em] text-foreground">
|
||||
{displayName}
|
||||
</h3>
|
||||
{String(instanceId) !== String(instance.driver) ? (
|
||||
@@ -578,7 +578,7 @@ export function ProviderInstanceCard({
|
||||
);
|
||||
|
||||
const authRowNode = (
|
||||
<p className="flex min-w-0 flex-wrap items-center gap-x-1 text-xs text-muted-foreground/80">
|
||||
<p className="flex min-w-0 flex-wrap items-center gap-x-1 text-[13px] leading-[1.45] text-muted-foreground/80">
|
||||
{hasAuthenticatedEmail ? (
|
||||
<>
|
||||
<span>Authenticated as</span>
|
||||
@@ -600,8 +600,8 @@ export function ProviderInstanceCard({
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<div className="border-t border-border/60 first:border-t-0">
|
||||
<div className="px-4 py-3.5 sm:px-5">
|
||||
<div className="rounded-xl transition-colors hover:bg-muted/20">
|
||||
<div className="px-3 py-3 sm:px-4">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||
@@ -729,8 +729,8 @@ export function ProviderInstanceCard({
|
||||
|
||||
<Collapsible open={isExpanded} onOpenChange={onExpandedChange}>
|
||||
<CollapsibleContent>
|
||||
<div className="space-y-0">
|
||||
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
|
||||
<div className="space-y-5 px-3 pb-4 pt-2 sm:px-4">
|
||||
<div>
|
||||
<label htmlFor={`provider-instance-${instanceId}-display-name`} className="block">
|
||||
<span className="text-xs font-medium text-foreground">Display name</span>
|
||||
<DraftInput
|
||||
@@ -747,7 +747,7 @@ export function ProviderInstanceCard({
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
|
||||
<div>
|
||||
<ProviderAccentColorPicker
|
||||
displayName={displayName}
|
||||
value={accentColor}
|
||||
@@ -757,7 +757,7 @@ export function ProviderInstanceCard({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
|
||||
<div>
|
||||
<ProviderEnvironmentSection
|
||||
environment={instance.environment ?? []}
|
||||
onChange={updateEnvironment}
|
||||
@@ -789,7 +789,7 @@ export function ProviderInstanceCard({
|
||||
onModelOrderChange={onModelOrderChange}
|
||||
/>
|
||||
) : (
|
||||
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
This instance uses a driver (
|
||||
<code className="text-foreground">{String(instance.driver)}</code>) that is not
|
||||
|
||||
@@ -185,7 +185,7 @@ export function ProviderModelsSection({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="border-t border-border/60 px-4 py-3 sm:px-5">
|
||||
<div>
|
||||
<div className="text-xs font-medium text-foreground">Models</div>
|
||||
<div className="mt-1 text-xs text-muted-foreground">
|
||||
{models.length} model{models.length === 1 ? "" : "s"} available.
|
||||
|
||||
@@ -167,7 +167,7 @@ function FieldFrame(props: {
|
||||
readonly children: ReactNode;
|
||||
}) {
|
||||
if (props.variant === "card") {
|
||||
return <div className="border-t border-border/60 px-4 py-3 sm:px-5">{props.children}</div>;
|
||||
return <div>{props.children}</div>;
|
||||
}
|
||||
return <div className="grid gap-1.5">{props.children}</div>;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
SidebarMenu,
|
||||
SidebarMenuButton,
|
||||
SidebarMenuItem,
|
||||
SidebarSeparator,
|
||||
useSidebar,
|
||||
} from "../ui/sidebar";
|
||||
import { T3ConnectSidebarAvatar, T3ConnectSidebarSignIn } from "../clerk/T3ConnectSidebarSignIn";
|
||||
@@ -85,16 +84,16 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
isActive={isActive}
|
||||
className={
|
||||
isActive
|
||||
? "gap-2.5 px-2.5 py-2 text-left text-[13px] font-medium text-foreground"
|
||||
: "gap-2.5 px-2.5 py-2 text-left text-[13px] text-muted-foreground/70 hover:text-foreground/80"
|
||||
? "h-8 items-center gap-2 rounded-md bg-sidebar-row-active px-2 py-1.5 text-left text-sm font-medium text-sidebar-foreground"
|
||||
: "h-8 items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
|
||||
}
|
||||
onClick={() => handleSectionClick(item.to)}
|
||||
>
|
||||
<Icon
|
||||
className={
|
||||
isActive
|
||||
? "size-4 shrink-0 text-foreground"
|
||||
: "size-4 shrink-0 text-muted-foreground/60"
|
||||
? "size-4 shrink-0 text-sidebar-foreground"
|
||||
: "size-4 shrink-0 text-sidebar-muted-foreground/60"
|
||||
}
|
||||
/>
|
||||
<span className="truncate">{item.label}</span>
|
||||
@@ -105,8 +104,6 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
</SidebarMenu>
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
|
||||
<SidebarSeparator />
|
||||
<SidebarFooter className="p-2">
|
||||
<T3ConnectSidebarSignIn />
|
||||
<div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-1">
|
||||
@@ -114,7 +111,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton
|
||||
size="sm"
|
||||
className="gap-2 px-2 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground"
|
||||
className="h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
|
||||
onClick={handleBackClick}
|
||||
>
|
||||
<ArrowLeftIcon className="size-4" />
|
||||
|
||||
@@ -229,16 +229,16 @@ function DiscoveryItemRow({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"border-t border-border/60 first:border-t-0",
|
||||
"rounded-xl transition-colors hover:bg-muted/20",
|
||||
isVcsNotReady(item) && "opacity-80",
|
||||
)}
|
||||
>
|
||||
<div className="px-4 py-3.5 sm:px-5">
|
||||
<div className="px-3 py-3 sm:px-4">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||
<SourceControlItemMark item={item} />
|
||||
<span className="truncate text-[13px] font-semibold tracking-[-0.01em] text-foreground">
|
||||
<span className="truncate text-sm font-medium tracking-[-0.005em] text-foreground">
|
||||
{item.label}
|
||||
</span>
|
||||
{version ? <code className="text-xs text-muted-foreground">{version}</code> : null}
|
||||
@@ -253,7 +253,7 @@ function DiscoveryItemRow({
|
||||
</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="flex min-w-0 flex-wrap items-center gap-x-1 text-xs text-muted-foreground/80">
|
||||
<p className="flex min-w-0 flex-wrap items-center gap-x-1 text-[13px] leading-[1.45] text-muted-foreground/80">
|
||||
{itemSummary({ item, auth, authAccount })}
|
||||
</p>
|
||||
</div>
|
||||
@@ -282,7 +282,7 @@ function DiscoveryItemRow({
|
||||
{hasDetails ? (
|
||||
<Collapsible open={isExpanded} onOpenChange={setIsExpanded}>
|
||||
<CollapsibleContent>
|
||||
<div className="border-t border-border/60 px-4 py-3 sm:px-5">{children}</div>
|
||||
<div className="px-3 pb-4 pt-1 sm:px-4">{children}</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : null}
|
||||
@@ -368,7 +368,7 @@ function SourceControlSectionSkeleton({
|
||||
return (
|
||||
<SettingsSection title={title} headerAction={headerAction}>
|
||||
{SOURCE_CONTROL_SKELETON_ROWS.map((row) => (
|
||||
<div key={row} className="border-t border-border/60 px-4 py-3.5 first:border-t-0 sm:px-5">
|
||||
<div key={row} className="rounded-xl px-3 py-3 sm:px-4">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 flex-1 space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Direct row in the card – same pattern as the Provider / ACP-agent list rows. */
|
||||
export const ITEM_ROW_CLASSNAME = "border-t border-border/60 px-4 py-4 first:border-t-0 sm:px-5";
|
||||
/** Direct row in a settings section. Whitespace, rather than rules, separates peers. */
|
||||
export const ITEM_ROW_CLASSNAME = "rounded-xl px-3 py-3 sm:px-4";
|
||||
|
||||
export const ITEM_ROW_INNER_CLASSNAME =
|
||||
"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between";
|
||||
@@ -29,18 +29,15 @@ export function SettingsSection({
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section {...sectionProps} className={cn("space-y-2.5", className)}>
|
||||
<div className="flex items-center justify-between px-1">
|
||||
<h2 className="flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-foreground/50">
|
||||
<span className="inline-block h-px w-3 bg-border" aria-hidden />
|
||||
<section {...sectionProps} className={cn("space-y-3", className)}>
|
||||
<div className="flex min-h-8 items-center justify-between gap-4 px-3 sm:px-4">
|
||||
<h2 className="flex items-center gap-2 text-lg font-semibold tracking-[-0.025em] text-foreground">
|
||||
{icon}
|
||||
{title}
|
||||
</h2>
|
||||
<div className="flex h-5 min-w-5 items-center justify-end">{headerAction}</div>
|
||||
</div>
|
||||
<div className="relative overflow-visible rounded-2xl border bg-card text-card-foreground shadow-sm/4 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:shadow-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]">
|
||||
{children}
|
||||
<div className="flex min-h-7 min-w-7 items-center justify-end">{headerAction}</div>
|
||||
</div>
|
||||
<div className="relative space-y-1 overflow-visible text-foreground">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -65,24 +62,20 @@ export function SettingsRow({
|
||||
return (
|
||||
<div
|
||||
{...rowProps}
|
||||
className={cn(
|
||||
"border-t border-border/60 px-4 first:border-t-0 sm:px-5",
|
||||
children ? "pt-3.5 pb-0" : "py-3.5",
|
||||
className,
|
||||
)}
|
||||
className={cn("rounded-xl px-3 sm:px-4", children ? "pt-3 pb-1" : "py-3", className)}
|
||||
>
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-col gap-3 sm:grid sm:grid-cols-[minmax(0,1fr)_minmax(10rem,auto)] sm:items-center sm:gap-8">
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<div className="flex min-h-5 items-center gap-1.5">
|
||||
<h3 className="text-[13px] font-semibold tracking-[-0.01em] text-foreground">
|
||||
{title}
|
||||
</h3>
|
||||
<h3 className="text-sm font-medium tracking-[-0.005em] text-foreground">{title}</h3>
|
||||
<span className="inline-flex h-5 w-5 shrink-0 items-center justify-center">
|
||||
{resetAction}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground/80">{description}</p>
|
||||
{status ? <div className="pt-0.5 text-[11px] text-muted-foreground">{status}</div> : null}
|
||||
<p className="max-w-xl text-[13px] leading-[1.45] text-muted-foreground/80">
|
||||
{description}
|
||||
</p>
|
||||
{status ? <div className="pt-0.5 text-xs text-muted-foreground">{status}</div> : null}
|
||||
</div>
|
||||
{control ? (
|
||||
<div className="flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end">
|
||||
@@ -127,8 +120,8 @@ export function SettingsPageContainer({
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="scrollbar-gutter-both flex-1 overflow-y-auto p-6 sm:p-8">
|
||||
<div className={cn("mx-auto flex w-full max-w-3xl flex-col gap-8", className)}>
|
||||
<div className="scrollbar-gutter-both flex-1 overflow-y-auto px-4 py-7 sm:px-8 sm:py-10">
|
||||
<div className={cn("mx-auto flex w-full max-w-4xl flex-col gap-12", className)}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,8 @@ export const SidebarChromeHeader = memo(function SidebarChromeHeader({
|
||||
<SidebarTrigger
|
||||
className={cn(
|
||||
"relative z-10 md:hidden",
|
||||
backdropVariant && "hover:bg-white/15 [&_svg]:text-white/85! [&_svg]:hover:text-white!",
|
||||
backdropVariant &&
|
||||
"[:hover,[data-pressed]]:bg-white/15 focus-visible:ring-white/90 focus-visible:ring-offset-blue-700 [&_svg]:stroke-white/90! [&_svg]:opacity-100! [&_svg]:hover:stroke-white!",
|
||||
)}
|
||||
/>
|
||||
<SidebarBrand onBackdrop={backdropVariant !== null} />
|
||||
@@ -114,11 +115,11 @@ export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton
|
||||
size="sm"
|
||||
className="gap-2 px-2 py-1.5 text-muted-foreground/70 hover:bg-accent hover:text-foreground"
|
||||
className="h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
|
||||
onClick={handleSettingsClick}
|
||||
>
|
||||
<SettingsIcon className="size-3.5" />
|
||||
<span className="text-xs">Settings</span>
|
||||
<SettingsIcon className="size-4.5 shrink-0" />
|
||||
<span>Settings</span>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu>
|
||||
|
||||
@@ -40,7 +40,7 @@ const buttonVariants = cva(
|
||||
"border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
link: "border-transparent underline-offset-4 [:hover,[data-pressed]]:underline",
|
||||
outline:
|
||||
"border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
"border-transparent bg-popover not-dark:bg-clip-padding text-foreground shadow-none dark:bg-input/32 [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
secondary:
|
||||
"border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90",
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { Combobox as ComboboxPrimitive } from "@base-ui/react/combobox";
|
||||
import { CheckIcon, ChevronsUpDownIcon, XIcon } from "lucide-react";
|
||||
import { ChevronsUpDownIcon, XIcon } from "lucide-react";
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
@@ -170,7 +170,7 @@ function ComboboxPopup({
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
"relative flex max-h-full min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
||||
"dropdown-glass relative flex max-h-full min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) rounded-lg transition-[scale,opacity]",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
@@ -191,7 +191,7 @@ function ComboboxItem({
|
||||
className,
|
||||
contentClassName,
|
||||
children,
|
||||
hideIndicator = false,
|
||||
hideIndicator: _hideIndicator = false,
|
||||
...props
|
||||
}: ComboboxPrimitive.Item.Props & {
|
||||
contentClassName?: string;
|
||||
@@ -200,19 +200,15 @@ function ComboboxItem({
|
||||
return (
|
||||
<ComboboxPrimitive.Item
|
||||
className={cn(
|
||||
"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-selected:bg-accent/50 data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
"flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-selected:bg-foreground/[0.08] data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
className,
|
||||
)}
|
||||
data-slot="combobox-item"
|
||||
{...props}
|
||||
>
|
||||
<ComboboxPrimitive.ItemIndicator className={cn("col-start-1", hideIndicator && "hidden")}>
|
||||
<CheckIcon />
|
||||
</ComboboxPrimitive.ItemIndicator>
|
||||
<div
|
||||
className={cn(
|
||||
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
hideIndicator ? "col-start-1 col-span-full" : "col-start-2",
|
||||
"min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
contentClassName,
|
||||
)}
|
||||
data-slot="combobox-item-content"
|
||||
|
||||
@@ -30,7 +30,7 @@ function CommandDialogBackdrop({ className, ...props }: CommandDialogPrimitive.B
|
||||
return (
|
||||
<CommandDialogPrimitive.Backdrop
|
||||
className={cn(
|
||||
"fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
||||
"fixed inset-0 z-50 bg-black/40 transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
||||
className,
|
||||
)}
|
||||
data-slot="command-dialog-backdrop"
|
||||
@@ -66,7 +66,7 @@ function CommandDialogPopup({
|
||||
<CommandDialogViewport>
|
||||
<CommandDialogPrimitive.Popup
|
||||
className={cn(
|
||||
"pointer-events-auto -translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-105 min-h-0 w-full min-w-0 max-w-xl scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 outline-none transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
||||
"chat-composer-glass command-palette-glass pointer-events-auto -translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-105 min-h-0 w-full min-w-0 max-w-xl scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl text-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] outline-none transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1",
|
||||
className,
|
||||
)}
|
||||
data-slot="command-dialog-popup"
|
||||
@@ -108,7 +108,7 @@ function CommandInput({
|
||||
<AutocompleteInput
|
||||
autoFocus
|
||||
className={cn(
|
||||
"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0",
|
||||
"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0 placeholder:text-muted-foreground/80",
|
||||
className,
|
||||
)}
|
||||
placeholder={placeholder}
|
||||
@@ -144,7 +144,7 @@ function CommandPanel({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"-mx-px not-has-[+[data-slot=command-footer]]:-mb-px relative min-h-0 overflow-hidden rounded-t-xl not-has-[+[data-slot=command-footer]]:rounded-b-2xl border border-b-0 bg-popover bg-clip-padding shadow-xs/5 [clip-path:inset(0_1px)] not-has-[+[data-slot=command-footer]]:[clip-path:inset(0_1px_1px_1px_round_0_0_calc(var(--radius-2xl)-1px)_calc(var(--radius-2xl)-1px))] before:pointer-events-none before:absolute before:inset-0 before:rounded-t-[calc(var(--radius-xl)-1px)] **:data-[slot=scroll-area-scrollbar]:mt-2 [touch-action:pan-y]",
|
||||
"relative min-h-0 overflow-hidden rounded-t-xl not-has-[+[data-slot=command-footer]]:rounded-b-2xl bg-transparent **:data-[slot=scroll-area-scrollbar]:mt-2 [touch-action:pan-y]",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
@@ -171,7 +171,14 @@ function CommandCollection({ ...props }: React.ComponentProps<typeof Autocomplet
|
||||
|
||||
function CommandItem({ className, ...props }: React.ComponentProps<typeof AutocompleteItem>) {
|
||||
return (
|
||||
<AutocompleteItem className={cn("py-1.5", className)} data-slot="command-item" {...props} />
|
||||
<AutocompleteItem
|
||||
className={cn(
|
||||
"py-1.5 data-selected:bg-foreground/[0.06] data-highlighted:bg-foreground/[0.09] data-highlighted:text-foreground [&[data-highlighted][data-selected]]:bg-foreground/[0.09] [&[data-highlighted][data-selected]]:text-foreground",
|
||||
className,
|
||||
)}
|
||||
data-slot="command-item"
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -192,7 +199,7 @@ function CommandShortcut({ className, ...props }: React.ComponentProps<"kbd">) {
|
||||
return (
|
||||
<kbd
|
||||
className={cn(
|
||||
"ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest",
|
||||
"ms-auto font-medium font-sans text-muted-foreground text-xs tracking-widest",
|
||||
className,
|
||||
)}
|
||||
data-slot="command-shortcut"
|
||||
@@ -205,7 +212,7 @@ function CommandFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-2xl)-1px)] border-t px-5 py-3 text-muted-foreground text-xs",
|
||||
"relative flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-2xl)-1px)] bg-foreground/[0.025] px-5 py-3 font-medium text-sm text-muted-foreground [&_[data-slot=kbd-group]]:font-sans [&_[data-slot=kbd]]:bg-foreground/[0.08] [&_[data-slot=kbd]]:text-foreground [&_[data-slot=kbd]]:ring-0",
|
||||
className,
|
||||
)}
|
||||
data-slot="command-footer"
|
||||
|
||||
@@ -49,7 +49,7 @@ function MenuPopup({
|
||||
>
|
||||
<MenuPrimitive.Popup
|
||||
className={cn(
|
||||
"relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
||||
"dropdown-glass relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg outline-none focus:outline-none",
|
||||
className,
|
||||
)}
|
||||
data-slot="menu-popup"
|
||||
@@ -150,7 +150,7 @@ function MenuRadioGroup(props: MenuPrimitive.RadioGroup.Props) {
|
||||
function MenuRadioItem({
|
||||
className,
|
||||
children,
|
||||
hideIndicator = false,
|
||||
hideIndicator: _hideIndicator = false,
|
||||
...props
|
||||
}: MenuPrimitive.RadioItem.Props & {
|
||||
hideIndicator?: boolean;
|
||||
@@ -158,31 +158,13 @@ function MenuRadioItem({
|
||||
return (
|
||||
<MenuPrimitive.RadioItem
|
||||
className={cn(
|
||||
"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
hideIndicator ? "grid-cols-[1fr] ps-3 pe-3" : "grid-cols-[1rem_1fr] ps-2 pe-4",
|
||||
"flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center rounded-sm px-2 py-1 text-base text-foreground outline-none data-checked:bg-foreground/[0.08] data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
className,
|
||||
)}
|
||||
data-slot="menu-radio-item"
|
||||
{...props}
|
||||
>
|
||||
{hideIndicator ? null : (
|
||||
<MenuPrimitive.RadioItemIndicator className="col-start-1">
|
||||
<svg
|
||||
fill="none"
|
||||
height="24"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
viewBox="0 0 24 24"
|
||||
width="24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M5.252 12.7 10.2 18.63 18.748 5.37" />
|
||||
</svg>
|
||||
</MenuPrimitive.RadioItemIndicator>
|
||||
)}
|
||||
<span className={hideIndicator ? "col-start-1" : "col-start-2"}>{children}</span>
|
||||
<span className="min-w-0 flex-1">{children}</span>
|
||||
</MenuPrimitive.RadioItem>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ function SelectPopup({
|
||||
</SelectPrimitive.ScrollUpArrow>
|
||||
<div
|
||||
className={cn(
|
||||
"relative h-full rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
||||
"dropdown-glass relative h-full rounded-lg",
|
||||
matchTriggerWidth && "min-w-(--anchor-width)",
|
||||
popupClassName,
|
||||
)}
|
||||
@@ -177,7 +177,7 @@ function SelectPopup({
|
||||
function SelectItem({
|
||||
className,
|
||||
children,
|
||||
hideIndicator = false,
|
||||
hideIndicator: _hideIndicator = false,
|
||||
...props
|
||||
}: SelectPrimitive.Item.Props & {
|
||||
hideIndicator?: boolean;
|
||||
@@ -185,35 +185,14 @@ function SelectItem({
|
||||
return (
|
||||
<SelectPrimitive.Item
|
||||
className={cn(
|
||||
"grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
hideIndicator ? "grid-cols-[1fr] ps-3 pe-3" : "grid-cols-[1rem_1fr] ps-2 pe-4",
|
||||
"flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center rounded-sm px-2 py-1 text-base outline-none data-selected:bg-foreground/[0.08] data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
||||
className,
|
||||
)}
|
||||
data-slot="select-item"
|
||||
{...props}
|
||||
>
|
||||
{hideIndicator ? null : (
|
||||
<SelectPrimitive.ItemIndicator className="col-start-1" data-slot="select-item-indicator">
|
||||
<svg
|
||||
fill="none"
|
||||
height="24"
|
||||
stroke="currentColor"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
viewBox="0 0 24 24"
|
||||
width="24"
|
||||
xmlns="http://www.w3.org/1500/svg"
|
||||
>
|
||||
<path d="M5.252 12.7 10.2 18.63 18.748 5.37" />
|
||||
</svg>
|
||||
</SelectPrimitive.ItemIndicator>
|
||||
)}
|
||||
<SelectPrimitive.ItemText
|
||||
className={cn(
|
||||
"min-w-0 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
hideIndicator ? "col-start-1" : "col-start-2",
|
||||
)}
|
||||
className="min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground"
|
||||
data-slot="select-item-text"
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -676,7 +676,7 @@ function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
|
||||
return (
|
||||
<Separator
|
||||
className={cn("mx-2 w-auto bg-sidebar-border", className)}
|
||||
className={cn("mx-2 w-auto! bg-sidebar-border", className)}
|
||||
data-sidebar="separator"
|
||||
data-slot="sidebar-separator"
|
||||
{...props}
|
||||
@@ -732,7 +732,7 @@ function SidebarGroupLabel({ className, render, ...props }: useRender.ComponentP
|
||||
function SidebarGroupAction({ className, render, ...props }: useRender.ComponentProps<"button">) {
|
||||
const defaultProps = {
|
||||
className: cn(
|
||||
"absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
|
||||
"absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-ring transition-transform hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
|
||||
// Increases the hit area of the button on mobile.
|
||||
"after:-inset-2 after:absolute md:after:hidden",
|
||||
"group-data-[collapsible=icon]:hidden",
|
||||
@@ -783,7 +783,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
||||
}
|
||||
|
||||
const sidebarMenuButtonVariants = cva(
|
||||
"peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
|
||||
"peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-ring transition-[width,height,padding] hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-row-selected data-[active=true]:font-medium data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-row-hover data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
|
||||
{
|
||||
defaultVariants: {
|
||||
size: "default",
|
||||
@@ -796,9 +796,9 @@ const sidebarMenuButtonVariants = cva(
|
||||
sm: "h-7 text-xs",
|
||||
},
|
||||
variant: {
|
||||
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
||||
default: "hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
|
||||
outline:
|
||||
"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
|
||||
"bg-sidebar-control-surface ring-1 ring-sidebar-border hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -867,7 +867,7 @@ function SidebarMenuAction({
|
||||
}) {
|
||||
const defaultProps = {
|
||||
className: cn(
|
||||
"absolute top-1.5 right-1 flex aspect-square w-5 cursor-pointer items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
|
||||
"absolute top-1.5 right-1 flex aspect-square w-5 cursor-pointer items-center justify-center rounded-lg p-0 text-sidebar-foreground outline-hidden ring-ring transition-transform hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-foreground [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",
|
||||
// Increases the hit area of the button on mobile.
|
||||
"after:-inset-2 after:absolute md:after:hidden",
|
||||
"peer-data-[size=sm]/menu-button:top-1",
|
||||
@@ -875,7 +875,7 @@ function SidebarMenuAction({
|
||||
"peer-data-[size=lg]/menu-button:top-2.5",
|
||||
"group-data-[collapsible=icon]:hidden",
|
||||
showOnHover &&
|
||||
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
|
||||
"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-foreground md:opacity-0",
|
||||
className,
|
||||
),
|
||||
"data-sidebar": "menu-action",
|
||||
@@ -894,7 +894,7 @@ function SidebarMenuBadge({ className, ...props }: React.ComponentProps<"div">)
|
||||
<div
|
||||
className={cn(
|
||||
"pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-lg px-1 font-medium text-sidebar-foreground text-xs tabular-nums",
|
||||
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
||||
"peer-hover/menu-button:text-sidebar-foreground peer-data-[active=true]/menu-button:text-sidebar-foreground",
|
||||
"peer-data-[size=sm]/menu-button:top-1",
|
||||
"peer-data-[size=default]/menu-button:top-1.5",
|
||||
"peer-data-[size=lg]/menu-button:top-2.5",
|
||||
@@ -979,8 +979,8 @@ function SidebarMenuSubButton({
|
||||
}) {
|
||||
const defaultProps = {
|
||||
className: cn(
|
||||
"-translate-x-px flex h-7 min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
|
||||
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
||||
"-translate-x-px flex h-7 min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-lg px-2 text-sidebar-foreground outline-hidden ring-ring hover:bg-sidebar-row-hover hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-row-active active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-muted-foreground",
|
||||
"data-[active=true]:bg-sidebar-row-selected data-[active=true]:text-sidebar-foreground",
|
||||
size === "sm" && "text-xs",
|
||||
size === "md" && "text-sm",
|
||||
"group-data-[collapsible=icon]:hidden",
|
||||
|
||||
+169
-41
@@ -143,6 +143,15 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
--color-card: var(--card);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-background: var(--background);
|
||||
--color-surface-raised: var(--surface-raised);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-muted-foreground: var(--sidebar-muted-foreground);
|
||||
--color-sidebar-control-surface: var(--sidebar-control-surface);
|
||||
--color-sidebar-row-hover: var(--sidebar-row-hover);
|
||||
--color-sidebar-row-active: var(--sidebar-row-active);
|
||||
--color-sidebar-row-selected: var(--sidebar-row-selected);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
@@ -293,6 +302,46 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Fade rows themselves as they pass beneath the top chrome. A mask remains
|
||||
visible even when the header and timeline share the same background. */
|
||||
.chat-timeline-scroll-fade {
|
||||
--timeline-top-fade-height: 2.5rem;
|
||||
-webkit-mask-image:
|
||||
linear-gradient(
|
||||
to bottom,
|
||||
transparent 0%,
|
||||
rgb(0 0 0 / 10%) 10%,
|
||||
rgb(0 0 0 / 30%) 24%,
|
||||
rgb(0 0 0 / 58%) 42%,
|
||||
rgb(0 0 0 / 82%) 62%,
|
||||
rgb(0 0 0 / 96%) 82%,
|
||||
black 100%
|
||||
),
|
||||
linear-gradient(black, black);
|
||||
-webkit-mask-position: top, bottom;
|
||||
-webkit-mask-repeat: no-repeat;
|
||||
-webkit-mask-size:
|
||||
100% var(--timeline-top-fade-height),
|
||||
100% calc(100% - var(--timeline-top-fade-height));
|
||||
mask-image:
|
||||
linear-gradient(
|
||||
to bottom,
|
||||
transparent 0%,
|
||||
rgb(0 0 0 / 10%) 10%,
|
||||
rgb(0 0 0 / 30%) 24%,
|
||||
rgb(0 0 0 / 58%) 42%,
|
||||
rgb(0 0 0 / 82%) 62%,
|
||||
rgb(0 0 0 / 96%) 82%,
|
||||
black 100%
|
||||
),
|
||||
linear-gradient(black, black);
|
||||
mask-position: top, bottom;
|
||||
mask-repeat: no-repeat;
|
||||
mask-size:
|
||||
100% var(--timeline-top-fade-height),
|
||||
100% calc(100% - var(--timeline-top-fade-height));
|
||||
}
|
||||
|
||||
.workspace-titlebar-controls {
|
||||
position: absolute;
|
||||
top: var(--workspace-controls-top);
|
||||
@@ -313,40 +362,75 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
}
|
||||
|
||||
.chat-composer-glass {
|
||||
background: color-mix(in srgb, var(--card) 20%, transparent);
|
||||
}
|
||||
|
||||
/* Mix from --background (not --card): the lower chrome is a full-width
|
||||
strip over the main view, and a card-tinted wash reads as a lighter
|
||||
seam against it when no content is scrolled underneath. The backdrop
|
||||
blur, not the tint, carries the frosted effect. */
|
||||
.chat-composer-lower-chrome {
|
||||
background: color-mix(in srgb, var(--background) 20%, transparent);
|
||||
}
|
||||
|
||||
.chat-composer-glass {
|
||||
box-shadow:
|
||||
0 18px 48px -20px rgb(0 0 0 / 28%),
|
||||
0 4px 14px -7px rgb(0 0 0 / 22%);
|
||||
}
|
||||
|
||||
.chat-composer-shared-blur {
|
||||
background: var(--secondary);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.dark .chat-composer-glass {
|
||||
.chat-composer-context-strip {
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
.chat-composer-context-strip::before {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
inset: 0;
|
||||
border-radius: 0 0 16px 16px;
|
||||
background: color-mix(in srgb, var(--card) 20%, transparent);
|
||||
box-shadow: 0 12px 28px -18px rgb(0 0 0 / 40%);
|
||||
content: "";
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.dropdown-glass {
|
||||
background: var(--secondary);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
backdrop-filter: blur(16px);
|
||||
box-shadow: 0 16px 40px -18px rgb(0 0 0 / 55%);
|
||||
}
|
||||
|
||||
.command-palette-glass {
|
||||
box-shadow: 0 24px 64px -24px rgb(0 0 0 / 65%);
|
||||
}
|
||||
|
||||
.command-menu-surface {
|
||||
background: var(--popover);
|
||||
-webkit-backdrop-filter: none;
|
||||
backdrop-filter: none;
|
||||
box-shadow: 0 24px 64px -24px rgb(0 0 0 / 65%);
|
||||
}
|
||||
|
||||
.workflow-dialog-surface {
|
||||
border-color: transparent;
|
||||
background: color-mix(in srgb, var(--popover) 82%, transparent);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
backdrop-filter: blur(16px);
|
||||
box-shadow: 0 24px 64px -24px rgb(0 0 0 / 65%);
|
||||
}
|
||||
|
||||
.dark .dropdown-glass {
|
||||
box-shadow: 0 18px 44px -18px rgb(0 0 0 / 80%);
|
||||
}
|
||||
|
||||
.dark .model-picker-surface.model-picker-surface {
|
||||
background: color-mix(in srgb, var(--background) 90%, transparent);
|
||||
}
|
||||
|
||||
.dark .command-menu-surface,
|
||||
.dark .command-palette-glass,
|
||||
.dark .workflow-dialog-surface {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.dark .workflow-dialog-surface {
|
||||
background: color-mix(in srgb, var(--popover) 76%, transparent);
|
||||
}
|
||||
|
||||
.dark .chat-composer-context-strip::before {
|
||||
background: color-mix(in srgb, var(--card) 45%, transparent);
|
||||
}
|
||||
|
||||
.dark .chat-composer-lower-chrome {
|
||||
background: color-mix(in srgb, var(--background) 45%, transparent);
|
||||
}
|
||||
|
||||
.dark .chat-composer-glass {
|
||||
box-shadow:
|
||||
0 18px 48px -20px rgb(0 0 0 / 60%),
|
||||
0 4px 14px -7px rgb(0 0 0 / 40%);
|
||||
box-shadow: 0 14px 32px -18px rgb(0 0 0 / 75%);
|
||||
}
|
||||
|
||||
.chat-composer-lower-chrome {
|
||||
@@ -356,6 +440,10 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
}
|
||||
|
||||
@media (min-width: 40rem) {
|
||||
.chat-timeline-scroll-fade {
|
||||
--timeline-top-fade-height: 3rem;
|
||||
}
|
||||
|
||||
.chat-composer-horizontal-inset {
|
||||
padding-inline-start: calc(env(safe-area-inset-left) + 1.25rem);
|
||||
padding-inline-end: calc(env(safe-area-inset-right) + 1.25rem);
|
||||
@@ -364,11 +452,19 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
|
||||
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
|
||||
.chat-composer-glass {
|
||||
background: var(--secondary);
|
||||
}
|
||||
|
||||
.chat-composer-context-strip::before {
|
||||
background: var(--card);
|
||||
}
|
||||
|
||||
.chat-composer-lower-chrome {
|
||||
background: var(--background);
|
||||
.dropdown-glass {
|
||||
background: color-mix(in srgb, var(--popover) 88%, black);
|
||||
}
|
||||
|
||||
.workflow-dialog-surface {
|
||||
background: var(--popover);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,6 +508,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
--radius: 0.625rem;
|
||||
--background: var(--color-white);
|
||||
--app-chrome-background: var(--background);
|
||||
--surface-raised: var(--secondary);
|
||||
--foreground: var(--color-neutral-800);
|
||||
--card: var(--color-white);
|
||||
--card-foreground: var(--color-neutral-800);
|
||||
@@ -436,15 +533,28 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
--success-foreground: var(--color-emerald-700);
|
||||
--warning: var(--color-amber-500);
|
||||
--warning-foreground: var(--color-amber-700);
|
||||
/* Fallbacks for standalone sidebar primitives. App sidebars override these
|
||||
roles on their own root so the surface hierarchy stays out of page content. */
|
||||
--sidebar: var(--card);
|
||||
--sidebar-foreground: var(--foreground);
|
||||
--sidebar-muted-foreground: var(--muted-foreground);
|
||||
--sidebar-control-surface: var(--accent);
|
||||
--sidebar-row-hover: var(--accent);
|
||||
--sidebar-row-active: var(--accent);
|
||||
--sidebar-row-selected: var(--muted);
|
||||
--sidebar-border: var(--border);
|
||||
|
||||
@variant dark {
|
||||
color-scheme: dark;
|
||||
--background: color-mix(in srgb, var(--color-neutral-950) 95%, var(--color-white));
|
||||
/* Keep the workspace in the same neutral-black family as sidebar v2.
|
||||
Surfaces lift from this base instead of starting from a milky gray. */
|
||||
--background: var(--color-neutral-950);
|
||||
--app-chrome-background: var(--background);
|
||||
--surface-raised: var(--secondary);
|
||||
--foreground: var(--color-neutral-100);
|
||||
--card: color-mix(in srgb, var(--background) 98%, var(--color-white));
|
||||
--card: color-mix(in srgb, var(--background) 97%, var(--color-white));
|
||||
--card-foreground: var(--color-neutral-100);
|
||||
--popover: color-mix(in srgb, var(--background) 98%, var(--color-white));
|
||||
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
|
||||
--popover-foreground: var(--color-neutral-100);
|
||||
--primary: oklch(0.588 0.217 264);
|
||||
--primary-foreground: var(--color-white);
|
||||
@@ -468,10 +578,11 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
}
|
||||
}
|
||||
|
||||
/* Give the navigation rail its own cool graphite surface instead of borrowing
|
||||
the workspace card color. The scoped semantic tokens keep sidebar v2's
|
||||
controls in the same palette without changing v1 or the settings nav. */
|
||||
.app-sidebar {
|
||||
/* Give both navigation implementations the same cool graphite surface. The
|
||||
version attribute remains useful for layout-specific styling, but color is
|
||||
shared so switching the beta does not switch visual systems. */
|
||||
[data-sidebar-version="v1"],
|
||||
[data-sidebar-version="v2"] {
|
||||
--background: oklch(0.965 0.009 265);
|
||||
--foreground: oklch(0.27 0.025 265);
|
||||
--card: oklch(0.945 0.014 265);
|
||||
@@ -482,11 +593,20 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
--muted-foreground: oklch(0.49 0.03 265);
|
||||
--border: oklch(0.72 0.025 265 / 28%);
|
||||
--input: oklch(0.62 0.03 265 / 28%);
|
||||
--sidebar-stage-fade: var(--card);
|
||||
--sidebar: var(--card);
|
||||
--sidebar-foreground: var(--foreground);
|
||||
--sidebar-muted-foreground: var(--muted-foreground);
|
||||
--sidebar-control-surface: var(--muted);
|
||||
--sidebar-row-hover: color-mix(in srgb, var(--foreground) 6%, transparent);
|
||||
--sidebar-row-active: color-mix(in srgb, var(--foreground) 11%, transparent);
|
||||
--sidebar-row-selected: color-mix(in srgb, var(--foreground) 7%, transparent);
|
||||
--sidebar-border: var(--border);
|
||||
--sidebar-stage-fade: var(--sidebar);
|
||||
background-color: var(--card);
|
||||
}
|
||||
|
||||
.dark .app-sidebar {
|
||||
.dark [data-sidebar-version="v1"],
|
||||
.dark [data-sidebar-version="v2"] {
|
||||
--background: #000;
|
||||
--foreground: #f1f3f7;
|
||||
--card: #000;
|
||||
@@ -495,8 +615,16 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
--accent-foreground: #f7f9ff;
|
||||
--muted: #0a0a0a;
|
||||
--muted-foreground: #a3a3a3;
|
||||
--border: rgb(255 255 255 / 14%);
|
||||
--border: rgb(255 255 255 / 8%);
|
||||
--input: rgb(255 255 255 / 18%);
|
||||
--sidebar: var(--card);
|
||||
--sidebar-foreground: var(--foreground);
|
||||
--sidebar-muted-foreground: var(--muted-foreground);
|
||||
--sidebar-control-surface: var(--muted);
|
||||
--sidebar-row-hover: color-mix(in srgb, var(--foreground) 8%, transparent);
|
||||
--sidebar-row-active: color-mix(in srgb, var(--foreground) 11%, transparent);
|
||||
--sidebar-row-selected: color-mix(in srgb, var(--foreground) 7%, transparent);
|
||||
--sidebar-border: var(--border);
|
||||
/* The stage-channel header art must ramp to THIS panel's surface, not the
|
||||
global chrome background, or the fade shows a seam (same rule as the
|
||||
light palette above). */
|
||||
|
||||
@@ -22,7 +22,7 @@ function RestoreDefaultsButton({ onRestored }: { onRestored: () => void }) {
|
||||
return (
|
||||
<Button
|
||||
size="xs"
|
||||
variant="outline"
|
||||
variant="ghost"
|
||||
disabled={changedSettingLabels.length === 0}
|
||||
onClick={() => void restoreDefaults()}
|
||||
>
|
||||
@@ -68,7 +68,7 @@ function SettingsContentLayout() {
|
||||
{!isElectron && (
|
||||
<header
|
||||
className={cn(
|
||||
"border-b border-border px-3 py-2 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none sm:px-5",
|
||||
"px-3 py-2 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none sm:px-5",
|
||||
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
|
||||
)}
|
||||
>
|
||||
@@ -86,7 +86,7 @@ function SettingsContentLayout() {
|
||||
{isElectron && (
|
||||
<div
|
||||
className={cn(
|
||||
"drag-region flex h-[52px] shrink-0 items-center border-b border-border px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]",
|
||||
"drag-region flex h-[52px] shrink-0 items-center px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]",
|
||||
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
|
||||
)}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user