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,35 +22,77 @@ struct ContentView: View {
struct SidebarView: View {
@EnvironmentObject var accountStore: AccountStore
@State private var showAccountPicker = false
var body: some View {
List {
Section("媒体库") {
NavigationLink(destination: VideoListView()) {
Label("视频库", systemImage: "film")
VStack(spacing: 0) {
List {
Section("媒体库") {
NavigationLink(destination: VideoListView()) {
Label("视频库", systemImage: "film")
}
}
}
Section("管理") {
NavigationLink(destination: AccountListView()) {
Label("账号配置", systemImage: "key")
Section("下载") {
NavigationLink(destination: DownloadTaskListView()) {
Label("下载任务", systemImage: "arrow.down.circle")
}
}
NavigationLink(destination: DownloadTaskListView()) {
Label("下载任务", systemImage: "arrow.down.circle")
}
NavigationLink(destination: LogListView()) {
Label("操作日志", systemImage: "doc.text")
Section("管理") {
NavigationLink(destination: AccountListView()) {
Label("账号配置", systemImage: "key")
}
NavigationLink(destination: LogListView()) {
Label("操作日志", systemImage: "doc.text")
}
}
}
if let account = accountStore.activeAccount {
Section("当前账号") {
Label(account.name, systemImage: "checkmark.circle.fill")
.foregroundStyle(.green)
Text(account.region)
.font(.caption)
.foregroundStyle(.secondary)
Divider()
VStack(spacing: 8) {
HStack {
Image(systemName: "checkmark.circle.fill")
.foregroundStyle(.green)
Text(account.name)
.font(.headline)
.lineLimit(1)
Spacer()
}
HStack {
Text(account.region)
.font(.caption)
.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管理器")