mirror of
https://github.com/VGEAREN/Stockbar.git
synced 2026-10-07 12:48:49 +08:00
- A-shares, HK, and US stock real-time quotes (Sina / Tencent) - Intraday minute charts (Tencent / Yahoo Finance) - US extended-hours session indicator with price and change% - Portfolio P&L tracking (cost price × shares) - Sort by change%, color themes, launch at login - File-based persistence with 10-snapshot rolling backup - Universal binary (Apple Silicon + Intel) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
Swift
45 lines
1.3 KiB
Swift
import SwiftUI
|
|
|
|
struct ToolbarView: View {
|
|
@EnvironmentObject var appState: AppState
|
|
@Binding var showSettings: Bool
|
|
@Binding var sortByChange: Bool
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Button {
|
|
appState.forceRefresh()
|
|
} label: {
|
|
Label("刷新", systemImage: "arrow.clockwise").font(.system(size: 12))
|
|
}
|
|
.buttonStyle(.plain)
|
|
.disabled(appState.isLoading)
|
|
|
|
Spacer()
|
|
|
|
Button { sortByChange.toggle() } label: {
|
|
Label("排序", systemImage: sortByChange ? "arrow.up.arrow.down.circle.fill" : "arrow.up.arrow.down.circle")
|
|
.font(.system(size: 12))
|
|
.foregroundColor(sortByChange ? .accentColor : .primary)
|
|
}
|
|
.buttonStyle(.plain)
|
|
|
|
Spacer()
|
|
|
|
Button { showSettings = true } label: {
|
|
Label("设置", systemImage: "gearshape").font(.system(size: 12))
|
|
}
|
|
.buttonStyle(.plain)
|
|
|
|
Spacer()
|
|
|
|
Button { NSApplication.shared.terminate(nil) } label: {
|
|
Label("退出", systemImage: "xmark.circle").font(.system(size: 12))
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
.padding(.horizontal, 8)
|
|
.padding(.top, 4)
|
|
}
|
|
}
|