feat: 重构侧边栏布局,当前账号移至底部卡片并支持快速切换,下载任务独立为顶级菜单
CI / lint-and-build (push) Has been cancelled

This commit is contained in:
2026-06-30 14:11:33 +06:00
parent 145b918dbc
commit c7b539f2c5
@@ -22,8 +22,10 @@ struct ContentView: View {
struct SidebarView: View { struct SidebarView: View {
@EnvironmentObject var accountStore: AccountStore @EnvironmentObject var accountStore: AccountStore
@State private var showAccountPicker = false
var body: some View { var body: some View {
VStack(spacing: 0) {
List { List {
Section("媒体库") { Section("媒体库") {
NavigationLink(destination: VideoListView()) { NavigationLink(destination: VideoListView()) {
@@ -31,26 +33,66 @@ struct SidebarView: View {
} }
} }
Section("下载") {
NavigationLink(destination: DownloadTaskListView()) {
Label("下载任务", systemImage: "arrow.down.circle")
}
}
Section("管理") { Section("管理") {
NavigationLink(destination: AccountListView()) { NavigationLink(destination: AccountListView()) {
Label("账号配置", systemImage: "key") Label("账号配置", systemImage: "key")
} }
NavigationLink(destination: DownloadTaskListView()) {
Label("下载任务", systemImage: "arrow.down.circle")
}
NavigationLink(destination: LogListView()) { NavigationLink(destination: LogListView()) {
Label("操作日志", systemImage: "doc.text") Label("操作日志", systemImage: "doc.text")
} }
} }
}
if let account = accountStore.activeAccount { if let account = accountStore.activeAccount {
Section("当前账号") { Divider()
Label(account.name, systemImage: "checkmark.circle.fill") VStack(spacing: 8) {
HStack {
Image(systemName: "checkmark.circle.fill")
.foregroundStyle(.green) .foregroundStyle(.green)
Text(account.name)
.font(.headline)
.lineLimit(1)
Spacer()
}
HStack {
Text(account.region) Text(account.region)
.font(.caption) .font(.caption)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
Spacer()
} }
if accountStore.accounts.count > 1 {
Menu {
ForEach(accountStore.accounts) { acct in
Button {
Task { await accountStore.switchActive(acct) }
} label: {
HStack {
Text(acct.name)
if acct.id == account.id {
Image(systemName: "checkmark")
}
}
}
}
} label: {
Label("切换账号", systemImage: "arrow.triangle.2.circlepath")
.font(.caption)
}
.buttonStyle(.bordered)
.controlSize(.small)
}
}
.padding(12)
.background(.quaternary.opacity(0.5), in: RoundedRectangle(cornerRadius: 10))
.padding(.horizontal, 8)
.padding(.bottom, 8)
} }
} }
.navigationTitle("火炬VOD管理器") .navigationTitle("火炬VOD管理器")