SettingsCardBodies.kt

26.8 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    RowLine(fg) {243        Name("Unlock with biometrics", fg)244        Toggle(s.biometricsEnabled, fg) { vm.setBiometrics(it) }245    }246    SubLabel("RECOVERY", fg)247    RowLine(fg) {248        Name("View recovery words", fg)249        SubtleButton("view", fg) { onNavigate(PeachNav.RecoveryView) }250    }251    SubLabel("BREACH PROTECTION", fg)252    RowLine(fg) {253        Name("Breach monitoring", fg)254        Toggle(s.breachMonitoring, fg) { vm.setBreachMonitoring(it) }255    }256257    SubLabel("MASTER PASSWORD", fg)258    ChangePasswordRow(fg, vm)259260    SubLabel("DURESS PASSWORD", fg)261    RowLine(fg) {262        Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {263            Name("Duress password", fg); ProBadge(fg)264        }265        ValueText("off", fg)266    }267    Hint("If entered under coercion, a decoy empty vault opens; your real vault stays hidden. Arrives with Pro sync.", fg)268}269270@Composable271private fun ChangePasswordRow(fg: Color, vm: SettingsViewModel) {272    var open by remember { mutableStateOf(false) }273    var current by remember { mutableStateOf("") }274    var next by remember { mutableStateOf("") }275    var confirm by remember { mutableStateOf("") }276    var error by remember { mutableStateOf<String?>(null) }277    var done by remember { mutableStateOf(false) }278    val scope = rememberCoroutineScope()279280    RowLine(fg) {281        Name("Master password", fg)282        SubtleButton(if (open) "cancel" else "change", fg) { open = !open; error = null; done = false }283    }284    AnimatedVisibility(open) {285        Column(Modifier.fillMaxWidth().padding(top = 8.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {286            PwField("current password", current, fg) { current = it }287            PwField("new password (min 12 chars)", next, fg) { next = it }288            PwField("confirm new password", confirm, fg) { confirm = it }289            error?.let { Text(it, color = Color(0xFFE5805C), fontFamily = PeachType.Mono, fontSize = 10.sp) }290            if (done) Text("password changed ✓", color = fg, fontFamily = PeachType.Mono, fontSize = 10.sp)291            SubtleButton("save new password", fg) {292                error = when {293                    current.isBlank() -> "enter your current password"294                    next.length < 12 -> "new password must be at least 12 characters"295                    next != confirm -> "new passwords do not match"296                    next == current -> "new password must differ from current"297                    else -> null298                }299                if (error == null) scope.launch {300                    if (vm.changePassword(current, next)) {301                        current = ""; next = ""; confirm = ""; open = false; done = true302                    } else error = "incorrect current password"303                }304            }305        }306    }307}308309@Composable310private fun PwField(placeholder: String, value: String, fg: Color, onChange: (String) -> Unit) {311    Box(312        Modifier.fillMaxWidth().clip(RoundedCornerShape(8.dp))313            .background(Color(0x2E000000))314            .border(1.dp, fg.copy(alpha = 0.22f), RoundedCornerShape(8.dp))315            .padding(horizontal = 10.dp, vertical = 10.dp),316    ) {317        if (value.isEmpty()) {318            Text(placeholder, color = fg.copy(alpha = 0.42f), fontFamily = PeachType.Mono, fontSize = 12.sp)319        }320        BasicTextField(321            value = value,322            onValueChange = onChange,323            singleLine = true,324            textStyle = TextStyle(color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp),325            cursorBrush = SolidColor(fg),326            visualTransformation = PasswordVisualTransformation(),327            modifier = Modifier.fillMaxWidth(),328        )329    }330}331332/* ────────────────────────────────  Vault  ───────────────────────────────── */333334@Composable335private fun VaultBody(336    fg: Color,337    vm: SettingsViewModel,338    s: VaultSettings,339    entriesCount: Int,340    onNavigate: (PeachNav) -> Unit,341) {342    val trashOptions = listOf(7 to "7 days", 30 to "30 days", 90 to "90 days", 0 to "Never")343    val current = s.trashRetentionDays ?: 0344345    SubLabel("ENTRIES", fg, top = 0.dp)346    RowLine(fg) { Name("Entries", fg); ValueText("$entriesCount", fg) }347348    SubLabel("MAINTENANCE", fg)349    RowLine(fg) {350        Name("Trash auto-delete", fg)351        val idx = trashOptions.indexOfFirst { it.first == current }.coerceAtLeast(0)352        SubtleButton(trashOptions[idx].second, fg) {353            vm.setTrashRetentionDays(trashOptions[(idx + 1) % trashOptions.size].first)354        }355    }356    RowLine(fg) { Name("Advanced Vault Health", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Health) } }357    RowLine(fg) { Name("Trash", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Trash) } }358359    SubLabel("DATA", fg)360    RowLine(fg) { Name("Import passwords", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Import) } }361    RowLine(fg) { Name("Export backup", fg); SubtleButton("open", fg) { onNavigate(PeachNav.Export) } }362    RowLine(fg) {363        Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) { Name("Peach Codex", fg); ProBadge(fg) }364        SubtleButton("open", fg) { onNavigate(PeachNav.CodexGenerate) }365    }366    RowLine(fg) { Name("Restore from Codex", fg); SubtleButton("open", fg) { onNavigate(PeachNav.CodexRestore) } }367368    var advancedOpen by remember { mutableStateOf(false) }369    SubLabel("ADVANCED", fg)370    RowLine(fg) {371        Name("Advanced", fg)372        SubtleButton(if (advancedOpen) "hide" else "show", fg) { advancedOpen = !advancedOpen }373    }374    if (advancedOpen) {375        RowLine(fg) {376            Name("Replace vault from backup", com.peachpasswords.ui.theme.PeachColors.SyncBusy)377            SubtleButton("open", com.peachpasswords.ui.theme.PeachColors.SyncBusy) { onNavigate(PeachNav.Import) }378        }379        RowLine(fg) {380            Name("Destroy vault", com.peachpasswords.ui.theme.PeachColors.Breach)381            SubtleButton("destroy", com.peachpasswords.ui.theme.PeachColors.Breach) { onNavigate(PeachNav.Panic) }382        }383    }384}385386/* ────────────────────────────────  Sync  ────────────────────────────────── */387388@Composable389private fun SyncBody(fg: Color, onNavigate: (PeachNav) -> Unit) {390    SubLabel("PAIRING", fg, top = 0.dp)391    RowLine(fg) {392        Column(Modifier.weight(1f)) {393            Row(verticalAlignment = Alignment.CenterVertically) {394                Text("Peach Sync", color = fg, fontFamily = PeachType.Body, fontSize = 13.sp); ProBadge(fg)395            }396            Text(397                "Pair nearby devices by chirp and keep encrypted vault blobs in step without a central account.",398                color = fg.copy(alpha = 0.7f), fontFamily = PeachType.Body, fontSize = 11.sp, lineHeight = 16.sp,399                modifier = Modifier.padding(top = 2.dp),400            )401        }402    }403    RowLine(fg) { Name("Status", fg); ValueText("Requires Pro", fg) }404    RowLine(fg) { Name("Sync hub", fg); SubtleButton("open", fg) { onNavigate(PeachNav.ChirpPair) } }405406    SubLabel("DEVICE FLOW", fg)407    RowLine(fg) { Name("Pair new device", fg); SubtleButton("pair", fg) { onNavigate(PeachNav.ChirpPair) } }408    Hint("Sync uses the same zero-knowledge vault format as backup and restore; pairing authorizes a device, not a cloud account.", fg)409}410411/* ──────────────────────────────  Shortcuts  ──────────────────────────────── */412413@Composable414private fun ShortcutsBody(fg: Color) {415    val bindings = listOf(416        "Copy password" to "⌘C", "Copy username" to "⌘⇧C", "Open entry" to "↵",417        "Edit entry" to "E", "New entry" to "⌘N", "Search" to "/",418    )419    SubLabel("KEYBINDINGS", fg, top = 0.dp)420    Hint("Shortcuts apply when a hardware keyboard is attached. Defaults shown below.", fg)421    Spacer(Modifier.height(8.dp))422    bindings.forEach { (label, key) ->423        RowLine(fg) {424            Name(label, fg)425            Box(426                Modifier.clip(RoundedCornerShape(4.dp)).background(fg.copy(alpha = 0.06f))427                    .border(1.dp, fg.copy(alpha = 0.32f), RoundedCornerShape(4.dp))428                    .padding(horizontal = 7.dp, vertical = 2.dp),429            ) { Text(key, color = fg, fontFamily = PeachType.Mono, fontSize = 10.sp) }430        }431    }432}433434/* ────────────────────────────────  Pro  ─────────────────────────────────── */435436@Composable437private fun ProBody(fg: Color, vm: SettingsViewModel) {438    val ctx = LocalContext.current439    val isPro by vm.isPro.collectAsState()440    if (isPro) {441        ProActiveBody(fg, vm)442        return443    }444    val features = listOf(445        "Peach Sync" to "Encrypted · peer-to-peer",446        "Peach Codex" to "Restore from paper",447        "Passkeys" to "Zero-knowledge WebAuthn",448        "Advanced Vault Health" to "Reuse · age · exposure",449        "Canary entries" to "Detects vault compromise",450        "Duress vault" to "Decoy under coercion",451    )452    Text("PEACH PRO · ONE-TIME", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 8.sp, letterSpacing = 0.22.em)453    Text(454        "Everything, everywhere.",455        modifier = Modifier.padding(top = 8.dp),456        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 24.sp,457    )458    Text(459        "One key unlocks every Pro feature — for the lifetime of the app.",460        modifier = Modifier.padding(top = 6.dp),461        color = fg.copy(alpha = 0.72f), fontFamily = PeachType.Body, fontSize = 12.sp, lineHeight = 17.sp,462    )463    Spacer(Modifier.height(12.dp))464    features.forEachIndexed { i, (name, desc) ->465        RowLine(fg) {466            Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {467                Text("%02d".format(i + 1), color = fg.copy(alpha = 0.5f), fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(end = 10.dp))468                Text(name, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp)469            }470            Text(desc, color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 11.sp)471        }472    }473    Spacer(Modifier.height(14.dp))474    Text(475        "$39",476        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 28.sp,477    )478    Text("once · yours forever", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 9.sp, letterSpacing = 0.18.em)479    Spacer(Modifier.height(10.dp))480    Box(481        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))482            .background(fg.copy(alpha = 0.16f))483            .border(1.dp, fg.copy(alpha = 0.4f), RoundedCornerShape(10.dp))484            .clickable {485                runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(PRO_URL))) }486            }487            .padding(vertical = 12.dp),488        contentAlignment = Alignment.Center,489    ) { Text("Get Peach Pro", color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp) }490491    Spacer(Modifier.height(16.dp))492    Text("LICENSE KEY", color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 8.sp, letterSpacing = 0.22.em)493    var key by remember { mutableStateOf("") }494    val activating by vm.activating.collectAsState()495    val activationError by vm.activationError.collectAsState()496    Box(497        Modifier.fillMaxWidth().padding(top = 6.dp)498            .border(1.dp, fg.copy(alpha = 0.3f), RoundedCornerShape(8.dp))499            .padding(horizontal = 12.dp, vertical = 10.dp),500    ) {501        BasicTextField(502            value = key,503            onValueChange = { key = it.uppercase(); vm.clearActivationError() },504            singleLine = true,505            textStyle = TextStyle(fontFamily = PeachType.Mono, fontSize = 13.sp, letterSpacing = 0.12.em, color = fg),506            cursorBrush = SolidColor(fg),507            modifier = Modifier.fillMaxWidth(),508            decorationBox = { inner ->509                if (key.isEmpty()) Text("PPK-XXXX-XXXX-XXXX", color = fg.copy(alpha = 0.3f), fontFamily = PeachType.Mono, fontSize = 13.sp, letterSpacing = 0.12.em)510                inner()511            },512        )513    }514    if (activationError != null) {515        Text(activationError!!, color = com.peachpasswords.ui.theme.PeachColors.Breach, fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(top = 6.dp))516    }517    Spacer(Modifier.height(8.dp))518    Box(519        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))520            .background(fg.copy(alpha = if (activating || key.isBlank()) 0.08f else 0.16f))521            .border(1.dp, fg.copy(alpha = 0.4f), RoundedCornerShape(10.dp))522            .clickable(enabled = !activating && key.isNotBlank()) { vm.activateLicense(key) }523            .padding(vertical = 12.dp),524        contentAlignment = Alignment.Center,525    ) { Text(if (activating) "Activating…" else "Activate", color = fg, fontFamily = PeachType.Mono, fontSize = 12.sp) }526}527528@Composable529private fun ProActiveBody(fg: Color, vm: SettingsViewModel) {530    val features = listOf("Peach Sync", "Peach Codex", "Passkeys", "Advanced Vault Health", "Canary entries", "Duress vault")531    Box(Modifier.fillMaxWidth().padding(vertical = 8.dp), contentAlignment = Alignment.Center) {532        com.peachpasswords.ui.components.PeachMark(size = 60.dp)533    }534    Text(535        "Peach Pro",536        modifier = Modifier.fillMaxWidth(),537        color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 26.sp,538        textAlign = androidx.compose.ui.text.style.TextAlign.Center,539    )540    Text(541        "active · yours forever",542        modifier = Modifier.fillMaxWidth().padding(top = 4.dp),543        color = fg.copy(alpha = 0.6f), fontFamily = PeachType.Mono, fontSize = 9.sp, letterSpacing = 0.18.em,544        textAlign = androidx.compose.ui.text.style.TextAlign.Center,545    )546    Spacer(Modifier.height(12.dp))547    features.forEachIndexed { i, name ->548        RowLine(fg) {549            Row(Modifier.weight(1f), verticalAlignment = Alignment.CenterVertically) {550                Text("%02d".format(i + 1), color = fg.copy(alpha = 0.5f), fontFamily = PeachType.Mono, fontSize = 10.sp, modifier = Modifier.padding(end = 10.dp))551                Text(name, color = fg, fontFamily = PeachType.Body, fontSize = 13.sp)552            }553            Text("unlocked", color = com.peachpasswords.ui.theme.PeachColors.HealthOk, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 11.sp)554        }555    }556    Spacer(Modifier.height(12.dp))557    Box(558        Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp))559            .border(1.dp, com.peachpasswords.ui.theme.PeachColors.Breach.copy(alpha = 0.4f), RoundedCornerShape(10.dp))560            .clickable { vm.deactivate() }561            .padding(vertical = 12.dp),562        contentAlignment = Alignment.Center,563    ) { Text("Deactivate", color = com.peachpasswords.ui.theme.PeachColors.Breach, fontFamily = PeachType.Mono, fontSize = 12.sp) }564}565566/* ──────────────────────────────  Feedback  ───────────────────────────────── */567568@OptIn(ExperimentalLayoutApi::class)569@Composable570private fun FeedbackBody(fg: Color) {571    val categories = listOf("Bug report", "Feature request", "Question", "Other")572    var category by remember { mutableStateOf(categories[0]) }573    var message by remember { mutableStateOf("") }574    var sent by remember { mutableStateOf(false) }575576    if (sent) {577        Box(578            Modifier.fillMaxWidth().clip(RoundedCornerShape(10.dp)).background(fg.copy(alpha = 0.08f))579                .border(1.dp, fg.copy(alpha = 0.32f), RoundedCornerShape(10.dp)).padding(16.dp),580        ) {581            Column {582                Text("Thank you", color = fg, fontFamily = PeachType.Display, fontStyle = FontStyle.Italic, fontSize = 18.sp)583                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))584            }585        }586        return587    }588589    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)590    SubLabel("TYPE", fg)591    FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {592        categories.forEach { cat -> Pill(cat, category == cat, fg) { category = cat } }593    }594    SubLabel("MESSAGE", fg)595    Box(596        Modifier.fillMaxWidth().height(110.dp).clip(RoundedCornerShape(8.dp))597            .background(Color(0x2E000000)).border(1.dp, fg.copy(alpha = 0.22f), RoundedCornerShape(8.dp))598            .padding(10.dp),599    ) {600        if (message.isEmpty()) Text("Describe the issue or idea...", color = fg.copy(alpha = 0.42f), fontFamily = PeachType.Body, fontSize = 12.sp)601        BasicTextField(602            value = message, onValueChange = { message = it },603            textStyle = TextStyle(color = fg, fontFamily = PeachType.Body, fontSize = 12.sp),604            cursorBrush = SolidColor(fg), modifier = Modifier.fillMaxWidth(),605        )606    }607    Spacer(Modifier.height(8.dp))608    SubtleButton("Send", fg) { if (message.isNotBlank()) sent = true }609    Hint("Sent anonymously · no account required", fg)610}