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 ?: 0356357    SubLabel("ENTRIES", fg, top = 0.dp)358    RowLine(fg) { Name("Entries", fg); ValueText("$entriesCount", fg) }359360    SubLabel("MAINTENANCE", fg)361    RowLine(fg) {362        Name("Trash auto-delete", fg)363        val idx = trashOptions.indexOfFirst { it.first == current }.coerceAtLeast(0)364        SubtleButton(trashOptions[idx].second, fg) {365            vm.setTrashRetentionDays(trashOptions[(idx + 1) % trashOptions.size].first)366        }367    }368    RowLine(fg) { Name("Advanced Vault Health", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Health) } }369    RowLine(fg) { Name("Trash", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Trash) } }370371    SubLabel("DATA", fg)372    RowLine(fg) { Name("Import passwords", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Import) } }373    RowLine(fg) { Name("Export backup", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Export) } }374    RowLine(fg) {375        Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) { Name("Peach Codex", fg); ProBadge(fg) }376        SubtleButton("open", fg) { onNavigate(PeachNav.CodexGenerate) }377    }378    RowLine(fg) { Name("Restore from Codex", fg); SubtleButton("open", fg) { onNavigate(PeachNav.CodexRestore) } }379380    var advancedOpen by remember { mutableStateOf(false) }381    SubLabel("ADVANCED", fg)382    RowLine(fg) {383        Name("Advanced", fg)384        SubtleButton(if (advancedOpen) "hide" else "show", fg) { advancedOpen = !advancedOpen }385    }386    if (advancedOpen) {387        RowLine(fg) {388            Name("Replace vault from backup", com.peachpasswords.ui.theme.PeachColors.SyncBusy)389            SubtleButton("open", com.peachpasswords.ui.theme.PeachColors.SyncBusy) { onNavigate(PeachNav.Import) }390        }391        RowLine(fg) {392            Name("Destroy vault", com.peachpasswords.ui.theme.PeachColors.Breach)393            SubtleButton("destroy", com.peachpasswords.ui.theme.PeachColors.Breach) { onNavigate(PeachNav.Panic) }394        }395    }396}397398/* ────────────────────────────────  Sync  ────────────────────────────────── */399400@Composable401private fun SyncBody(fg: Color, onNavigate: (PeachNav) -> Unit) {402    SubLabel("PAIRING", fg, top = 0.dp)403    RowLine(fg) {404        Column(Modifier.weight(1f)) {405            Row(verticalAlignment = Alignment.CenterVertically) {406                Text("Peach Sync", color = fg, fontFamily = PeachType.Body, fontSize = 13.sp); ProBadge(fg)407            }408            Text(409                "Pair nearby devices by chirp and keep encrypted vault blobs in step without a central account.",410                color = fg.copy(alpha = 0.7f), fontFamily = PeachType.Body, fontSize = 11.sp, lineHeight = 16.sp,411                modifier = Modifier.padding(top = 2.dp),412            )413        }414    }415    RowLine(fg) { Name("Status", fg); ValueText("Requires Pro", fg) }416    RowLine(fg) { Name("Sync hub", fg); SubtleButton("open", fg) { onNavigate(PeachNav.ChirpPair) } }417418    SubLabel("DEVICE FLOW", fg)419    RowLine(fg) { Name("Pair new device", fg); SubtleButton("pair", fg) { onNavigate(PeachNav.ChirpPair) } }420    Hint("Sync uses the same zero-knowledge vault format as backup and restore; pairing authorizes a device, not a cloud account.", fg)421}422423/* ──────────────────────────────  Shortcuts  ──────────────────────────────── */424425@Composable426private fun ShortcutsBody(fg: Color) {427    val bindings = listOf(428        "Copy password" to "⌘C", "Copy username" to "⌘⇧C", "Open entry" to "↵",429        "Edit entry" to "E", "New entry" to "⌘N", "Search" to "/",430    )431    SubLabel("KEYBINDINGS", fg, top = 0.dp)432    Hint("Shortcuts apply when a hardware keyboard is attached. Defaults shown below.", fg)433    Spacer(Modifier.height(8.dp))434    bindings.forEach { (label, key) ->435        RowLine(fg) {436            Name(label, fg)437            Box(438                Modifier.clip(RoundedCornerShape(4.dp)).background(fg.copy(alpha = 0.06f))439                    .border(1.dp, fg.copy(alpha = 0.32f), RoundedCornerShape(4.dp))440                    .padding(horizontal = 7.dp, vertical = 2.dp),441            ) { Text(key, color = fg, fontFamily = PeachType.Mono, fontSize = 10.sp) }442        }443    }444}445446/* ────────────────────────────────  Pro  ─────────────────────────────────── */447448@Composable449private fun ProBody(fg: Color, vm: SettingsViewModel) {450    val ctx = LocalContext.current451    val isPro by vm.isPro.collectAsState()452    if (isPro) {453        ProActiveBody(fg, vm)454        return455    }456    val features = listOf(457        "Peach Sync" to "Encrypted · peer-to-peer",458        "Peach Codex" to "Restore from paper",459        "Passkeys" to "Zero-knowledge WebAuthn",460        "Advanced Vault Health" to "Reuse · age · exposure",461        "Canary entries" to "Detects vault compromise",462        "Duress vault" to "Decoy under coercion",463    )464    Text("PEACH PRO · ONE-TIME", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 8.sp, letterSpacing = 0.22.em)465    Text(466        "Everything, everywhere.",467        modifier = Modifier.padding(top = 8.dp),468        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 24.sp,469    )470    Text(471        "One key unlocks every Pro feature — for the lifetime of the app.",472        modifier = Modifier.padding(top = 6.dp),473        color = fg.copy(alpha = 0.72f), fontFamily = PeachType.Body, fontSize = 12.sp, lineHeight = 17.sp,474    )475    Spacer(Modifier.height(12.dp))476    features.forEachIndexed { i, (name, desc) ->477        RowLine(fg) {478            Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {479                Text("%02d".format(i + 1), color = fg.copy(alpha = 0.5f), fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(end = 10.dp))480                Text(name, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp)481            }482            Text(desc, color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 11.sp)483        }484    }485    Spacer(Modifier.height(14.dp))486    Text(487        "$39",488        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 28.sp,489    )490    Text("once · yours forever", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 9.sp, letterSpacing = 0.18.em)491    Spacer(Modifier.height(10.dp))492    Box(493        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))494            .background(fg.copy(alpha = 0.16f))495            .border(1.dp, fg.copy(alpha = 0.4f), RoundedCornerShape(10.dp))496            .clickable {497                runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(PRO_URL))) }498            }499            .padding(vertical = 12.dp),500        contentAlignment = Alignment.Center,501    ) { Text("Get Peach Pro", color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp) }502503    Spacer(Modifier.height(16.dp))504    Text("LICENSE KEY", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 8.sp, letterSpacing = 0.22.em)505    var key by remember { mutableStateOf("") }506    val activating by vm.activating.collectAsState()507    val activationError by vm.activationError.collectAsState()508    Box(509        Modifier.fillMaxWidth().padding(top = 6.dp)510            .border(1.dp, fg.copy(alpha = 0.3f), RoundedCornerShape(8.dp))511            .padding(horizontal = 12.dp, vertical = 10.dp),512    ) {513        BasicTextField(514            value = key,515            onValueChange = { key = it.uppercase(); vm.clearActivationError() },516            singleLine = true,517            textStyle = TextStyle(fontFamily = PeachType.Mono, fontSize = 13.sp, letterSpacing = 0.12.em, color = fg),518            cursorBrush = SolidColor(fg),519            modifier = Modifier.fillMaxWidth(),520            decorationBox = { inner ->521                if (key.isEmpty()) Text("PPK-XXXX-XXXX-XXXX", color = fg.copy(alpha = 0.3f), fontFamily = PeachType.Mono, fontSize = 13.sp, letterSpacing = 0.12.em)522                inner()523            },524        )525    }526    if (activationError != null) {527        Text(activationError!!, color = com.peachpasswords.ui.theme.PeachColors.Breach, fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(top = 6.dp))528    }529    Spacer(Modifier.height(8.dp))530    Box(531        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))532            .background(fg.copy(alpha = if (activating || key.isBlank()) 0.08f else 0.16f))533            .border(1.dp, fg.copy(alpha = 0.4f), RoundedCornerShape(10.dp))534            .clickable(enabled = !activating && key.isNotBlank()) { vm.activateLicense(key) }535            .padding(vertical = 12.dp),536        contentAlignment = Alignment.Center,537    ) { Text(if (activating) "Activating…" else "Activate", color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp) }538}539540@Composable541private fun ProActiveBody(fg: Color, vm: SettingsViewModel) {542    val features = listOf("Peach Sync", "Peach Codex", "Passkeys", "Advanced Vault Health", "Canary entries", "Duress vault")543    Box(Modifier.fillMaxWidth().padding(vertical = 8.dp), contentAlignment = Alignment.Center) {544        com.peachpasswords.ui.components.PeachMark(size = 60.dp)545    }546    Text(547        "Peach Pro",548        modifier = Modifier.fillMaxWidth(),549        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 26.sp,550        textAlign = androidx.compose.ui.text.style.TextAlign.Center,551    )552    Text(553        "active · yours forever",554        modifier = Modifier.fillMaxWidth().padding(top = 4.dp),555        color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 9.sp, letterSpacing = 0.18.em,556        textAlign = androidx.compose.ui.text.style.TextAlign.Center,557    )558    Spacer(Modifier.height(12.dp))559    features.forEachIndexed { i, name ->560        RowLine(fg) {561            Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {562                Text("%02d".format(i + 1), color = fg.copy(alpha = 0.5f), fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(end = 10.dp))563                Text(name, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp)564            }565            Text("unlocked", color = com.peachpasswords.ui.theme.PeachColors.HealthOk, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 11.sp)566        }567    }568    Spacer(Modifier.height(12.dp))569    Box(570        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))571            .border(1.dp, com.peachpasswords.ui.theme.PeachColors.Breach.copy(alpha = 0.4f), RoundedCornerShape(10.dp))572            .clickable { vm.deactivate() }573            .padding(vertical = 12.dp),574        contentAlignment = Alignment.Center,575    ) { Text("Deactivate", color = com.peachpasswords.ui.theme.PeachColors.Breach, fontFamily = PeachType.Mono, fontSize = 12.sp) }576}577578/* ──────────────────────────────  Feedback  ───────────────────────────────── */579580@OptIn(ExperimentalLayoutApi::class)581@Composable582private fun FeedbackBody(fg: Color) {583    val categories = listOf("Bug report", "Feature request", "Question", "Other")584    var category by remember { mutableStateOf(categories[0]) }585    var message by remember { mutableStateOf("") }586    var sent by remember { mutableStateOf(false) }587588    if (sent) {589        Box(590            Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp)).background(fg.copy(alpha = 0.08f))591                .border(1.dp, fg.copy(alpha = 0.32f), RoundedCornerShape(10.dp)).padding(16.dp),592        ) {593            Column {594                Text("Thank you", color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 18.sp)595                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))596            }597        }598        return599    }600601    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)602    SubLabel("TYPE", fg)603    FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {604        categories.forEach { cat -> Pill(cat, category == cat, fg) { category = cat } }605    }606    SubLabel("MESSAGE", fg)607    Box(608        Modifier.fillMaxWidth().height(110.dp).clip(RoundedCornerShape(8.dp))609            .background(Color(0x2E000000)).border(1.dp, fg.copy(alpha = 0.22f), RoundedCornerShape(8.dp))610            .padding(10.dp),611    ) {612        if (message.isEmpty()) Text("Describe the issue or idea...", color = fg.copy(alpha = 0.42f), fontFamily = PeachType.Body, fontSize = 12.sp)613        BasicTextField(614            value = message, onValueChange = { message = it },615            textStyle = TextStyle(color = fg, fontFamily = PeachType.Body, fontSize = 12.sp),616            cursorBrush = SolidColor(fg), modifier = Modifier.fillMaxWidth(),617        )618    }619    Spacer(Modifier.height(8.dp))620    SubtleButton("Send", fg) { if (message.isNotBlank()) sent = true }621    Hint("Sent anonymously · no account required", fg)622}