|
1 | 1 | import { useCallback, useEffect, useState, useRef } from "react"; |
2 | 2 | import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; |
3 | 3 | import { api, type AgentConfigResponse, type AgentConfigUpdateRequest } from "@/api/client"; |
4 | | -import { Button, SettingSidebarButton, Input, TextArea, Toggle, NumberStepper, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, cx } from "@/ui"; |
| 4 | +import { Button, Input, TextArea, Toggle, NumberStepper, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, cx } from "@/ui"; |
| 5 | +import {SettingSectionNav} from "@/components/SettingSectionNav"; |
5 | 6 | import { ModelSelect } from "@/components/ModelSelect"; |
6 | 7 | import { Markdown } from "@/components/Markdown"; |
7 | 8 | import { motion, AnimatePresence } from "framer-motion"; |
@@ -146,51 +147,30 @@ export function AgentConfig({ agentId }: AgentConfigProps) { |
146 | 147 | const isIdentitySection = active.group === "identity"; |
147 | 148 |
|
148 | 149 | return ( |
149 | | - <div className="flex h-full relative"> |
150 | | - {/* Sidebar */} |
151 | | - <div className="flex w-52 flex-shrink-0 flex-col border-r border-app-line/50 bg-app-darkBox/20 overflow-y-auto"> |
152 | | - {/* Identity Group */} |
153 | | - <div className="px-3 pb-1 pt-4"> |
154 | | - <span className="text-tiny font-medium uppercase tracking-wider text-ink-faint">Identity</span> |
155 | | - </div> |
156 | | - <div className="flex flex-col gap-0.5 px-2"> |
157 | | - {SECTIONS.filter((s) => s.group === "identity").map((section) => { |
158 | | - const isActive = activeSection === section.id; |
159 | | - const hasContent = !!getIdentityField(identityQuery.data ?? { soul: null, identity: null, user: null }, section.id)?.trim(); |
160 | | - return ( |
161 | | - <SettingSidebarButton |
162 | | - key={section.id} |
163 | | - onClick={() => handleSectionChange(section.id)} |
164 | | - active={isActive} |
165 | | - > |
166 | | - <span className="flex-1">{section.label}</span> |
167 | | - {!hasContent && ( |
168 | | - <span className="rounded bg-amber-500/10 px-1 py-0.5 text-tiny text-amber-400/70">empty</span> |
169 | | - )} |
170 | | - </SettingSidebarButton> |
171 | | - ); |
172 | | - })} |
173 | | - </div> |
174 | | - |
175 | | - {/* Config Group */} |
176 | | - <div className="px-3 pb-1 pt-4 mt-2"> |
177 | | - <span className="text-tiny font-medium uppercase tracking-wider text-ink-faint">Configuration</span> |
178 | | - </div> |
179 | | - <div className="flex flex-col gap-0.5 px-2"> |
180 | | - {SECTIONS.filter((s) => s.group === "config").map((section) => { |
181 | | - const isActive = activeSection === section.id; |
182 | | - return ( |
183 | | - <SettingSidebarButton |
184 | | - key={section.id} |
185 | | - onClick={() => handleSectionChange(section.id)} |
186 | | - active={isActive} |
187 | | - > |
188 | | - <span className="flex-1">{section.label}</span> |
189 | | - </SettingSidebarButton> |
190 | | - ); |
191 | | - })} |
192 | | - </div> |
193 | | - </div> |
| 150 | + <div className="flex h-full flex-col md:flex-row relative"> |
| 151 | + <SettingSectionNav |
| 152 | + groups={[ |
| 153 | + { |
| 154 | + label: "Identity", |
| 155 | + sections: SECTIONS.filter((s) => s.group === "identity").map((s) => ({ |
| 156 | + id: s.id, |
| 157 | + label: s.label, |
| 158 | + badge: !getIdentityField(identityQuery.data ?? {soul: null, identity: null, user: null}, s.id)?.trim() |
| 159 | + ? <span className="rounded bg-amber-500/10 px-1 py-0.5 text-tiny text-amber-400/70">empty</span> |
| 160 | + : undefined, |
| 161 | + })), |
| 162 | + }, |
| 163 | + { |
| 164 | + label: "Configuration", |
| 165 | + sections: SECTIONS.filter((s) => s.group === "config").map((s) => ({ |
| 166 | + id: s.id, |
| 167 | + label: s.label, |
| 168 | + })), |
| 169 | + }, |
| 170 | + ]} |
| 171 | + activeSection={activeSection} |
| 172 | + onSectionChange={(id) => handleSectionChange(id as SectionId)} |
| 173 | + /> |
194 | 174 |
|
195 | 175 | {/* Editor */} |
196 | 176 | <div className="flex flex-1 flex-col overflow-hidden"> |
|
0 commit comments