| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- import SwiftUI
- struct SettingsView: View {
- @Bindable var viewModel: SettingsViewModel
- private enum Layout {
- static let horizontalPadding: CGFloat = 24
- }
- var body: some View {
- VStack(spacing: 0) {
- header
- ScrollView {
- VStack(alignment: .leading, spacing: 12) {
- shareSection
- linksSection
- }
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(.horizontal, Layout.horizontalPadding)
- .padding(.top, 12)
- .padding(.bottom, 24)
- }
- }
- .background(AppTheme.background)
- }
- private var header: some View {
- HStack(spacing: 14) {
- ModernSidebarIconView(kind: .settings, size: 40)
- VStack(alignment: .leading, spacing: 2) {
- Text("Settings")
- .font(.system(size: 18, weight: .semibold))
- .foregroundStyle(AppTheme.textPrimary)
- Text("Manage app preferences")
- .font(.system(size: 11))
- .foregroundStyle(AppTheme.textSecondary)
- }
- Spacer()
- }
- .padding(.horizontal, 24)
- .padding(.vertical, 16)
- .overlay(alignment: .bottom) {
- Rectangle()
- .fill(AppTheme.border)
- .frame(height: 1)
- }
- }
- private var shareSection: some View {
- PostFormCard(
- title: "Share",
- subtitle: "Spread the word about \(AppLinks.appName)"
- ) {
- SettingsShareAppButton(
- message: viewModel.shareMessage,
- url: viewModel.shareURL
- )
- }
- }
- private var linksSection: some View {
- PostFormCard(
- title: "About",
- subtitle: "Website, legal, and help resources"
- ) {
- VStack(spacing: 8) {
- SettingsLinkRow(
- icon: "globe",
- title: "Website",
- subtitle: AppLinks.website.host
- ) {
- viewModel.openWebsite()
- }
- SettingsLinkRow(
- icon: "hand.raised.fill",
- title: "Privacy Policy",
- subtitle: "How we handle your data"
- ) {
- viewModel.openPrivacyPolicy()
- }
- SettingsLinkRow(
- icon: "doc.text.fill",
- title: "Terms & Conditions",
- subtitle: "Terms of service"
- ) {
- viewModel.openTermsAndConditions()
- }
- SettingsLinkRow(
- icon: "lifepreserver.fill",
- title: "Support",
- subtitle: "Get help or send feedback"
- ) {
- viewModel.openSupport()
- }
- }
- }
- }
- }
- #Preview {
- SettingsView(viewModel: SettingsViewModel())
- .frame(width: 800, height: 600)
- }
|