282d2ce2efc9

polish: VaultListScreen visual parity — rounded s2 search box, accent sort pills, compact 26dp avatar rows w/ Cormorant-italic names + mono domains, tinted vector icons, offline sync dot (v2.1.14)

time
2026-06-08 19:46 UTC · 5 months ago
machine
koh2
agent
claude-opus-4-8
session
vault visual parity v2
parent
2dee0541a282
2 files app/src/main/java/com/peachpasswords/ui/components/FaviconInitials.kt+14 −4app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+100 −77
app/src/main/java/com/peachpasswords/ui/components/FaviconInitials.kt+14 −4
@@ -10,30 +10,40 @@1010 import androidx.compose.ui.draw.clip1111 import androidx.compose.ui.graphics.Color1212 import androidx.compose.ui.draw.drawBehind13+import androidx.compose.ui.text.font.FontWeight1314 import androidx.compose.ui.unit.Dp1415 import androidx.compose.ui.unit.dp16+import androidx.compose.ui.unit.em1517 import androidx.compose.ui.unit.sp1618 import com.peachpasswords.ui.theme.PeachColors1719 import com.peachpasswords.ui.theme.PeachType1820 1921 /**2022  * Initials chip used in place of a network favicon (offline-first). Ports the21- * browser titleInitials + titleBackground (deterministic HSL 32%/26%).23+ * browser titleInitials + titleBackground (deterministic HSL 32%/26%). The24+ * corner radius tracks the chip size (≈6dp at 26dp, ≈3dp at 16dp) per spec §4.6.2225  */2326 @Composable24-fun FaviconInitials(source: String, modifier: Modifier = Modifier, size: Dp = 36.dp) {27+fun FaviconInitials(28+    source: String,29+    modifier: Modifier = Modifier,30+    size: Dp = 26.dp,31+    cornerRadius: Dp = (size.value * 0.23f).dp,32+) {2533     val bg = titleBackground(source)2634     Box(2735         modifier = modifier2836             .size(size)29-            .clip(RoundedCornerShape(10.dp))37+            .clip(RoundedCornerShape(cornerRadius))3038             .drawBehind { drawRect(bg) },3139         contentAlignment = Alignment.Center,3240     ) {3341         Text(3442             text = titleInitials(source),35-            color = PeachColors.T0,43+            color = PeachColors.T0.copy(alpha = 0.92f),3644             fontFamily = PeachType.Mono,45+            fontWeight = FontWeight.SemiBold,46+            letterSpacing = 0.04.em,3747             fontSize = (size.value * 0.34f).sp,3848         )3949     }

view file

app/src/main/java/com/peachpasswords/ui/vault/VaultListScreen.kt+100 −77
@@ -2,8 +2,11 @@22 33 import androidx.compose.animation.animateColorAsState44 import androidx.compose.foundation.background5+import androidx.compose.foundation.border56 import androidx.compose.foundation.clickable67 import androidx.compose.foundation.gestures.detectHorizontalDragGestures8+import androidx.compose.foundation.interaction.MutableInteractionSource9+import androidx.compose.foundation.interaction.collectIsPressedAsState710 import androidx.compose.foundation.layout.Arrangement811 import androidx.compose.foundation.layout.Box912 import androidx.compose.foundation.layout.Column@@ -19,8 +22,16 @@1922 import androidx.compose.foundation.layout.width2023 import androidx.compose.foundation.lazy.LazyColumn2124 import androidx.compose.foundation.lazy.items25+import androidx.compose.foundation.shape.CircleShape2226 import androidx.compose.foundation.shape.RoundedCornerShape2327 import androidx.compose.foundation.text.BasicTextField28+import androidx.compose.material.icons.Icons29+import androidx.compose.material.icons.outlined.DeleteOutline30+import androidx.compose.material.icons.outlined.FavoriteBorder31+import androidx.compose.material.icons.rounded.Add32+import androidx.compose.material.icons.rounded.Search33+import androidx.compose.material.icons.rounded.Settings34+import androidx.compose.material3.Icon2435 import androidx.compose.material3.Text2536 import androidx.compose.runtime.Composable2637 import androidx.compose.runtime.getValue@@ -38,11 +49,8 @@3849 import androidx.compose.ui.input.pointer.positionChange3950 import androidx.compose.ui.platform.LocalContext4051 import androidx.compose.ui.text.TextStyle41-import androidx.compose.ui.text.font.FontStyle42-import androidx.compose.ui.text.font.FontWeight4352 import androidx.compose.ui.unit.dp4453 import androidx.compose.ui.unit.sp45-import androidx.compose.ui.unit.em4654 import androidx.hilt.navigation.compose.hiltViewModel4755 import androidx.compose.runtime.collectAsState4856 import com.peachpasswords.haptics.PeachHaptics@@ -71,11 +79,14 @@7179 7280     ShellBackground {7381         Column(Modifier.fillMaxSize()) {74-            TopBar(onSettings = { onNavigate(PeachNav.Settings) })82+            TopBar(83+                onSettings = { onNavigate(PeachNav.Settings) },84+                onAdd = { onNavigate(PeachNav.EntryEdit(null)) },85+            )7586             SearchBar(7687                 value = search,7788                 onChange = vm::setSearch,78-                count = if (search.isNotBlank()) "${entries.size} of $total" else "$total",89+                count = if (search.isNotBlank()) "${entries.size}/$total" else "$total",7990             )8091             SortBar(8192                 active = sort,@@ -106,37 +117,32 @@106117 }107118 108119 @Composable109-private fun TopBar(onSettings: () -> Unit) {120+private fun TopBar(onSettings: () -> Unit, onAdd: () -> Unit) {110121     val accent = LocalPeachAccent.current122+    // Transparent so the top-left shell bloom reads behind the header (spec §6.3).111123     Row(112124         modifier = Modifier113125             .fillMaxWidth()114-            .background(PeachColors.ShellTopSolid)115126             .statusBarsPadding()116-            .height(60.dp)117-            .padding(horizontal = 18.dp),127+            .height(56.dp)128+            .padding(horizontal = 16.dp),118129         verticalAlignment = Alignment.CenterVertically,119130         horizontalArrangement = Arrangement.SpaceBetween,120131     ) {121-        Text(122-            text = "peach",123-            color = accent,124-            fontFamily = PeachType.Display,125-            fontStyle = FontStyle.Italic,126-            fontWeight = FontWeight.Light,127-            fontSize = 22.sp,128-        )132+        Text(text = "peach", color = accent, style = PeachType.wordmark)129133         Row(verticalAlignment = Alignment.CenterVertically) {130-            Box(131-                Modifier.size(8.dp).clip(RoundedCornerShape(50)).background(PeachColors.SyncOk),134+            // Sync dot: no paired device yet, so it reads offline (t2), never a135+            // bright stand-in green. Wire to live sync status once pairing lands.136+            Box(Modifier.size(6.dp).clip(CircleShape).background(PeachColors.T2))137+            Spacer(Modifier.width(10.dp))138+            Icon(139+                Icons.Rounded.Add, contentDescription = "new entry", tint = PeachColors.T0,140+                modifier = Modifier.size(40.dp).clip(CircleShape).clickable(onClick = onAdd).padding(8.dp),132141             )133-            Spacer(Modifier.width(16.dp))134-            Box(135-                Modifier.size(44.dp).clip(RoundedCornerShape(50)).clickable(onClick = onSettings),136-                contentAlignment = Alignment.Center,137-            ) {138-                Text("⚙", color = PeachColors.T1, fontSize = 18.sp)139-            }142+            Icon(143+                Icons.Rounded.Settings, contentDescription = "settings", tint = PeachColors.T0,144+                modifier = Modifier.size(40.dp).clip(CircleShape).clickable(onClick = onSettings).padding(8.dp),145+            )140146         }141147     }142148 }@@ -144,42 +150,46 @@144150 @Composable145151 private fun SearchBar(value: String, onChange: (String) -> Unit, count: String) {146152     val accent = LocalPeachAccent.current147-    // Global TOTP period progress — 2dp bar at the top edge, refreshed ~10×/s.153+    // Global TOTP period progress — a 2dp accent tick above the field, ~10×/s.148154     val progress by produceState(0f) {149155         while (true) { this.value = TOTPGenerator.periodProgress(); delay(100) }150156     }151-    Box(152-        Modifier153-            .fillMaxWidth()154-            .background(PeachColors.S1)155-            .drawBehind {157+    Column(Modifier.fillMaxWidth()) {158+        Box(159+            Modifier.fillMaxWidth().height(2.dp).drawBehind {156160                 drawRect(157-                    color = accent,158-                    size = Size(width = size.width * progress, height = 2.dp.toPx()),161+                    color = accent.copy(alpha = 0.85f),162+                    size = Size(width = size.width * progress, height = size.height),159163                     topLeft = Offset.Zero,160164                 )161165             },162-    ) {166+        )163167         Row(164-            Modifier.fillMaxWidth().padding(horizontal = 18.dp, vertical = 14.dp),168+            Modifier169+                .fillMaxWidth()170+                .padding(horizontal = 16.dp, vertical = 10.dp)171+                .clip(RoundedCornerShape(12.dp))172+                .background(PeachColors.S2)173+                .border(1.dp, PeachColors.T3, RoundedCornerShape(12.dp))174+                .padding(horizontal = 12.dp, vertical = 8.dp),165175             verticalAlignment = Alignment.CenterVertically,166176         ) {167-            Text("⌕", color = PeachColors.T1, fontSize = 16.sp)177+            Icon(Icons.Rounded.Search, contentDescription = null, tint = PeachColors.T2, modifier = Modifier.size(14.dp))168178             Spacer(Modifier.width(10.dp))169179             Box(Modifier.weight(1f)) {170180                 if (value.isEmpty()) {171-                    Text("search vault...", color = PeachColors.T2, fontFamily = PeachType.Mono, fontSize = 13.sp)181+                    Text("search vault…", color = PeachColors.T2, style = PeachType.searchInput)172182                 }173183                 BasicTextField(174184                     value = value,175185                     onValueChange = onChange,176186                     singleLine = true,177-                    textStyle = TextStyle(color = PeachColors.T0, fontFamily = PeachType.Mono, fontSize = 13.sp),187+                    textStyle = PeachType.searchInput.copy(color = PeachColors.T0),178188                     cursorBrush = SolidColor(accent),179189                     modifier = Modifier.fillMaxWidth(),180190                 )181191             }182-            Text(count, color = PeachColors.T1, fontFamily = PeachType.Mono, fontSize = 10.sp)192+            Text(count, color = PeachColors.T2, style = PeachType.tinyMono)183193         }184194     }185195 }@@ -190,7 +200,6 @@190200     Row(191201         modifier = Modifier192202             .fillMaxWidth()193-            .background(PeachColors.S1)194203             .drawBehind {195204                 drawRect(196205                     color = PeachColors.T3,@@ -198,28 +207,33 @@198207                     size = Size(size.width, 1.dp.toPx()),199208                 )200209             }201-            .height(48.dp)202-            .padding(horizontal = 18.dp),210+            .height(46.dp)211+            .padding(horizontal = 16.dp),203212         verticalAlignment = Alignment.CenterVertically,204213     ) {205214         SortOrder.entries.forEach { order ->215+            val isActive = order == active206216             Text(207217                 text = order.label,208-                color = if (order == active) accent else PeachColors.T1,209-                fontFamily = PeachType.Mono,210-                fontSize = 9.sp,211-                letterSpacing = 0.06.em,218+                color = if (isActive) Color.Black else PeachColors.T2,219+                style = PeachType.sortPill,212220                 modifier = Modifier213-                    .clip(RoundedCornerShape(6.dp))221+                    .padding(end = 6.dp)222+                    .clip(RoundedCornerShape(4.dp))223+                    .background(if (isActive) accent else Color.Transparent)214224                     .clickable { onSort(order) }215-                    .padding(horizontal = 8.dp, vertical = 8.dp),225+                    .padding(horizontal = 8.dp, vertical = 3.dp),216226             )217227         }218228         Spacer(Modifier.weight(1f))219-        Text("♥", color = PeachColors.T1, fontSize = 14.sp,220-            modifier = Modifier.clip(RoundedCornerShape(50)).clickable(onClick = onHealth).padding(8.dp))221-        Text("🗑", color = PeachColors.T1, fontSize = 13.sp,222-            modifier = Modifier.clip(RoundedCornerShape(50)).clickable(onClick = onTrash).padding(8.dp))229+        Icon(230+            Icons.Outlined.FavoriteBorder, contentDescription = "health", tint = PeachColors.T1,231+            modifier = Modifier.size(34.dp).clip(CircleShape).clickable(onClick = onHealth).padding(8.dp),232+        )233+        Icon(234+            Icons.Outlined.DeleteOutline, contentDescription = "trash", tint = PeachColors.T1,235+            modifier = Modifier.size(34.dp).clip(CircleShape).clickable(onClick = onTrash).padding(8.dp),236+        )223237     }224238 }225239 @@ -233,15 +247,22 @@233247 ) {234248     val context = LocalContext.current235249     val accent = LocalPeachAccent.current250+    val interaction = remember { MutableInteractionSource() }251+    val pressed by interaction.collectIsPressedAsState()236252     val rowBg by animateColorAsState(237-        targetValue = if (flashing) accent.copy(alpha = 0.32f) else Color.Transparent,238-        label = "row-flash",253+        targetValue = when {254+            flashing -> accent.copy(alpha = 0.32f)255+            pressed -> PeachColors.T4256+            else -> Color.Transparent257+        },258+        label = "row-bg",239259     )240260     val meta = remember(entry) { entry.domainKeyOrUser() }241261 242262     Row(243263         modifier = Modifier244264             .fillMaxWidth()265+            .clip(RoundedCornerShape(7.dp))245266             .background(rowBg)246267             .pointerInput(entry.id, canSwipeCopy) {247268                 if (!canSwipeCopy) return@pointerInput@@ -260,37 +281,41 @@260281                     onHorizontalDrag = { change, amount -> dx += amount; dy += change.positionChange().y },261282                 )262283             }263-            .clickable(onClick = onTap)264-            .padding(horizontal = 16.dp, vertical = 12.dp),284+            .clickable(interactionSource = interaction, indication = null, onClick = onTap)285+            .padding(horizontal = 16.dp, vertical = 9.dp),286+        horizontalArrangement = Arrangement.spacedBy(10.dp),265287         verticalAlignment = Alignment.CenterVertically,266288     ) {267-        FaviconInitials(source = entry.url ?: entry.title, size = 38.dp)268-        Spacer(Modifier.width(14.dp))289+        FaviconInitials(source = entry.url ?: entry.title, size = 26.dp)269290         Column(Modifier.weight(1f)) {270291             Text(271292                 text = entry.title,272293                 color = PeachColors.T0,273-                fontFamily = PeachType.Display,274-                fontSize = 18.sp,275-                fontWeight = FontWeight.Normal,294+                style = PeachType.entryNameList,295+                maxLines = 1,276296             )277297             if (meta.isNotEmpty()) {278-                Text(meta, color = PeachColors.T1, fontFamily = PeachType.Mono, fontSize = 10.sp)298+                Text(299+                    text = meta,300+                    color = PeachColors.T2,301+                    style = TextStyle(fontFamily = PeachType.Mono, fontSize = 9.sp),302+                    maxLines = 1,303+                )279304             }280305         }281306         if (entry.hasTOTP()) {282307             Box(283308                 Modifier284-                    .clip(RoundedCornerShape(5.dp))309+                    .clip(RoundedCornerShape(4.dp))285310                     .background(PeachColors.TotpTag.copy(alpha = 0.14f))286-                    .padding(horizontal = 6.dp, vertical = 3.dp),311+                    .border(0.5.dp, PeachColors.TotpTag.copy(alpha = 0.30f), RoundedCornerShape(4.dp))312+                    .padding(horizontal = 6.dp, vertical = 2.dp),287313             ) {288-                Text("TOTP", color = PeachColors.TotpTag, fontFamily = PeachType.Mono, fontSize = 8.sp)314+                Text("TOTP", color = PeachColors.TotpTag, style = PeachType.sortPill)289315             }290316         }291317         if ((entry.breach ?: 0) > 0) {292-            Spacer(Modifier.width(8.dp))293-            Box(Modifier.size(7.dp).clip(RoundedCornerShape(50)).background(PeachColors.Breach))318+            Box(Modifier.size(6.dp).clip(CircleShape).background(PeachColors.Breach))294319         }295320     }296321 }@@ -302,12 +327,12 @@302327         modifier = Modifier303328             .fillMaxWidth()304329             .clickable(onClick = onClick)305-            .padding(horizontal = 20.dp, vertical = 18.dp),330+            .padding(horizontal = 18.dp, vertical = 18.dp),306331         verticalAlignment = Alignment.CenterVertically,332+        horizontalArrangement = Arrangement.spacedBy(10.dp),307333     ) {308-        Text("+", color = accent, fontFamily = PeachType.Mono, fontSize = 16.sp)309-        Spacer(Modifier.width(10.dp))310-        Text("new entry", color = accent, fontFamily = PeachType.Mono, fontSize = 12.sp)334+        Icon(Icons.Rounded.Add, contentDescription = null, tint = accent, modifier = Modifier.size(16.dp))335+        Text("new entry", color = accent, style = PeachType.labelMono)311336     }312337 }313338 @@ -317,17 +342,15 @@317342         Modifier.fillMaxWidth().padding(top = 80.dp, start = 28.dp, end = 28.dp),318343         horizontalAlignment = Alignment.CenterHorizontally,319344     ) {320-        Text("your vault is empty", color = PeachColors.T1, fontFamily = PeachType.Display,321-            fontStyle = FontStyle.Italic, fontSize = 22.sp)345+        Text("No entries yet", color = PeachColors.T1, style = PeachType.searchInput)322346         Spacer(Modifier.height(8.dp))323-        Text("add an entry with + below", color = PeachColors.T2, fontFamily = PeachType.Mono, fontSize = 11.sp)347+        Text("add your first entry with +", color = PeachColors.T2, style = PeachType.tinyMono)324348         if (com.peachpasswords.BuildConfig.DEBUG) {325349             Spacer(Modifier.height(20.dp))326350             Text(327351                 "seed demo data",328352                 color = LocalPeachAccent.current,329-                fontFamily = PeachType.Mono,330-                fontSize = 11.sp,353+                style = PeachType.labelMono,331354                 modifier = Modifier.clip(RoundedCornerShape(8.dp)).clickable(onClick = onSeed).padding(10.dp),332355             )333356         }

view file