TheNoiseClock/TheNoiseClock/Features/Clock/Views/Components/Settings/OverlaySection.swift
Matt Bruce 089f8b9f7b localization
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
2026-02-09 13:22:50 -06:00

95 lines
4.1 KiB
Swift

//
// OverlaySection.swift
// TheNoiseClock
//
// Created by Matt Bruce on 9/7/25.
//
import SwiftUI
import Bedrock
struct OverlaySection: View {
@Binding var style: ClockStyle
private let dateFormats = Date.availableDateFormats()
var body: some View {
VStack(alignment: .leading, spacing: Design.Spacing.small) {
SettingsSectionHeader(
title: String(localized: "settings.overlays.section_title", defaultValue: "Overlays"),
systemImage: "rectangle.on.rectangle.angled",
accentColor: AppAccent.primary
)
SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) {
VStack(spacing: 0) {
SettingsToggle(
title: String(localized: "settings.overlays.battery_level.title", defaultValue: "Battery Level"),
subtitle: String(localized: "settings.overlays.battery_level.subtitle", defaultValue: "Show battery percentage"),
isOn: $style.showBattery,
accentColor: AppAccent.primary
)
Rectangle()
.fill(AppBorder.subtle)
.frame(height: 1)
.padding(.horizontal, Design.Spacing.medium)
SettingsToggle(
title: String(localized: "settings.overlays.date.title", defaultValue: "Date"),
subtitle: String(localized: "settings.overlays.date.subtitle", defaultValue: "Display the current date"),
isOn: $style.showDate,
accentColor: AppAccent.primary
)
Rectangle()
.fill(AppBorder.subtle)
.frame(height: 1)
.padding(.horizontal, Design.Spacing.medium)
SettingsToggle(
title: String(localized: "settings.overlays.next_alarm.title", defaultValue: "Next Alarm"),
subtitle: String(localized: "settings.overlays.next_alarm.subtitle", defaultValue: "Show your next scheduled alarm"),
isOn: $style.showNextAlarm,
accentColor: AppAccent.primary
)
Rectangle()
.fill(AppBorder.subtle)
.frame(height: 1)
.padding(.horizontal, Design.Spacing.medium)
SettingsToggle(
title: String(localized: "settings.overlays.noise_controls.title", defaultValue: "Noise Controls"),
subtitle: String(localized: "settings.overlays.noise_controls.subtitle", defaultValue: "Mini-player for white noise"),
isOn: $style.showNoiseControls,
accentColor: AppAccent.primary
)
if style.showDate {
Rectangle()
.fill(AppBorder.subtle)
.frame(height: 1)
.padding(.horizontal, Design.Spacing.medium)
SettingsNavigationRow(
title: String(localized: "settings.overlays.date_format.title", defaultValue: "Date Format"),
subtitle: style.dateFormat,
backgroundColor: .clear
) {
SettingsSelectionView(
selection: $style.dateFormat,
options: dateFormats.map { $0.1 },
title: String(localized: "settings.overlays.date_format.title", defaultValue: "Date Format"),
toString: { format in
dateFormats.first(where: { $0.1 == format })?.0 ?? format
}
)
}
}
}
}
}
}
}