feat(webui): simplify automation management and unify disclosure motion
Replace the dense automation workspace with a calm list and on-demand details, show current linked-chat titles, and remember manual system-task expansion preferences. Reuse disclosure transitions across expandable controls, preserve drafts and focus through closing, and release large diffs after their exit animation. Refs NAN-116
This commit is contained in:
1 parent
90b889394f
commit
1640784d45
37 files changed
+1746
-721
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { ProviderIcon } from "@/components/settings/models/ProviderSettings";
|
||||
import { useAutoSave } from "@/components/settings/shared/useAutoSave";
|
||||
import { useEffect, useRef, useState, type Dispatch, type SetStateAction } from "react";
|
||||
import { useEffect, useId, useRef, useState, type Dispatch, type SetStateAction } from "react";
|
||||
import { DisclosureContent } from "@/components/ui/disclosure";
|
||||
import {
|
||||
ChevronDown,
|
||||
GripVertical,
|
||||
@@ -237,6 +238,7 @@ export function ModelsSettings({
|
||||
const suggestedPresetNameRef = useRef<string | null>(null);
|
||||
const [editorRowKey, setEditorRowKey] = useState<string | null>(null);
|
||||
const [advancedOpen, setAdvancedOpen] = useState(false);
|
||||
const advancedId = useId();
|
||||
const [draggedCallOrderIndex, setDraggedCallOrderIndex] = useState<number | null>(null);
|
||||
const [dragOverCallOrderIndex, setDragOverCallOrderIndex] = useState<number | null>(null);
|
||||
const [draggedRowHeight, setDraggedRowHeight] = useState(0);
|
||||
@@ -499,6 +501,7 @@ export function ModelsSettings({
|
||||
<button
|
||||
type="button"
|
||||
aria-expanded={advancedOpen}
|
||||
aria-controls={advancedId}
|
||||
onClick={() => setAdvancedOpen((value) => !value)}
|
||||
className="flex min-h-[62px] w-full items-center justify-between gap-4 px-4 py-3.5 text-left transition-colors settings-hover sm:px-5"
|
||||
>
|
||||
@@ -519,13 +522,13 @@ export function ModelsSettings({
|
||||
</span>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
"h-4 w-4 shrink-0 text-muted-foreground transition-transform",
|
||||
"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 motion-reduce:transition-none",
|
||||
advancedOpen && "rotate-180",
|
||||
)}
|
||||
aria-hidden
|
||||
/>
|
||||
</button>
|
||||
{advancedOpen ? (
|
||||
<DisclosureContent id={advancedId} open={advancedOpen}>
|
||||
<div className="bg-muted/12 px-4 py-4 sm:px-5">
|
||||
<ModelAdvancedFields
|
||||
maxTokens={form.maxTokens}
|
||||
@@ -535,7 +538,7 @@ export function ModelsSettings({
|
||||
onChange={(value) => setForm((prev) => ({ ...prev, ...value }))}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</DisclosureContent>
|
||||
<div className="flex min-h-[58px] flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5">
|
||||
{creating ? (
|
||||
<Button
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMemo, useState, type ReactNode } from "react";
|
||||
import { useId, useMemo, useState, type ReactNode } from "react";
|
||||
import { DisclosureContent } from "@/components/ui/disclosure";
|
||||
import {
|
||||
ChevronDown,
|
||||
Clipboard,
|
||||
@@ -431,6 +432,7 @@ function ProviderAdvancedOptions({
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const enabled = new Set(fields);
|
||||
const contentId = useId();
|
||||
if (enabled.size === 0) return null;
|
||||
|
||||
const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });
|
||||
@@ -446,6 +448,7 @@ function ProviderAdvancedOptions({
|
||||
<button
|
||||
type="button"
|
||||
aria-expanded={open}
|
||||
aria-controls={contentId}
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
className="flex min-h-[48px] w-full items-center justify-between gap-4 px-1 py-2.5 text-left transition-colors hover:text-foreground"
|
||||
>
|
||||
@@ -454,13 +457,13 @@ function ProviderAdvancedOptions({
|
||||
</span>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
"h-4 w-4 shrink-0 text-muted-foreground transition-transform",
|
||||
"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 motion-reduce:transition-none",
|
||||
open && "rotate-180",
|
||||
)}
|
||||
aria-hidden
|
||||
/>
|
||||
</button>
|
||||
{open ? (
|
||||
<DisclosureContent id={contentId} open={open}>
|
||||
<div className="py-3">
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
{enabled.has("api_type") ? (
|
||||
@@ -622,7 +625,7 @@ function ProviderAdvancedOptions({
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</DisclosureContent>
|
||||
{footer ? (
|
||||
<div className="flex items-center justify-end gap-2 py-3">
|
||||
{footer}
|
||||
|
||||
Reference in new issue
Block a user