SettingsCardBodies.kt

27.4 KB · raw

1package com.peachpasswords.ui.settings23import android.content.Intent4import android.net.Uri5import androidx.compose.animation.AnimatedVisibility6import androidx.compose.animation.core.animateDpAsState7import androidx.compose.foundation.background8import androidx.compose.foundation.border9import androidx.compose.foundation.clickable10import androidx.compose.foundation.layout.Arrangement11import androidx.compose.foundation.layout.Box12import androidx.compose.foundation.layout.Column13import androidx.compose.foundation.layout.FlowRow14import androidx.compose.foundation.layout.ExperimentalLayoutApi15import androidx.compose.foundation.layout.Row16import androidx.compose.foundation.layout.RowScope17import androidx.compose.foundation.layout.Spacer18import androidx.compose.foundation.layout.fillMaxWidth19import androidx.compose.foundation.layout.height20import androidx.compose.foundation.layout.padding21import androidx.compose.foundation.layout.size22import androidx.compose.foundation.layout.width23import androidx.compose.foundation.shape.CircleShape24import androidx.compose.foundation.shape.RoundedCornerShape25import androidx.compose.foundation.text.BasicTextField26import androidx.compose.runtime.Composable27import androidx.compose.runtime.collectAsState28import androidx.compose.runtime.getValue29import androidx.compose.runtime.mutableStateOf30import androidx.compose.runtime.remember31import androidx.compose.runtime.rememberCoroutineScope32import androidx.compose.runtime.setValue33import androidx.compose.ui.Alignment34import androidx.compose.ui.Modifier35import androidx.compose.ui.draw.clip36import androidx.compose.ui.graphics.Color37import androidx.compose.ui.graphics.SolidColor38import androidx.compose.ui.platform.LocalContext39import androidx.compose.ui.text.TextStyle40import androidx.compose.ui.text.font.FontStyle41import androidx.compose.ui.text.input.PasswordVisualTransformation42import androidx.compose.ui.unit.Dp43import androidx.compose.ui.unit.dp44import androidx.compose.ui.unit.em45import androidx.compose.ui.unit.sp46import androidx.compose.material3.Text47import com.peachpasswords.ui.PeachNav48import com.peachpasswords.ui.theme.ACCENT_COLORS49import com.peachpasswords.ui.theme.PeachType50import com.peachpasswords.vault.VaultSettings51import kotlinx.coroutines.launch5253private const val PRO_URL = "https://buy.polar.sh/polar_cl_IXSFIPojx67rcOTksn8LkH5mnU3osPHtYqBIl1eyuIz"5455/**56 * Body content for the active stack card. Everything is tinted with the card's57 * own foreground [fg] (the browser's `currentColor` convention), so each card's58 * rows inherit its palette. Rows whose backend doesn't exist yet (duress,59 * canary, license activation) render their browser visual but defer the action60 * to a later phase — noted inline where that's the case.61 */62@Composable63fun CardBody(64    id: CardId,65    fg: Color,66    vm: SettingsViewModel,67    settings: VaultSettings,68    entriesCount: Int,69    onNavigate: (PeachNav) -> Unit,70) {71    when (id) {72        CardId.Appearance -> AppearanceBody(fg, vm, settings)73        CardId.Protection -> ProtectionBody(fg, vm, settings, onNavigate)74        CardId.Vault -> VaultBody(fg, vm, settings, entriesCount, onNavigate)75        CardId.Sync -> SyncBody(fg, onNavigate)76        CardId.Shortcuts -> ShortcutsBody(fg)77        CardId.Pro -> ProBody(fg, vm)78        CardId.Feedback -> FeedbackBody(fg)79    }80}8182/* ─────────────────────────  shared row vocabulary  ───────────────────────── */8384@Composable85private fun SubLabel(text: String, fg: Color, top: Dp = 14.dp) {86    Text(87        text,88        modifier = Modifier.padding(top = top, bottom = 4.dp),89        color = fg.copy(alpha = 0.58f),90        fontFamily = PeachType.Mono,91        fontSize = 8.sp,92        letterSpacing = 0.22.em,93    )94}9596@Composable97private fun RowLine(fg: Color, content: @Composable RowScope.() -> Unit) {98    Row(99        Modifier.fillMaxWidth().padding(vertical = 9.dp),100        verticalAlignment = Alignment.CenterVertically,101        horizontalArrangement = Arrangement.SpaceBetween,102        content = content,103    )104    Box(Modifier.fillMaxWidth().height(1.dp).background(fg.copy(alpha = 0.12f)))105}106107@Composable108private fun RowScope.Name(text: String, fg: Color) {109    Text(text, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp, modifier = Modifier.weight(1f))110}111112@Composable113private fun ValueText(text: String, fg: Color) {114    Text(text, color = fg.copy(alpha = 0.7f), fontFamily = PeachType.Mono, fontSize = 11.sp)115}116117@Composable118private fun SubtleButton(label: String, fg: Color, onClick: () -> Unit) {119    Box(120        Modifier.clip(RoundedCornerShape(8.dp))121            .border(1.dp, fg.copy(alpha = 0.28f), RoundedCornerShape(8.dp))122            .background(fg.copy(alpha = 0.08f))123            .clickable(onClick = onClick)124            .padding(horizontal = 12.dp, vertical = 6.dp),125    ) {126        Text(label, color = fg, fontFamily = PeachType.Mono, fontSize = 11.sp)127    }128}129130@Composable131private fun Toggle(on: Boolean, fg: Color, onToggle: (Boolean) -> Unit) {132    val knob by animateDpAsState(if (on) 16.dp else 2.dp, label = "knob")133    Box(134        Modifier.size(width = 34.dp, height = 20.dp).clip(RoundedCornerShape(999.dp))135            .background(if (on) fg.copy(alpha = 0.28f) else fg.copy(alpha = 0.08f))136            .border(1.dp, fg.copy(alpha = if (on) 0.5f else 0.32f), RoundedCornerShape(999.dp))137            .clickable { onToggle(!on) },138    ) {139        Box(140            Modifier.padding(top = 2.dp).width(16.dp).fillMaxWidth().height(16.dp)141                .padding(start = knob - 2.dp)142                .size(14.dp).clip(CircleShape)143                .background(if (on) fg else fg.copy(alpha = 0.58f)),144        )145    }146}147148@Composable149private fun Pill(label: String, active: Boolean, fg: Color, onClick: () -> Unit) {150    Box(151        Modifier.clip(RoundedCornerShape(999.dp))152            .border(1.dp, fg.copy(alpha = if (active) 0.55f else 0.32f), RoundedCornerShape(999.dp))153            .background(if (active) fg.copy(alpha = 0.18f) else Color.Transparent)154            .clickable(onClick = onClick)155            .padding(horizontal = 12.dp, vertical = 5.dp),156    ) {157        Text(label, color = fg, fontFamily = PeachType.Mono, fontSize = 10.sp)158    }159}160161@Composable162private fun ProBadge(fg: Color) {163    Box(164        Modifier.padding(start = 6.dp).clip(RoundedCornerShape(4.dp))165            .background(fg.copy(alpha = 0.16f)).padding(horizontal = 5.dp, vertical = 1.dp),166    ) {167        Text("Pro", color = fg.copy(alpha = 0.85f), fontFamily = PeachType.Mono, fontSize = 8.sp)168    }169}170171@Composable172private fun Hint(text: String, fg: Color) {173    Text(174        text,175        modifier = Modifier.padding(top = 6.dp),176        color = fg.copy(alpha = 0.6f),177        fontFamily = PeachType.Display,178        fontStyle = FontStyle.Italic,179        fontSize = 11.5.sp,180        lineHeight = 16.sp,181    )182}183184/* ──────────────────────────────  Appearance  ─────────────────────────────── */185186@OptIn(ExperimentalLayoutApi::class)187@Composable188private fun AppearanceBody(fg: Color, vm: SettingsViewModel, s: VaultSettings) {189    SubLabel("THEME", fg, top = 0.dp)190    RowLine(fg) {191        Name("Theme", fg)192        SubtleButton(if (s.theme == "dark") "Switch to light" else "Switch to dark", fg) {193            vm.setTheme(if (s.theme == "dark") "light" else "dark")194        }195    }196    SubLabel("ACCENT", fg)197    FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {198        ACCENT_COLORS.forEach { (name, color) ->199            Box(200                Modifier.size(22.dp).clip(CircleShape).background(color)201                    .border(202                        if (s.accentColor == name) 2.dp else 1.dp,203                        if (s.accentColor == name) fg else fg.copy(alpha = 0.2f),204                        CircleShape,205                    )206                    .clickable { vm.setAccent(name) },207            )208        }209    }210    SubLabel("TEXT SIZE", fg)211    RowLine(fg) {212        Name("Size", fg)213        Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {214            Pill("Default", s.textSize == "medium", fg) { vm.setTextSize("medium") }215            Pill("Large", s.textSize == "large", fg) { vm.setTextSize("large") }216        }217    }218    SubLabel("MOTION", fg)219    RowLine(fg) {220        Name("Reduce motion", fg)221        SubtleButton(if (s.reduceMotion) "On" else "Off", fg) { vm.setReduceMotion(!s.reduceMotion) }222    }223}224225/* ──────────────────────────────  Protection  ─────────────────────────────── */226227@Composable228private fun ProtectionBody(fg: Color, vm: SettingsViewModel, s: VaultSettings, onNavigate: (PeachNav) -> Unit) {229    val lockOptions = listOf(1 to "1 minute", 5 to "5 minutes", 15 to "15 minutes", 30 to "30 minutes", 0 to "Never")230    val current = s.autoLockMinutes ?: 0231232    SubLabel("LOCKING", fg, top = 0.dp)233    RowLine(fg) {234        Name("Auto-lock after", fg)235        val idx = lockOptions.indexOfFirst { it.first == current }.coerceAtLeast(0)236        SubtleButton(lockOptions[idx].second, fg) {237            val next = lockOptions[(idx + 1) % lockOptions.size].first238            vm.setAutoLockMinutes(if (next == 0) 0 else next)239        }240    }241    SubLabel("BIOMETRICS", fg)242    val bioActivity = LocalContext.current as? androidx.fragment.app.FragmentActivity243    RowLine(fg) {244        Name("Unlock with biometrics", fg)245        Toggle(s.biometricsEnabled, fg) { on ->246            if (on && bioActivity != null) vm.enableBiometrics(bioActivity) else vm.disableBiometrics()247        }248    }249    val bioError = com.peachpasswords.ui.lock.Biometrics.statusMessage(LocalContext.current)250    if (bioError != null) {251        Text(252            bioError,253            color = com.peachpasswords.ui.theme.PeachColors.Breach,254            fontFamily = PeachType.Mono, fontSize = 10.sp,255            modifier = Modifier.padding(start = 2.dp, top = 2.dp, bottom = 4.dp),256        )257    }258    SubLabel("RECOVERY", fg)259    RowLine(fg) {260        Name("View recovery words", fg)261        SubtleButton("view", fg) { onNavigate(PeachNav.RecoveryView) }262    }263    SubLabel("BREACH PROTECTION", fg)264    RowLine(fg) {265        Name("Breach monitoring", fg)266        Toggle(s.breachMonitoring, fg) { vm.setBreachMonitoring(it) }267    }268269    SubLabel("MASTER PASSWORD", fg)270    ChangePasswordRow(fg, vm)271272    SubLabel("DURESS PASSWORD", fg)273    RowLine(fg) {274        Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {275            Name("Duress password", fg); ProBadge(fg)276        }277        ValueText("off", fg)278    }279    Hint("If entered under coercion, a decoy empty vault opens; your real vault stays hidden. Arrives with Pro sync.", fg)280}281282@Composable283private fun ChangePasswordRow(fg: Color, vm: SettingsViewModel) {284    var open by remember { mutableStateOf(false) }285    var current by remember { mutableStateOf("") }286    var next by remember { mutableStateOf("") }287    var confirm by remember { mutableStateOf("") }288    var error by remember { mutableStateOf<String?>(null) }289    var done by remember { mutableStateOf(false) }290    val scope = rememberCoroutineScope()291292    RowLine(fg) {293        Name("Master password", fg)294        SubtleButton(if (open) "cancel" else "change", fg) { open = !open; error = null; done = false }295    }296    AnimatedVisibility(open) {297        Column(Modifier.fillMaxWidth().padding(top = 8.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {298            PwField("current password", current, fg) { current = it }299            PwField("new password (min 12 chars)", next, fg) { next = it }300            PwField("confirm new password", confirm, fg) { confirm = it }301            error?.let { Text(it, color = Color(0xFFE5805C), fontFamily = PeachType.Mono, fontSize = 10.sp) }302            if (done) Text("password changed ✓", color = fg, fontFamily = PeachType.Mono, fontSize = 10.sp)303            SubtleButton("save new password", fg) {304                error = when {305                    current.isBlank() -> "enter your current password"306                    next.length < 12 -> "new password must be at least 12 characters"307                    next != confirm -> "new passwords do not match"308                    next == current -> "new password must differ from current"309                    else -> null310                }311                if (error == null) scope.launch {312                    if (vm.changePassword(current, next)) {313                        current = ""; next = ""; confirm = ""; open = false; done = true314                    } else error = "incorrect current password"315                }316            }317        }318    }319}320321@Composable322private fun PwField(placeholder: String, value: String, fg: Color, onChange: (String) -> Unit) {323    Box(324        Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp))325            .background(Color(0x2E000000))326            .border(1.dp, fg.copy(alpha = 0.22f), RoundedCornerShape(8.dp))327            .padding(horizontal = 10.dp, vertical = 10.dp),328    ) {329        if (value.isEmpty()) {330            Text(placeholder, color = fg.copy(alpha = 0.42f), fontFamily = PeachType.Mono, fontSize = 12.sp)331        }332        BasicTextField(333            value = value,334            onValueChange = onChange,335            singleLine = true,336            textStyle = TextStyle(color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp),337            cursorBrush = SolidColor(fg),338            visualTransformation = PasswordVisualTransformation(),339            modifier = Modifier.fillMaxWidth(),340        )341    }342}343344/* ────────────────────────────────  Vault  ───────────────────────────────── */345346@Composable347private fun VaultBody(348    fg: Color,349    vm: SettingsViewModel,350    s: VaultSettings,351    entriesCount: Int,352    onNavigate: (PeachNav) -> Unit,353) {354    val trashOptions = listOf(7 to "7 days", 30 to "30 days", 90 to "90 days", 0 to "Never")355    val current = s.trashRetentionDays ?: 0356    val isPro by vm.isPro.collectAsState()357358    SubLabel("ENTRIES", fg, top = 0.dp)359    RowLine(fg) { Name("Entries", fg); ValueText("$entriesCount", fg) }360361    SubLabel("MAINTENANCE", fg)362    RowLine(fg) {363        Name("Trash auto-delete", fg)364        val idx = trashOptions.indexOfFirst { it.first == current }.coerceAtLeast(0)365        SubtleButton(trashOptions[idx].second, fg) {366            vm.setTrashRetentionDays(trashOptions[(idx + 1) % trashOptions.size].first)367        }368    }369    RowLine(fg) { Name("Advanced Vault Health", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Health) } }370    RowLine(fg) { Name("Trash", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Trash) } }371372    SubLabel("DATA", fg)373    RowLine(fg) { Name("Import passwords", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Import) } }374    RowLine(fg) { Name("Export backup", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Export) } }375    RowLine(fg) {376        Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) { Name("Peach Codex", fg); if (!isPro) ProBadge(fg) }377        SubtleButton(if (isPro) "open" else "Pro", fg) { if (isPro) onNavigate(PeachNav.CodexGenerate) }378    }379    RowLine(fg) { Name("Restore from Codex", fg); SubtleButton("open", fg) { onNavigate(PeachNav.CodexRestore) } }380381    var advancedOpen by remember { mutableStateOf(false) }382    SubLabel("ADVANCED", fg)383    RowLine(fg) {384        Name("Advanced", fg)385        SubtleButton(if (advancedOpen) "hide" else "show", fg) { advancedOpen = !advancedOpen }386    }387    if (advancedOpen) {388        RowLine(fg) {389            Name("Replace vault from backup", com.peachpasswords.ui.theme.PeachColors.SyncBusy)390            SubtleButton("open", com.peachpasswords.ui.theme.PeachColors.SyncBusy) { onNavigate(PeachNav.Import) }391        }392        RowLine(fg) {393            Name("Destroy vault", com.peachpasswords.ui.theme.PeachColors.Breach)394            SubtleButton("destroy", com.peachpasswords.ui.theme.PeachColors.Breach) { onNavigate(PeachNav.Panic) }395        }396    }397}398399/* ────────────────────────────────  Sync  ────────────────────────────────── */400401@Composable402private fun SyncBody(fg: Color, onNavigate: (PeachNav) -> Unit) {403    SubLabel("PAIRING", fg, top = 0.dp)404    RowLine(fg) {405        Column(Modifier.weight(1f)) {406            Row(verticalAlignment = Alignment.CenterVertically) {407                Text("Peach Sync", color = fg, fontFamily = PeachType.Body, fontSize = 13.sp); ProBadge(fg)408            }409            Text(410                "Pair nearby devices by chirp and keep encrypted vault blobs in step without a central account.",411                color = fg.copy(alpha = 0.7f), fontFamily = PeachType.Body, fontSize = 11.sp, lineHeight = 16.sp,412                modifier = Modifier.padding(top = 2.dp),413            )414        }415    }416    RowLine(fg) { Name("Status", fg); ValueText("Requires Pro", fg) }417    RowLine(fg) { Name("Sync hub", fg); SubtleButton("open", fg) { onNavigate(PeachNav.ChirpPair) } }418419    SubLabel("DEVICE FLOW", fg)420    RowLine(fg) { Name("Pair new device", fg); SubtleButton("pair", fg) { onNavigate(PeachNav.ChirpPair) } }421    Hint("Sync uses the same zero-knowledge vault format as backup and restore; pairing authorizes a device, not a cloud account.", fg)422}423424/* ──────────────────────────────  Shortcuts  ──────────────────────────────── */425426@Composable427private fun ShortcutsBody(fg: Color) {428    val bindings = listOf(429        "Copy password" to "⌘C", "Copy username" to "⌘⇧C", "Open entry" to "↵",430        "Edit entry" to "E", "New entry" to "⌘N", "Search" to "/",431    )432    SubLabel("KEYBINDINGS", fg, top = 0.dp)433    Hint("Shortcuts apply when a hardware keyboard is attached. Defaults shown below.", fg)434    Spacer(Modifier.height(8.dp))435    bindings.forEach { (label, key) ->436        RowLine(fg) {437            Name(label, fg)438            Box(439                Modifier.clip(RoundedCornerShape(4.dp)).background(fg.copy(alpha = 0.06f))440                    .border(1.dp, fg.copy(alpha = 0.32f), RoundedCornerShape(4.dp))441                    .padding(horizontal = 7.dp, vertical = 2.dp),442            ) { Text(key, color = fg, fontFamily = PeachType.Mono, fontSize = 10.sp) }443        }444    }445}446447/* ────────────────────────────────  Pro  ─────────────────────────────────── */448449@Composable450private fun ProBody(fg: Color, vm: SettingsViewModel) {451    val ctx = LocalContext.current452    val isPro by vm.isPro.collectAsState()453    if (isPro) {454        ProActiveBody(fg, vm)455        return456    }457    val features = listOf(458        "Peach Sync" to "Encrypted · peer-to-peer",459        "Peach Codex" to "Restore from paper",460        "Passkeys" to "Zero-knowledge WebAuthn",461        "Advanced Vault Health" to "Reuse · age · exposure",462        "Canary entries" to "Detects vault compromise",463        "Duress vault" to "Decoy under coercion",464    )465    Text("PEACH PRO · ONE-TIME", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 8.sp, letterSpacing = 0.22.em)466    Text(467        "Everything, everywhere.",468        modifier = Modifier.padding(top = 8.dp),469        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 24.sp,470    )471    Text(472        "One key unlocks every Pro feature — for the lifetime of the app.",473        modifier = Modifier.padding(top = 6.dp),474        color = fg.copy(alpha = 0.72f), fontFamily = PeachType.Body, fontSize = 12.sp, lineHeight = 17.sp,475    )476    Spacer(Modifier.height(12.dp))477    features.forEachIndexed { i, (name, desc) ->478        RowLine(fg) {479            Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {480                Text("%02d".format(i + 1), color = fg.copy(alpha = 0.5f), fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(end = 10.dp))481                Text(name, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp)482            }483            Text(desc, color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 11.sp)484        }485    }486    Spacer(Modifier.height(14.dp))487    Text(488        "$39",489        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 28.sp,490    )491    Text("once · yours forever", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 9.sp, letterSpacing = 0.18.em)492    Spacer(Modifier.height(10.dp))493    Box(494        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))495            .background(fg.copy(alpha = 0.16f))496            .border(1.dp, fg.copy(alpha = 0.4f), RoundedCornerShape(10.dp))497            .clickable {498                runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(PRO_URL))) }499            }500            .padding(vertical = 12.dp),501        contentAlignment = Alignment.Center,502    ) { Text("Get Peach Pro", color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp) }503504    Spacer(Modifier.height(16.dp))505    Text("LICENSE KEY", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 8.sp, letterSpacing = 0.22.em)506    var key by remember { mutableStateOf("") }507    val activating by vm.activating.collectAsState()508    val activationError by vm.activationError.collectAsState()509    Box(510        Modifier.fillMaxWidth().padding(top = 6.dp)511            .border(1.dp, fg.copy(alpha = 0.3f), RoundedCornerShape(8.dp))512            .padding(horizontal = 12.dp, vertical = 10.dp),513    ) {514        BasicTextField(515            value = key,516            onValueChange = { key = it.uppercase(); vm.clearActivationError() },517            singleLine = true,518            textStyle = TextStyle(fontFamily = PeachType.Mono, fontSize = 13.sp, letterSpacing = 0.12.em, color = fg),519            cursorBrush = SolidColor(fg),520            modifier = Modifier.fillMaxWidth(),521            decorationBox = { inner ->522                if (key.isEmpty()) Text("PPK-XXXX-XXXX-XXXX", color = fg.copy(alpha = 0.3f), fontFamily = PeachType.Mono, fontSize = 13.sp, letterSpacing = 0.12.em)523                inner()524            },525        )526    }527    if (activationError != null) {528        Text(activationError!!, color = com.peachpasswords.ui.theme.PeachColors.Breach, fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(top = 6.dp))529    }530    Spacer(Modifier.height(8.dp))531    Box(532        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))533            .background(fg.copy(alpha = if (activating || key.isBlank()) 0.08f else 0.16f))534            .border(1.dp, fg.copy(alpha = 0.4f), RoundedCornerShape(10.dp))535            .clickable(enabled = !activating && key.isNotBlank()) { vm.activateLicense(key) }536            .padding(vertical = 12.dp),537        contentAlignment = Alignment.Center,538    ) { Text(if (activating) "Activating…" else "Activate", color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp) }539}540541@Composable542private fun ProActiveBody(fg: Color, vm: SettingsViewModel) {543    val features = listOf("Peach Sync", "Peach Codex", "Passkeys", "Advanced Vault Health", "Canary entries", "Duress vault")544    Box(Modifier.fillMaxWidth().padding(vertical = 8.dp), contentAlignment = Alignment.Center) {545        com.peachpasswords.ui.components.PeachMark(size = 60.dp)546    }547    Text(548        "Peach Pro",549        modifier = Modifier.fillMaxWidth(),550        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 26.sp,551        textAlign = androidx.compose.ui.text.style.TextAlign.Center,552    )553    Text(554        "active · yours forever",555        modifier = Modifier.fillMaxWidth().padding(top = 4.dp),556        color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 9.sp, letterSpacing = 0.18.em,557        textAlign = androidx.compose.ui.text.style.TextAlign.Center,558    )559    Spacer(Modifier.height(12.dp))560    features.forEachIndexed { i, name ->561        RowLine(fg) {562            Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {563                Text("%02d".format(i + 1), color = fg.copy(alpha = 0.5f), fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(end = 10.dp))564                Text(name, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp)565            }566            Text("unlocked", color = com.peachpasswords.ui.theme.PeachColors.HealthOk, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 11.sp)567        }568    }569    Spacer(Modifier.height(12.dp))570    Box(571        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))572            .border(1.dp, com.peachpasswords.ui.theme.PeachColors.Breach.copy(alpha = 0.4f), RoundedCornerShape(10.dp))573            .clickable { vm.deactivate() }574            .padding(vertical = 12.dp),575        contentAlignment = Alignment.Center,576    ) { Text("Deactivate", color = com.peachpasswords.ui.theme.PeachColors.Breach, fontFamily = PeachType.Mono, fontSize = 12.sp) }577}578579/* ──────────────────────────────  Feedback  ───────────────────────────────── */580581@OptIn(ExperimentalLayoutApi::class)582@Composable583private fun FeedbackBody(fg: Color) {584    val categories = listOf("Bug report", "Feature request", "Question", "Other")585    var category by remember { mutableStateOf(categories[0]) }586    var message by remember { mutableStateOf("") }587    var sent by remember { mutableStateOf(false) }588589    if (sent) {590        Box(591            Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp)).background(fg.copy(alpha = 0.08f))592                .border(1.dp, fg.copy(alpha = 0.32f), RoundedCornerShape(10.dp)).padding(16.dp),593        ) {594            Column {595                Text("Thank you", color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 18.sp)596                Text("Your note is in the queue. Someone will process it soon.", color = fg.copy(alpha = 0.7f), fontFamily = PeachType.Body, fontSize = 12.sp, modifier = Modifier.padding(top = 4.dp))597            }598        }599        return600    }601602    Text("Help us improve Peach. Every report goes directly to our inbox.", color = fg.copy(alpha = 0.7f), fontFamily = PeachType.Body, fontSize = 12.sp, lineHeight = 17.sp)603    SubLabel("TYPE", fg)604    FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {605        categories.forEach { cat -> Pill(cat, category == cat, fg) { category = cat } }606    }607    SubLabel("MESSAGE", fg)608    Box(609        Modifier.fillMaxWidth().height(110.dp).clip(RoundedCornerShape(8.dp))610            .background(Color(0x2E000000)).border(1.dp, fg.copy(alpha = 0.22f), RoundedCornerShape(8.dp))611            .padding(10.dp),612    ) {613        if (message.isEmpty()) Text("Describe the issue or idea...", color = fg.copy(alpha = 0.42f), fontFamily = PeachType.Body, fontSize = 12.sp)614        BasicTextField(615            value = message, onValueChange = { message = it },616            textStyle = TextStyle(color = fg, fontFamily = PeachType.Body, fontSize = 12.sp),617            cursorBrush = SolidColor(fg), modifier = Modifier.fillMaxWidth(),618        )619    }620    Spacer(Modifier.height(8.dp))621    SubtleButton("Send", fg) { if (message.isNotBlank()) sent = true }622    Hint("Sent anonymously · no account required", fg)623}