fix(web/channels): move channels to own sidebar group and fix sheet padding

- Channels now has its own navigation group instead of being under Services
- Fix edit sheet form content padding (px-1 -> px-4) to match header/footer
- Fix naked return lint error in extractChannelInfo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Guoguo 2026-03-06 03:31:30 -08:00
parent 5ae8044c72
commit 9fb134cc60
5 changed files with 14 additions and 5 deletions

View file

@ -167,8 +167,9 @@ func isValidChannel(name string) bool {
} }
// extractChannelInfo returns enabled, configured status and masked config for a channel. // extractChannelInfo returns enabled, configured status and masked config for a channel.
func extractChannelInfo(name string, ch *config.ChannelsConfig) (enabled, configured bool, cfg map[string]any) { func extractChannelInfo(name string, ch *config.ChannelsConfig) (bool, bool, map[string]any) {
cfg = make(map[string]any) var enabled, configured bool
cfg := make(map[string]any)
switch name { switch name {
case "telegram": case "telegram":
c := ch.Telegram c := ch.Telegram
@ -320,7 +321,7 @@ func extractChannelInfo(name string, ch *config.ChannelsConfig) (enabled, config
cfg["port"] = c.Port cfg["port"] = c.Port
cfg["allow_from"] = []string(c.AllowFrom) cfg["allow_from"] = []string(c.AllowFrom)
} }
return return enabled, configured, cfg
} }
// setChannelEnabled sets the enabled flag for a channel. // setChannelEnabled sets the enabled flag for a channel.

View file

@ -44,10 +44,16 @@ const navGroups = [
], ],
}, },
{ {
label: "navigation.services", label: "navigation.channels_group",
defaultOpen: true, defaultOpen: true,
items: [ items: [
{ title: "navigation.channels", url: "/channels", icon: IconPlug }, { title: "navigation.channels", url: "/channels", icon: IconPlug },
],
},
{
label: "navigation.services",
defaultOpen: true,
items: [
{ title: "navigation.config", url: "/config", icon: IconSettings }, { title: "navigation.config", url: "/config", icon: IconSettings },
{ title: "navigation.logs", url: "/logs", icon: IconListDetails }, { title: "navigation.logs", url: "/logs", icon: IconListDetails },
], ],

View file

@ -176,7 +176,7 @@ export function EditChannelSheet({
</SheetDescription> </SheetDescription>
</SheetHeader> </SheetHeader>
<div className="flex-1 overflow-y-auto px-1 py-4">{renderForm()}</div> <div className="flex-1 overflow-y-auto px-4 py-4">{renderForm()}</div>
{serverError && ( {serverError && (
<p className="px-1 text-sm text-red-500">{serverError}</p> <p className="px-1 text-sm text-red-500">{serverError}</p>

View file

@ -5,6 +5,7 @@
"models": "Models", "models": "Models",
"credentials": "Credentials", "credentials": "Credentials",
"services": "Services", "services": "Services",
"channels_group": "Channels",
"channels": "Channels", "channels": "Channels",
"config": "Config", "config": "Config",
"logs": "Logs" "logs": "Logs"

View file

@ -5,6 +5,7 @@
"models": "模型", "models": "模型",
"credentials": "凭据", "credentials": "凭据",
"services": "服务", "services": "服务",
"channels_group": "频道",
"channels": "频道", "channels": "频道",
"config": "配置", "config": "配置",
"logs": "日志" "logs": "日志"