feat(web): add configurable sidebar thread preview count (#1856)
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: codex <[email protected]> Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
11 files changed
+308
-33
No files matched your search
@@ -347,4 +347,3 @@ Each implementation PR should run:
|
||||
- `bun typecheck`
|
||||
- focused tests for changed backend/web behavior
|
||||
- backend tests for any server-side endpoint discovery or auth changes using `bun run test`, never `bun test`
|
||||
|
||||
@@ -63,6 +63,7 @@ const clientSettings: ClientSettings = {
|
||||
},
|
||||
sidebarProjectSortOrder: "manual",
|
||||
sidebarThreadSortOrder: "created_at",
|
||||
sidebarThreadPreviewCount: 6,
|
||||
timestampFormat: "24-hour",
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"test:browser:install": "playwright install --with-deps chromium"
|
||||
},
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.2.0",
|
||||
"@base-ui/react": "^1.4.1",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
|
||||
@@ -54,7 +54,10 @@ import {
|
||||
} from "@t3tools/client-runtime";
|
||||
import { Link, useLocation, useNavigate, useParams, useRouter } from "@tanstack/react-router";
|
||||
import {
|
||||
MAX_SIDEBAR_THREAD_PREVIEW_COUNT,
|
||||
MIN_SIDEBAR_THREAD_PREVIEW_COUNT,
|
||||
type SidebarProjectSortOrder,
|
||||
type SidebarThreadPreviewCount,
|
||||
type SidebarThreadSortOrder,
|
||||
} from "@t3tools/contracts/settings";
|
||||
import { usePrimaryEnvironmentId } from "../environments/primary";
|
||||
@@ -128,6 +131,13 @@ import {
|
||||
MenuSeparator,
|
||||
MenuTrigger,
|
||||
} from "./ui/menu";
|
||||
import {
|
||||
NumberField,
|
||||
NumberFieldDecrement,
|
||||
NumberFieldGroup,
|
||||
NumberFieldIncrement,
|
||||
NumberFieldInput,
|
||||
} from "./ui/number-field";
|
||||
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "./ui/select";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
|
||||
import {
|
||||
@@ -186,7 +196,6 @@ import {
|
||||
type SidebarProjectSnapshot,
|
||||
} from "../sidebarProjectGrouping";
|
||||
import { SidebarProviderUpdatePill } from "./sidebar/SidebarProviderUpdatePill";
|
||||
const THREAD_PREVIEW_LIMIT = 6;
|
||||
const SIDEBAR_SORT_LABELS: Record<SidebarProjectSortOrder, string> = {
|
||||
updated_at: "Last user message",
|
||||
created_at: "Created at",
|
||||
@@ -207,6 +216,13 @@ const PROJECT_GROUPING_MODE_LABELS: Record<SidebarProjectGroupingMode, string> =
|
||||
separate: "Keep separate",
|
||||
};
|
||||
|
||||
function clampSidebarThreadPreviewCount(value: number): SidebarThreadPreviewCount {
|
||||
return Math.min(
|
||||
MAX_SIDEBAR_THREAD_PREVIEW_COUNT,
|
||||
Math.max(MIN_SIDEBAR_THREAD_PREVIEW_COUNT, value),
|
||||
) as SidebarThreadPreviewCount;
|
||||
}
|
||||
|
||||
function formatProjectMemberActionLabel(
|
||||
member: SidebarProjectGroupMember,
|
||||
groupedProjectCount: number,
|
||||
@@ -936,6 +952,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides,
|
||||
}));
|
||||
const { updateSettings } = useUpdateSettings();
|
||||
const sidebarThreadPreviewCount = useSettings<SidebarThreadPreviewCount>(
|
||||
(settings) => settings.sidebarThreadPreviewCount,
|
||||
);
|
||||
const router = useRouter();
|
||||
const { isMobile, setOpenMobile } = useSidebar();
|
||||
const markThreadUnread = useUiStateStore((state) => state.markThreadUnread);
|
||||
@@ -1159,11 +1178,11 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
},
|
||||
});
|
||||
};
|
||||
const hasOverflowingThreads = visibleProjectThreads.length > THREAD_PREVIEW_LIMIT;
|
||||
const hasOverflowingThreads = visibleProjectThreads.length > sidebarThreadPreviewCount;
|
||||
const previewThreads =
|
||||
isThreadListExpanded || !hasOverflowingThreads
|
||||
? visibleProjectThreads
|
||||
: visibleProjectThreads.slice(0, THREAD_PREVIEW_LIMIT);
|
||||
: visibleProjectThreads.slice(0, sidebarThreadPreviewCount);
|
||||
const visibleThreadKeys = new Set(
|
||||
[...previewThreads, ...(pinnedCollapsedThread ? [pinnedCollapsedThread] : [])].map((thread) =>
|
||||
scopedThreadKey(scopeThreadRef(thread.environmentId, thread.id)),
|
||||
@@ -1192,6 +1211,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
pinnedCollapsedThread,
|
||||
projectExpanded,
|
||||
projectThreads,
|
||||
sidebarThreadPreviewCount,
|
||||
threadLastVisitedAts,
|
||||
visibleProjectThreads,
|
||||
]);
|
||||
@@ -2253,17 +2273,35 @@ function ProjectSortMenu({
|
||||
projectSortOrder,
|
||||
threadSortOrder,
|
||||
projectGroupingMode,
|
||||
threadPreviewCount,
|
||||
onProjectSortOrderChange,
|
||||
onThreadSortOrderChange,
|
||||
onProjectGroupingModeChange,
|
||||
onThreadPreviewCountChange,
|
||||
}: {
|
||||
projectSortOrder: SidebarProjectSortOrder;
|
||||
threadSortOrder: SidebarThreadSortOrder;
|
||||
projectGroupingMode: SidebarProjectGroupingMode;
|
||||
threadPreviewCount: SidebarThreadPreviewCount;
|
||||
onProjectSortOrderChange: (sortOrder: SidebarProjectSortOrder) => void;
|
||||
onThreadSortOrderChange: (sortOrder: SidebarThreadSortOrder) => void;
|
||||
onProjectGroupingModeChange: (mode: SidebarProjectGroupingMode) => void;
|
||||
onThreadPreviewCountChange: (count: SidebarThreadPreviewCount) => void;
|
||||
}) {
|
||||
const handleThreadPreviewCountChange = useCallback(
|
||||
(nextValue: number | null) => {
|
||||
if (nextValue === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const clampedValue = clampSidebarThreadPreviewCount(nextValue);
|
||||
if (clampedValue !== threadPreviewCount) {
|
||||
onThreadPreviewCountChange(clampedValue);
|
||||
}
|
||||
},
|
||||
[onThreadPreviewCountChange, threadPreviewCount],
|
||||
);
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<Tooltip>
|
||||
@@ -2274,9 +2312,9 @@ function ProjectSortMenu({
|
||||
>
|
||||
<ArrowUpDownIcon className="size-3.5" />
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="right">Sort projects</TooltipPopup>
|
||||
<TooltipPopup side="right">Sidebar options</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MenuPopup align="end" side="bottom" className="min-w-44">
|
||||
<MenuPopup align="end" side="bottom" className="min-w-52">
|
||||
<MenuGroup>
|
||||
<div className="px-2 py-1 sm:text-xs font-medium text-muted-foreground">
|
||||
Sort projects
|
||||
@@ -2315,6 +2353,42 @@ function ProjectSortMenu({
|
||||
))}
|
||||
</MenuRadioGroup>
|
||||
</MenuGroup>
|
||||
<MenuGroup>
|
||||
<div className="px-2 pt-2 pb-1 text-muted-foreground sm:text-xs font-medium">
|
||||
Visible threads
|
||||
</div>
|
||||
<div className="px-2 py-1">
|
||||
<NumberField
|
||||
aria-label="Visible thread count"
|
||||
className="w-28 gap-0"
|
||||
max={MAX_SIDEBAR_THREAD_PREVIEW_COUNT}
|
||||
min={MIN_SIDEBAR_THREAD_PREVIEW_COUNT}
|
||||
onValueChange={handleThreadPreviewCountChange}
|
||||
size="sm"
|
||||
step={1}
|
||||
value={threadPreviewCount}
|
||||
>
|
||||
<NumberFieldGroup className="h-7 rounded-md sm:h-6.5">
|
||||
<NumberFieldDecrement
|
||||
aria-label="Decrease visible thread count"
|
||||
className="px-2 sm:px-2 [&_svg]:size-3.5"
|
||||
/>
|
||||
<NumberFieldInput
|
||||
aria-label="Visible thread count"
|
||||
className="h-7 w-9 grow-0 px-0 text-xs leading-7 sm:h-6.5 sm:leading-6.5"
|
||||
inputMode="numeric"
|
||||
onKeyDownCapture={(event) => {
|
||||
event.stopPropagation();
|
||||
}}
|
||||
/>
|
||||
<NumberFieldIncrement
|
||||
aria-label="Increase visible thread count"
|
||||
className="px-2 sm:px-2 [&_svg]:size-3.5"
|
||||
/>
|
||||
</NumberFieldGroup>
|
||||
</NumberField>
|
||||
</div>
|
||||
</MenuGroup>
|
||||
<MenuSeparator />
|
||||
<MenuGroup>
|
||||
<div className="px-2 pt-2 pb-1 font-medium text-muted-foreground sm:text-xs">
|
||||
@@ -2462,6 +2536,7 @@ interface SidebarProjectsContentProps {
|
||||
projectSortOrder: SidebarProjectSortOrder;
|
||||
threadSortOrder: SidebarThreadSortOrder;
|
||||
projectGroupingMode: SidebarProjectGroupingMode;
|
||||
threadPreviewCount: SidebarThreadPreviewCount;
|
||||
updateSettings: ReturnType<typeof useUpdateSettings>["updateSettings"];
|
||||
openAddProject: () => void;
|
||||
isManualProjectSorting: boolean;
|
||||
@@ -2502,6 +2577,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
projectSortOrder,
|
||||
threadSortOrder,
|
||||
projectGroupingMode,
|
||||
threadPreviewCount,
|
||||
updateSettings,
|
||||
openAddProject,
|
||||
isManualProjectSorting,
|
||||
@@ -2548,6 +2624,12 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
},
|
||||
[updateSettings],
|
||||
);
|
||||
const handleThreadPreviewCountChange = useCallback(
|
||||
(count: SidebarThreadPreviewCount) => {
|
||||
updateSettings({ sidebarThreadPreviewCount: count });
|
||||
},
|
||||
[updateSettings],
|
||||
);
|
||||
|
||||
return (
|
||||
<SidebarContent className="gap-0">
|
||||
@@ -2607,9 +2689,11 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
projectSortOrder={projectSortOrder}
|
||||
threadSortOrder={threadSortOrder}
|
||||
projectGroupingMode={projectGroupingMode}
|
||||
threadPreviewCount={threadPreviewCount}
|
||||
onProjectSortOrderChange={handleProjectSortOrderChange}
|
||||
onThreadSortOrderChange={handleThreadSortOrderChange}
|
||||
onProjectGroupingModeChange={handleProjectGroupingModeChange}
|
||||
onThreadPreviewCountChange={handleThreadPreviewCountChange}
|
||||
/>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
@@ -2729,6 +2813,7 @@ export default function Sidebar() {
|
||||
sidebarProjectGroupingMode: settings.sidebarProjectGroupingMode,
|
||||
sidebarProjectGroupingOverrides: settings.sidebarProjectGroupingOverrides,
|
||||
}));
|
||||
const sidebarThreadPreviewCount = useSettings((s) => s.sidebarThreadPreviewCount);
|
||||
const { updateSettings } = useUpdateSettings();
|
||||
const { handleNewThread } = useNewThreadHandler();
|
||||
const { archiveThread, deleteThread } = useThreadActions();
|
||||
@@ -3024,11 +3109,11 @@ export default function Sidebar() {
|
||||
return [];
|
||||
}
|
||||
const isThreadListExpanded = expandedThreadListsByProject.has(project.projectKey);
|
||||
const hasOverflowingThreads = projectThreads.length > THREAD_PREVIEW_LIMIT;
|
||||
const hasOverflowingThreads = projectThreads.length > sidebarThreadPreviewCount;
|
||||
const previewThreads =
|
||||
isThreadListExpanded || !hasOverflowingThreads
|
||||
? projectThreads
|
||||
: projectThreads.slice(0, THREAD_PREVIEW_LIMIT);
|
||||
: projectThreads.slice(0, sidebarThreadPreviewCount);
|
||||
const renderedThreads = pinnedCollapsedThread ? [pinnedCollapsedThread] : previewThreads;
|
||||
return renderedThreads.map((thread) =>
|
||||
scopedThreadKey(scopeThreadRef(thread.environmentId, thread.id)),
|
||||
@@ -3036,6 +3121,7 @@ export default function Sidebar() {
|
||||
}),
|
||||
[
|
||||
sidebarThreadSortOrder,
|
||||
sidebarThreadPreviewCount,
|
||||
expandedThreadListsByProject,
|
||||
projectExpandedById,
|
||||
routeThreadKey,
|
||||
@@ -3358,6 +3444,7 @@ export default function Sidebar() {
|
||||
projectSortOrder={sidebarProjectSortOrder}
|
||||
threadSortOrder={sidebarThreadSortOrder}
|
||||
projectGroupingMode={sidebarProjectGroupingMode}
|
||||
threadPreviewCount={sidebarThreadPreviewCount}
|
||||
updateSettings={updateSettings}
|
||||
openAddProject={openAddProjectCommandPalette}
|
||||
isManualProjectSorting={isManualProjectSorting}
|
||||
|
||||
@@ -364,6 +364,9 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
...(settings.timestampFormat !== DEFAULT_UNIFIED_SETTINGS.timestampFormat
|
||||
? ["Time format"]
|
||||
: []),
|
||||
...(settings.sidebarThreadPreviewCount !== DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount
|
||||
? ["Visible threads"]
|
||||
: []),
|
||||
...(settings.diffWordWrap !== DEFAULT_UNIFIED_SETTINGS.diffWordWrap
|
||||
? ["Diff line wrapping"]
|
||||
: []),
|
||||
@@ -400,6 +403,7 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
settings.diffIgnoreWhitespace,
|
||||
settings.diffWordWrap,
|
||||
settings.enableAssistantStreaming,
|
||||
settings.sidebarThreadPreviewCount,
|
||||
settings.timestampFormat,
|
||||
theme,
|
||||
],
|
||||
|
||||
@@ -27,6 +27,31 @@ function Input({
|
||||
props.type === "file" &&
|
||||
"text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm",
|
||||
);
|
||||
let inputElement: React.ReactElement;
|
||||
|
||||
if (nativeInput) {
|
||||
const { style, onValueChange: _onValueChange, ...nativeInputProps } = props;
|
||||
const nativeStyle = typeof style === "function" ? undefined : style;
|
||||
|
||||
inputElement = (
|
||||
<input
|
||||
className={inputClassName}
|
||||
data-slot="input"
|
||||
size={typeof size === "number" ? size : undefined}
|
||||
style={nativeStyle}
|
||||
{...(nativeInputProps as React.ComponentProps<"input">)}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
inputElement = (
|
||||
<InputPrimitive
|
||||
className={inputClassName}
|
||||
data-slot="input"
|
||||
size={typeof size === "number" ? size : undefined}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<span
|
||||
@@ -40,21 +65,7 @@ function Input({
|
||||
data-size={size}
|
||||
data-slot="input-control"
|
||||
>
|
||||
{nativeInput ? (
|
||||
<input
|
||||
className={inputClassName}
|
||||
data-slot="input"
|
||||
size={typeof size === "number" ? size : undefined}
|
||||
{...props}
|
||||
/>
|
||||
) : (
|
||||
<InputPrimitive
|
||||
className={inputClassName}
|
||||
data-slot="input"
|
||||
size={typeof size === "number" ? size : undefined}
|
||||
{...props}
|
||||
/>
|
||||
)}
|
||||
{inputElement}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
"use client";
|
||||
|
||||
import { NumberField as NumberFieldPrimitive } from "@base-ui/react/number-field";
|
||||
import { MinusIcon, PlusIcon } from "lucide-react";
|
||||
import * as React from "react";
|
||||
import { cn } from "~/lib/utils";
|
||||
import { Label } from "~/components/ui/label";
|
||||
|
||||
export const NumberFieldContext: React.Context<{
|
||||
fieldId: string;
|
||||
} | null> = React.createContext<{
|
||||
fieldId: string;
|
||||
} | null>(null);
|
||||
|
||||
export function NumberField({
|
||||
id,
|
||||
className,
|
||||
size = "default",
|
||||
...props
|
||||
}: NumberFieldPrimitive.Root.Props & {
|
||||
size?: "sm" | "default" | "lg";
|
||||
}): React.ReactElement {
|
||||
const generatedId = React.useId();
|
||||
const fieldId = id ?? generatedId;
|
||||
const contextValue = React.useMemo(() => ({ fieldId }), [fieldId]);
|
||||
|
||||
return (
|
||||
<NumberFieldContext.Provider value={contextValue}>
|
||||
<NumberFieldPrimitive.Root
|
||||
className={cn("flex w-full flex-col items-start gap-2", className)}
|
||||
data-size={size}
|
||||
data-slot="number-field"
|
||||
id={fieldId}
|
||||
{...props}
|
||||
/>
|
||||
</NumberFieldContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function NumberFieldGroup({
|
||||
className,
|
||||
...props
|
||||
}: NumberFieldPrimitive.Group.Props): React.ReactElement {
|
||||
return (
|
||||
<NumberFieldPrimitive.Group
|
||||
className={cn(
|
||||
"relative flex w-full justify-between rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-within:border-ring focus-within:ring-[3px] has-aria-invalid:border-destructive/36 has-autofill:bg-foreground/4 focus-within:has-aria-invalid:border-destructive/64 focus-within:has-aria-invalid:ring-destructive/48 data-disabled:pointer-events-none data-disabled:opacity-64 sm:text-sm dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-within,[aria-invalid]]:shadow-none",
|
||||
className,
|
||||
)}
|
||||
data-slot="number-field-group"
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function NumberFieldDecrement({
|
||||
className,
|
||||
...props
|
||||
}: NumberFieldPrimitive.Decrement.Props): React.ReactElement {
|
||||
return (
|
||||
<NumberFieldPrimitive.Decrement
|
||||
className={cn(
|
||||
"relative flex shrink-0 cursor-pointer items-center justify-center rounded-s-[calc(var(--radius-lg)-1px)] in-data-[size=sm]:px-[calc(--spacing(2.5)-1px)] px-[calc(--spacing(3)-1px)] transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent",
|
||||
className,
|
||||
)}
|
||||
data-slot="number-field-decrement"
|
||||
{...props}
|
||||
>
|
||||
<MinusIcon />
|
||||
</NumberFieldPrimitive.Decrement>
|
||||
);
|
||||
}
|
||||
|
||||
export function NumberFieldIncrement({
|
||||
className,
|
||||
...props
|
||||
}: NumberFieldPrimitive.Increment.Props): React.ReactElement {
|
||||
return (
|
||||
<NumberFieldPrimitive.Increment
|
||||
className={cn(
|
||||
"relative flex shrink-0 cursor-pointer items-center justify-center rounded-e-[calc(var(--radius-lg)-1px)] in-data-[size=sm]:px-[calc(--spacing(2.5)-1px)] px-[calc(--spacing(3)-1px)] transition-colors pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:bg-accent",
|
||||
className,
|
||||
)}
|
||||
data-slot="number-field-increment"
|
||||
{...props}
|
||||
>
|
||||
<PlusIcon />
|
||||
</NumberFieldPrimitive.Increment>
|
||||
);
|
||||
}
|
||||
|
||||
export function NumberFieldInput({
|
||||
className,
|
||||
...props
|
||||
}: NumberFieldPrimitive.Input.Props): React.ReactElement {
|
||||
return (
|
||||
<NumberFieldPrimitive.Input
|
||||
className={cn(
|
||||
"h-8.5 in-data-[size=lg]:h-9.5 in-data-[size=sm]:h-7.5 w-full min-w-0 grow bg-transparent in-data-[size=sm]:px-[calc(--spacing(2.5)-1px)] px-[calc(--spacing(3)-1px)] text-center tabular-nums in-data-[size=lg]:leading-9.5 in-data-[size=sm]:leading-7.5 leading-8.5 outline-none [transition:background-color_5000000s_ease-in-out_0s] sm:h-7.5 sm:in-data-[size=lg]:h-8.5 sm:in-data-[size=sm]:h-6.5 sm:in-data-[size=lg]:leading-8.5 sm:in-data-[size=sm]:leading-8.5 sm:leading-7.5",
|
||||
className,
|
||||
)}
|
||||
data-slot="number-field-input"
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function NumberFieldScrubArea({
|
||||
className,
|
||||
label,
|
||||
...props
|
||||
}: NumberFieldPrimitive.ScrubArea.Props & {
|
||||
label: string;
|
||||
}): React.ReactElement {
|
||||
const context = React.useContext(NumberFieldContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error(
|
||||
"NumberFieldScrubArea must be used within a NumberField component for accessibility.",
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<NumberFieldPrimitive.ScrubArea
|
||||
className={cn("flex cursor-ew-resize", className)}
|
||||
data-slot="number-field-scrub-area"
|
||||
{...props}
|
||||
>
|
||||
<Label className="cursor-ew-resize" htmlFor={context.fieldId}>
|
||||
{label}
|
||||
</Label>
|
||||
<NumberFieldPrimitive.ScrubAreaCursor className="drop-shadow-[0_1px_1px_#0008] filter">
|
||||
<CursorGrowIcon />
|
||||
</NumberFieldPrimitive.ScrubAreaCursor>
|
||||
</NumberFieldPrimitive.ScrubArea>
|
||||
);
|
||||
}
|
||||
|
||||
export function CursorGrowIcon(props: React.ComponentProps<"svg">): React.ReactElement {
|
||||
return (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
fill="black"
|
||||
height="14"
|
||||
stroke="white"
|
||||
viewBox="0 0 24 14"
|
||||
width="26"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
{...props}
|
||||
>
|
||||
<path d="M19.5 5.5L6.49737 5.51844V2L1 6.9999L6.5 12L6.49737 8.5L19.5 8.5V12L25 6.9999L19.5 2V5.5Z" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export { NumberFieldPrimitive };
|
||||
@@ -613,6 +613,7 @@ describe("wsApi", () => {
|
||||
},
|
||||
sidebarProjectSortOrder: "manual" as const,
|
||||
sidebarThreadSortOrder: "created_at" as const,
|
||||
sidebarThreadPreviewCount: 6,
|
||||
timestampFormat: "24-hour" as const,
|
||||
};
|
||||
const getClientSettings = vi.fn().mockResolvedValue({
|
||||
@@ -675,6 +676,7 @@ describe("wsApi", () => {
|
||||
},
|
||||
sidebarProjectSortOrder: "manual" as const,
|
||||
sidebarThreadSortOrder: "created_at" as const,
|
||||
sidebarThreadPreviewCount: 6,
|
||||
timestampFormat: "24-hour" as const,
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import pkg from "./package.json" with { type: "json" };
|
||||
|
||||
const port = Number(process.env.PORT ?? 5733);
|
||||
const host = process.env.HOST?.trim() || "localhost";
|
||||
const configuredHttpUrl = process.env.VITE_HTTP_URL?.trim();
|
||||
const configuredWsUrl = process.env.VITE_WS_URL?.trim();
|
||||
const configuredHostedAppUrl = (() => {
|
||||
if (process.env.VERCEL_ENV === "production" && process.env.VERCEL_PROJECT_PRODUCTION_URL) {
|
||||
@@ -74,7 +73,6 @@ export default defineConfig({
|
||||
],
|
||||
},
|
||||
define: {
|
||||
"import.meta.env.VITE_HTTP_URL": JSON.stringify(configuredHttpUrl ?? ""),
|
||||
// In dev mode, tell the web app where the WebSocket server lives
|
||||
"import.meta.env.VITE_WS_URL": JSON.stringify(configuredWsUrl ?? ""),
|
||||
"import.meta.env.VITE_HOSTED_APP_URL": JSON.stringify(configuredHostedAppUrl ?? ""),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"apps/desktop": {
|
||||
"name": "@t3tools/desktop",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "catalog:",
|
||||
"effect": "catalog:",
|
||||
@@ -49,7 +49,7 @@
|
||||
},
|
||||
"apps/server": {
|
||||
"name": "t3",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"bin": {
|
||||
"t3": "./dist/bin.mjs",
|
||||
},
|
||||
@@ -82,9 +82,9 @@
|
||||
},
|
||||
"apps/web": {
|
||||
"name": "@t3tools/web",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"dependencies": {
|
||||
"@base-ui/react": "^1.2.0",
|
||||
"@base-ui/react": "^1.4.1",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
@@ -148,7 +148,7 @@
|
||||
},
|
||||
"packages/contracts": {
|
||||
"name": "@t3tools/contracts",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"dependencies": {
|
||||
"effect": "catalog:",
|
||||
},
|
||||
@@ -350,9 +350,9 @@
|
||||
|
||||
"@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
|
||||
|
||||
"@base-ui/react": ["@base-ui/react@1.3.0", "", { "dependencies": { "@babel/runtime": "^7.28.6", "@base-ui/utils": "0.2.6", "@floating-ui/react-dom": "^2.1.8", "@floating-ui/utils": "^0.2.11", "tabbable": "^6.4.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@types/react": "^17 || ^18 || ^19", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-FwpKqZbPz14AITp1CVgf4AjhKPe1OeeVKSBMdgD10zbFlj3QSWelmtCMLi2+/PFZZcIm3l87G7rwtCZJwHyXWA=="],
|
||||
"@base-ui/react": ["@base-ui/react@1.4.1", "", { "dependencies": { "@babel/runtime": "^7.29.2", "@base-ui/utils": "0.2.8", "@floating-ui/react-dom": "^2.1.8", "@floating-ui/utils": "^0.2.11", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@date-fns/tz": "^1.2.0", "@types/react": "^17 || ^18 || ^19", "date-fns": "^4.0.0", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@date-fns/tz", "@types/react", "date-fns"] }, "sha512-Ab5/LIhcmL8BQcsBUYiOfkSDRdLpvgUBzMK30cu684JPcLclYlztharvCZyNNgzJtbAiREzI9q0pI5erHCMgCw=="],
|
||||
|
||||
"@base-ui/utils": ["@base-ui/[email protected].6", "", { "dependencies": { "@babel/runtime": "^7.28.6", "@floating-ui/utils": "^0.2.11", "reselect": "^5.1.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@types/react": "^17 || ^18 || ^19", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-yQ+qeuqohwhsNpoYDqqXaLllYAkPCP4vYdDrVo8FQXaAPfHWm1pG/Vm+jmGTA5JFS0BAIjookyapuJFY8F9PIw=="],
|
||||
"@base-ui/utils": ["@base-ui/[email protected].8", "", { "dependencies": { "@babel/runtime": "^7.29.2", "@floating-ui/utils": "^0.2.11", "reselect": "^5.1.1", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { "@types/react": "^17 || ^18 || ^19", "react": "^17 || ^18 || ^19", "react-dom": "^17 || ^18 || ^19" }, "optionalPeers": ["@types/react"] }, "sha512-jvOi+c+ftGlGotNcKnzPVg2IhCaDTB6/6R3JeqdjdXktuAJi3wKH9T7+svuaKh1mmfVU11UWzUZVH74JDfi/wQ=="],
|
||||
|
||||
"@blazediff/core": ["@blazediff/[email protected]", "", {}, "sha512-ehg3jIkYKulZh+8om/O25vkvSsXXwC+skXmyA87FFx6A/45eqOkZsBltMw/TVteb0mloiGT8oGRTcjRAz66zaA=="],
|
||||
|
||||
@@ -2122,6 +2122,10 @@
|
||||
|
||||
"@babel/types/@babel/helper-validator-identifier": ["@babel/[email protected]", "", {}, "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q=="],
|
||||
|
||||
"@base-ui/react/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g=="],
|
||||
|
||||
"@base-ui/utils/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g=="],
|
||||
|
||||
"@electron/get/fs-extra": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="],
|
||||
|
||||
"@electron/get/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
||||
|
||||
@@ -27,6 +27,16 @@ export const SidebarProjectGroupingMode = Schema.Literals([
|
||||
]);
|
||||
export type SidebarProjectGroupingMode = typeof SidebarProjectGroupingMode.Type;
|
||||
export const DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE: SidebarProjectGroupingMode = "repository";
|
||||
export const MIN_SIDEBAR_THREAD_PREVIEW_COUNT = 1;
|
||||
export const MAX_SIDEBAR_THREAD_PREVIEW_COUNT = 15;
|
||||
export const SidebarThreadPreviewCount = Schema.Int.check(
|
||||
Schema.isBetween({
|
||||
minimum: MIN_SIDEBAR_THREAD_PREVIEW_COUNT,
|
||||
maximum: MAX_SIDEBAR_THREAD_PREVIEW_COUNT,
|
||||
}),
|
||||
);
|
||||
export type SidebarThreadPreviewCount = typeof SidebarThreadPreviewCount.Type;
|
||||
export const DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT: SidebarThreadPreviewCount = 6;
|
||||
|
||||
export const ClientSettingsSchema = Schema.Struct({
|
||||
autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
|
||||
@@ -75,6 +85,9 @@ export const ClientSettingsSchema = Schema.Struct({
|
||||
sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
|
||||
),
|
||||
sidebarThreadPreviewCount: SidebarThreadPreviewCount.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT)),
|
||||
),
|
||||
timestampFormat: TimestampFormat.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_TIMESTAMP_FORMAT)),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user