diff --git a/apps/macos/VODManager/Sources/VODManager/Views/ContentView.swift b/apps/macos/VODManager/Sources/VODManager/Views/ContentView.swift index 06beec1..7d71514 100644 --- a/apps/macos/VODManager/Sources/VODManager/Views/ContentView.swift +++ b/apps/macos/VODManager/Sources/VODManager/Views/ContentView.swift @@ -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管理器")