This commit is contained in:
ZhangLei
2025-10-31 16:12:45 +08:00
parent 5969b7ae39
commit 50689c54a0

View File

@@ -105,40 +105,39 @@ struct PreferencesWindowView: View {
.labelsHidden() .labelsHidden()
} }
if tempProxyEnabled { // -
// VStack(alignment: .leading, spacing: 12) {
VStack(alignment: .leading, spacing: 12) { Text("代理服务器配置")
Text("代理服务器配置") .font(.caption)
.font(.caption) .foregroundColor(.secondary)
.foregroundColor(.secondary)
HStack(spacing: 12) { HStack(spacing: 12) {
// //
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
Text("服务器地址") Text("服务器地址")
.font(.caption) .font(.caption)
.foregroundColor(.secondary) .foregroundColor(.secondary)
TextField("例如: proxy.example.com", text: $tempProxyHost) TextField("例如: proxy.example.com", text: $tempProxyHost)
.textFieldStyle(RoundedBorderTextFieldStyle()) .textFieldStyle(RoundedBorderTextFieldStyle())
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
} .disabled(!tempProxyEnabled)
}
// //
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
Text("端口") Text("端口")
.font(.caption) .font(.caption)
.foregroundColor(.secondary) .foregroundColor(.secondary)
TextField("8080", text: $tempProxyPort) TextField("8080", text: $tempProxyPort)
.textFieldStyle(RoundedBorderTextFieldStyle()) .textFieldStyle(RoundedBorderTextFieldStyle())
.frame(width: 80) .frame(width: 80)
} .disabled(!tempProxyEnabled)
} }
} }
.transition(.opacity.combined(with: .scale(scale: 0.95)))
.animation(.easeInOut(duration: 0.2), value: tempProxyEnabled)
} }
.opacity(tempProxyEnabled ? 1.0 : 0.6) //
} }
} }
@@ -178,7 +177,7 @@ struct PreferencesWindowView: View {
.padding(.horizontal, 24) .padding(.horizontal, 24)
.padding(.vertical, 16) .padding(.vertical, 16)
} }
.frame(width: 480, height: 520) .frame(width: 480, height: 600)
.alert("配置验证", isPresented: $showingValidationError) { .alert("配置验证", isPresented: $showingValidationError) {
Button("确定", role: .cancel) { } Button("确定", role: .cancel) { }
} message: { } message: {
@@ -310,30 +309,31 @@ struct IntervalSelectionButton: View {
let onSelect: () -> Void let onSelect: () -> Void
var body: some View { var body: some View {
Button(action: onSelect) { HStack {
HStack { Image(systemName: isSelected ? "checkmark.circle.fill" : "circle")
Image(systemName: isSelected ? "checkmark.circle.fill" : "circle") .font(.system(size: 14))
.font(.system(size: 14)) .foregroundColor(isSelected ? .blue : .secondary)
.foregroundColor(isSelected ? .blue : .secondary)
Text(interval.displayText) Text(interval.displayText)
.font(.system(size: 13)) .font(.system(size: 13))
.fontWeight(isSelected ? .medium : .regular) .fontWeight(isSelected ? .medium : .regular)
Spacer() Spacer()
} }
.padding(.horizontal, 12) .padding(.horizontal, 12)
.padding(.vertical, 8) .padding(.vertical, 8)
.background( .background(
RoundedRectangle(cornerRadius: 6) RoundedRectangle(cornerRadius: 6)
.fill(isSelected ? Color.blue.opacity(0.1) : Color.clear) .fill(isSelected ? Color.blue.opacity(0.1) : Color.clear)
) )
.overlay( .overlay(
RoundedRectangle(cornerRadius: 6) RoundedRectangle(cornerRadius: 6)
.stroke(isSelected ? Color.blue : Color(NSColor.separatorColor), lineWidth: 1) .stroke(isSelected ? Color.blue : Color(NSColor.separatorColor), lineWidth: 1)
) )
.contentShape(RoundedRectangle(cornerRadius: 6)) //
.onTapGesture {
onSelect()
} }
.buttonStyle(PlainButtonStyle())
} }
} }