Files
SnowLuma/packages/webui/src/components/config/general-settings-tab.tsx
T
DrSmoothl a460433175 refactor(webui): redesign per-UIN config page into sidebar + tabs + modal
The original page stacked four expanded network sections vertically with
inline editing, so the first view drowned in every field across every
adapter at once. Restructured to a sidebar + tabs + modal layout:

- Account sidebar collapses to a 56px avatar column with name/UIN
  tooltips; expanded it keeps the original 260px nickname + UIN layout.
- Right pane swaps the stacked sections for a 5-tab strip (通用设置 /
  HTTP API / HTTP 客户端 / WS 服务端 / WS 客户端) with a per-tab badge
  count.
- Each network tab is a list of summary cards: name + projected key
  info (host:port/path, url · role, etc.) + format/report/token badges
  + inline enable toggle + edit/delete buttons. No live-typed fields.
- Create and edit both route through a single NodeEditDialog with
  kind-specific field strips; cancel truly discards the draft.
- Per-kind metadata (title, summary projector, defaultEntry factory)
  lives in config/defaults.ts so adding a new adapter kind only needs
  one descriptor entry.

Behavior preserved end-to-end: same per-UIN config payload, same
useOneBotInstanceConfig hook, same dirty-switch confirm flow, same
save endpoint.
2026-05-18 14:29:52 +08:00

32 lines
1.1 KiB
TypeScript

// "通用设置" tab — fields that apply to the whole OneBotInstance rather
// than any specific adapter. Currently just the music-sign service URL,
// but the layout has room for additional cross-cutting toggles.
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import type { OneBotConfig } from '@/types';
interface GeneralSettingsTabProps {
config: OneBotConfig;
onChange: (next: OneBotConfig) => void;
}
export function GeneralSettingsTab({ config, onChange }: GeneralSettingsTabProps) {
return (
<div className="flex flex-col gap-4">
<div className="flex flex-col gap-1.5 rounded-lg border bg-card/40 p-4">
<Label>音乐签名服务 URL</Label>
<Input
type="url"
placeholder="留空则不启用"
value={config.musicSignUrl ?? ''}
onChange={(e) => onChange({ ...config, musicSignUrl: e.target.value || undefined })}
/>
<p className="text-[11px] leading-relaxed text-muted-foreground">
用于音乐分享卡片签名。未配置时音乐相关消息段会回落为普通文本。
</p>
</div>
</div>
);
}