| | |
| | | Color(red: 0.56, green: 0.35, blue: 0.03) |
| | | } |
| | | |
| | | @ViewBuilder |
| | | private func proHeaderStatusLabel(compact: Bool = false) -> some View { |
| | | if proEntitlement.accessState == .free && !proEntitlement.isPreviewingProAppearance { |
| | | Text(tr("settings.proStatus.freeUser")) |
| | | .font(.system(size: compact ? 12 : 13, weight: .semibold)) |
| | | .foregroundStyle(.secondary) |
| | | .lineLimit(1) |
| | | .minimumScaleFactor(0.82) |
| | | } else { |
| | | ProStatusPill( |
| | | text: tr(proEntitlement.compactStatusTextKey), |
| | | style: proStatusPillStyle, |
| | | compact: compact |
| | | ) |
| | | } |
| | | } |
| | | |
| | | private func centeredSettingsScrollContent<Content: View>( |
| | | width: CGFloat, |
| | | @ViewBuilder content: @escaping () -> Content |
| | |
| | | compact: Bool = false |
| | | ) -> some View { |
| | | HStack(spacing: compact ? 8 : 12) { |
| | | ProStatusPill( |
| | | text: tr(proEntitlement.compactStatusTextKey), |
| | | style: proStatusPillStyle |
| | | ) |
| | | proHeaderStatusLabel(compact: compact) |
| | | .layoutPriority(1) |
| | | |
| | | Text(tr(textKey)) |
| | |
| | | } |
| | | |
| | | switch selectedTab { |
| | | case .general, .language, .about: |
| | | case .language, .about: |
| | | return "" |
| | | case .general: |
| | | return tr(proEntitlement.isUnlocked ? "settings.proBenefit.general" : "settings.proGuide.general") |
| | | case .theme: |
| | | return themeStatusSummary |
| | |
| | | } |
| | | |
| | | private var shouldShowSettingsFixedProHeader: Bool { |
| | | selectedTab != .language && selectedTab != .about |
| | | true |
| | | } |
| | | |
| | | private var shouldCenterUnlockedIdentityHeader: Bool { |
| | | guard proEntitlement.isUnlocked else { return false } |
| | | switch selectedTab { |
| | | case .language, .pro, .about: |
| | | return true |
| | | case .general, .theme, .hotkeys, .tags, .data: |
| | | return false |
| | | } |
| | | } |
| | | |
| | | private var settingsFixedProHeader: some View { |
| | | HStack { |
| | | HStack(spacing: 12) { |
| | | if selectedTab != .pro { |
| | | if shouldCenterUnlockedIdentityHeader { |
| | | Spacer(minLength: 0) |
| | | |
| | | ProStatusPill( |
| | | text: tr(proEntitlement.compactStatusTextKey), |
| | | style: proStatusPillStyle |
| | | text: tr("pro.status.unlocked"), |
| | | style: .unlocked, |
| | | compact: true |
| | | ) |
| | | .layoutPriority(1) |
| | | |
| | | Text(tr("settings.proStatus.proUser")) |
| | | .font(.system(size: 13, weight: .medium)) |
| | | .foregroundStyle(.secondary) |
| | | .lineLimit(1) |
| | | .fixedSize(horizontal: false, vertical: true) |
| | | .layoutPriority(2) |
| | | |
| | | Spacer(minLength: 0) |
| | | } else { |
| | | if selectedTab != .pro { |
| | | proHeaderStatusLabel(compact: true) |
| | | .layoutPriority(1) |
| | | } |
| | | |
| | | if !settingsProHeaderText.isEmpty { |
| | | Text(settingsProHeaderText) |
| | | .font(.system(size: 13, weight: .medium)) |
| | | .foregroundStyle(.secondary) |
| | | .lineLimit(2) |
| | | .fixedSize(horizontal: false, vertical: true) |
| | | .layoutPriority(2) |
| | | } |
| | | |
| | | Spacer(minLength: 8) |
| | | |
| | |
| | | .buttonStyle(.bordered) |
| | | .controlSize(.small) |
| | | .layoutPriority(3) |
| | | } |
| | | } |
| | | } |
| | | .padding(.horizontal, 16) |
| | |
| | | Text(tr("settings.proCompare.free")) |
| | | .font(.system(size: 12, weight: .semibold)) |
| | | .foregroundStyle(.secondary) |
| | | .frame(width: 118, alignment: .center) |
| | | .frame(width: 118, alignment: .leading) |
| | | HStack(spacing: 4) { |
| | | Image(systemName: "crown") |
| | | .font(.system(size: 12, weight: .semibold)) |
| | |
| | | .foregroundStyle(proAccentColor) |
| | | .lineLimit(1) |
| | | .minimumScaleFactor(0.82) |
| | | .frame(width: 118, alignment: .center) |
| | | .frame(width: 118, alignment: .leading) |
| | | } |
| | | |
| | | ForEach(proTabComparisonFeatures) { feature in |
| | |
| | | style: feature.freeStyle, |
| | | compact: true |
| | | ) |
| | | .frame(width: 118, alignment: .center) |
| | | .frame(width: 118, alignment: .leading) |
| | | |
| | | ProStatusPill( |
| | | text: tr(proStatusKey), |
| | | style: proStyle, |
| | | compact: true |
| | | ) |
| | | .frame(width: 118, alignment: .center) |
| | | .frame(width: 118, alignment: .leading) |
| | | } |
| | | .padding(.horizontal, 10) |
| | | .padding(.vertical, 8) |
| | |
| | | proUnlockedBenefitLine("pro.theme.status.unlocked", bottomPadding: 0) |
| | | } else { |
| | | HStack(spacing: 12) { |
| | | ProStatusPill( |
| | | text: tr(proEntitlement.compactStatusTextKey), |
| | | style: proStatusPillStyle |
| | | ) |
| | | proHeaderStatusLabel() |
| | | |
| | | Text(themeStatusSummary) |
| | | .font(.system(size: 13, weight: .medium)) |