feat(menubar): 实现紧凑独立双列与按内容定高
This commit is contained in:
@@ -24,8 +24,8 @@ extension MenuPanelView {
|
||||
symbol: "arrow.up", color: Color("SeriesUpload"))
|
||||
Divider().frame(height: 32)
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
HStack {
|
||||
Text("network.status").foregroundStyle(.secondary)
|
||||
HStack(spacing: 4) {
|
||||
Circle().fill(networkStatusColor).frame(width: 5, height: 5)
|
||||
Picker("panel.interface", selection: $selectedInterface) {
|
||||
Text("network.all").tag("")
|
||||
ForEach(snapshot.network ?? [], id: \.identity) { item in
|
||||
@@ -33,33 +33,29 @@ extension MenuPanelView {
|
||||
}
|
||||
}.labelsHidden().controlSize(.mini).fixedSize()
|
||||
}
|
||||
HStack(spacing: 4) {
|
||||
Circle().fill(networkStatusColor).frame(width: 5, height: 5)
|
||||
Text(networkStatusLabel)
|
||||
}
|
||||
Text(networkStatusLabel).help(Text(networkStatusLabel))
|
||||
}.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}.font(PanelStyle.label).lineLimit(1)
|
||||
CardSeparator()
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Text("network.addresses").font(PanelStyle.section)
|
||||
HStack(spacing: 8) {
|
||||
networkAddress("network.public", address: publicIPAddress)
|
||||
Divider().frame(height: 15)
|
||||
networkAddress(
|
||||
"network.local",
|
||||
address: addressInterface?.addresses.first(where: { !$0.contains(":") }) ?? addressInterface?.addresses.first)
|
||||
}
|
||||
HStack(spacing: 8) {
|
||||
networkAddress("network.public", address: publicIPAddress)
|
||||
Divider().frame(height: 15)
|
||||
networkAddress(
|
||||
"network.local",
|
||||
address: addressInterface?.addresses.first(where: { !$0.contains(":") }) ?? addressInterface?.addresses.first)
|
||||
}.font(PanelStyle.label)
|
||||
.modifier(CardInset())
|
||||
.accessibilityElement(children: .contain)
|
||||
.accessibilityLabel(Text("network.addresses"))
|
||||
}
|
||||
.modifier(PanelPublicIPRefresh(metrics: metrics, address: $publicIPAddress))
|
||||
}
|
||||
func networkAddress(_ title: LocalizedStringKey, address: String?) -> some View {
|
||||
HStack(spacing: 4) {
|
||||
HStack(spacing: 3) {
|
||||
Text(title).foregroundStyle(.secondary)
|
||||
Text(verbatim: address ?? "--").font(PanelStyle.value).monospacedDigit().textSelection(.enabled)
|
||||
.help(Text(verbatim: address ?? "--"))
|
||||
Spacer(minLength: 0)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
if let address {
|
||||
Button {
|
||||
NSPasteboard.general.clearContents()
|
||||
|
||||
Reference in New Issue
Block a user