3609a9253d4c

style: Merge Notes editor into one card (v2.14.27)

time
2026-08-14 18:12 UTC · 2 months ago
machine
koh2
agent
gpt-5.6-sol
session
unified notes editor card
parent
dc9d5d3a5ecf
2 files VERSION+1 −1app/src/main/java/com/peachpasswords/ui/vault/NotesModeScreen.kt+60 −63
VERSION+1 −1
@@ -1 +1 @@1-2.14.261+2.14.27

view file

app/src/main/java/com/peachpasswords/ui/vault/NotesModeScreen.kt+60 −63
@@ -149,7 +149,14 @@149149                 "notes",150150                 Modifier.padding(horizontal = PeachSpacing.lg),151151             ) { finishNote { onNavigate(PeachNav.VaultList) } }152-            FieldShell("title", Modifier.padding(horizontal = PeachSpacing.lg)) {152+            Column(153+                Modifier.weight(1f).fillMaxWidth()154+                    .padding(horizontal = PeachSpacing.lg, vertical = PeachSpacing.xs)155+                    .clip(RoundedCornerShape(PeachRadius.StackCard))156+                    .background(peachColors.SurfaceCard)157+                    .border(1.dp, peachColors.T3, RoundedCornerShape(PeachRadius.StackCard)),158+            ) {159+                FieldShell("title", stacked = true, divider = true) {153160                     Box(Modifier.weight(1f)) {154161                         if (title.isEmpty()) {155162                             Text(@@ -181,74 +188,64 @@181188                             .clickable { vm.delete {} }182189                             .padding(8.dp),183190                     )184-            }185-186-            if (e == null) {187-                Box(Modifier.weight(1f).fillMaxWidth(), contentAlignment = Alignment.Center) {188-                    Text("note not found", color = peachColors.T1, style = PeachType.bodyMono)189191                 }190-                return@Column191-            }192192 193-            // Formatting toolbar: every action writes the markup that saves back194-            // as the browser's own tags, so formatting survives a phone edit.195-            if (editing) {196-                Row(197-                    Modifier.fillMaxWidth()198-                        .padding(horizontal = PeachSpacing.lg, vertical = PeachSpacing.sm)199-                        .clip(RoundedCornerShape(PeachRadius.Pill))200-                        .background(peachColors.S1)201-                        .border(1.dp, peachColors.T3, RoundedCornerShape(PeachRadius.Pill))202-                        .padding(PeachSpacing.xs),203-                    horizontalArrangement = Arrangement.spacedBy(PeachSpacing.xs),204-                    verticalAlignment = Alignment.CenterVertically,205-                ) {206-                    fun format(next: TextFieldValue) {207-                        body = next208-                        isHtml = true209-                        vm.onContentChanged(noteStorageText(next.text, isHtml = true))193+                if (e == null) {194+                    Box(Modifier.weight(1f).fillMaxWidth(), contentAlignment = Alignment.Center) {195+                        Text("note not found", color = peachColors.T1, style = PeachType.bodyMono)210196                     }211-                    FormatButton("B", FontWeight.Bold) { format(wrapSelection(body, "**")) }212-                    FormatButton("I", fontStyle = FontStyle.Italic) { format(wrapSelection(body, "*")) }213-                    FormatButton("U", underline = true) { format(wrapSelection(body, "__")) }214-                    Spacer(Modifier.width(4.dp))215-                    FormatButton("H") { format(applyLinePrefix(body, "## ")) }216-                    FormatButton("•") { format(applyLinePrefix(body, "- ")) }217-                    FormatButton("1.") { format(applyLinePrefix(body, "1. ")) }197+                    return@Column218198                 }219-            }220199 221-            // Content area.222-            Box(223-                Modifier.weight(1f).fillMaxWidth()224-                    .padding(horizontal = PeachSpacing.lg, vertical = PeachSpacing.sm)225-                    .clip(RoundedCornerShape(PeachRadius.StackCard))226-                    .background(peachColors.SurfaceCard)227-                    .border(1.dp, peachColors.T3, RoundedCornerShape(PeachRadius.StackCard))228-                    .padding(PeachSpacing.lg),229-            ) {230-                if (body.text.isEmpty()) {231-                    Text(232-                        "Start writing…",233-                        color = peachColors.T2,234-                        style = TextStyle(fontFamily = PeachType.Body, fontStyle = FontStyle.Italic, fontSize = 14.sp),235-                    )236-                }200+                // Formatting toolbar: every action writes the markup that saves back201+                // as the browser's own tags, so formatting survives a phone edit.237202                 if (editing) {238-                    BasicTextField(239-                        value = body,240-                        onValueChange = { body = it; vm.onContentChanged(noteStorageText(it.text, isHtml)) },241-                        textStyle = TextStyle(color = peachColors.T0, fontFamily = PeachType.Body, fontSize = 14.sp, lineHeight = 22.sp),242-                        cursorBrush = SolidColor(accent),243-                        modifier = Modifier.fillMaxSize(),244-                    )245-                } else {246-                    Text(247-                        noteRendered(body.text, isHtml),248-                        color = peachColors.T0,249-                        style = TextStyle(fontFamily = PeachType.Body, fontSize = 14.sp, lineHeight = 22.sp),250-                        modifier = Modifier.fillMaxSize().clickable { editing = true },251-                    )203+                    Row(204+                        Modifier.fillMaxWidth().padding(horizontal = PeachSpacing.lg, vertical = PeachSpacing.sm),205+                        horizontalArrangement = Arrangement.spacedBy(PeachSpacing.xs),206+                        verticalAlignment = Alignment.CenterVertically,207+                    ) {208+                        fun format(next: TextFieldValue) {209+                            body = next210+                            isHtml = true211+                            vm.onContentChanged(noteStorageText(next.text, isHtml = true))212+                        }213+                        FormatButton("B", FontWeight.Bold) { format(wrapSelection(body, "**")) }214+                        FormatButton("I", fontStyle = FontStyle.Italic) { format(wrapSelection(body, "*")) }215+                        FormatButton("U", underline = true) { format(wrapSelection(body, "__")) }216+                        Spacer(Modifier.width(4.dp))217+                        FormatButton("H") { format(applyLinePrefix(body, "## ")) }218+                        FormatButton("•") { format(applyLinePrefix(body, "- ")) }219+                        FormatButton("1.") { format(applyLinePrefix(body, "1. ")) }220+                    }221+                    Box(Modifier.fillMaxWidth().height(1.dp).background(peachColors.T3))222+                }223+224+                // Content area is the final layer of the single note card.225+                Box(Modifier.weight(1f).fillMaxWidth().padding(PeachSpacing.lg)) {226+                    if (body.text.isEmpty()) {227+                        Text(228+                            "Start writing…",229+                            color = peachColors.T2,230+                            style = TextStyle(fontFamily = PeachType.Body, fontStyle = FontStyle.Italic, fontSize = 14.sp),231+                        )232+                    }233+                    if (editing) {234+                        BasicTextField(235+                            value = body,236+                            onValueChange = { body = it; vm.onContentChanged(noteStorageText(it.text, isHtml)) },237+                            textStyle = TextStyle(color = peachColors.T0, fontFamily = PeachType.Body, fontSize = 14.sp, lineHeight = 22.sp),238+                            cursorBrush = SolidColor(accent),239+                            modifier = Modifier.fillMaxSize(),240+                        )241+                    } else {242+                        Text(243+                            noteRendered(body.text, isHtml),244+                            color = peachColors.T0,245+                            style = TextStyle(fontFamily = PeachType.Body, fontSize = 14.sp, lineHeight = 22.sp),246+                            modifier = Modifier.fillMaxSize().clickable { editing = true },247+                        )248+                    }252249                 }253250             }254251             PeachDeckBottomBar(

view file