1package com.peachpasswords.ui.vault23import androidx.compose.foundation.background4import androidx.compose.foundation.border5import androidx.compose.foundation.clickable6import androidx.compose.foundation.gestures.detectVerticalDragGestures7import androidx.compose.foundation.layout.Arrangement8import androidx.compose.foundation.layout.Box9import androidx.compose.foundation.layout.Row10import androidx.compose.foundation.layout.Spacer11import androidx.compose.foundation.layout.fillMaxWidth12import androidx.compose.foundation.layout.height13import androidx.compose.foundation.layout.padding14import androidx.compose.foundation.layout.offset15import androidx.compose.foundation.layout.size16import androidx.compose.foundation.layout.width17import androidx.compose.foundation.shape.RoundedCornerShape18import androidx.compose.material.icons.Icons19import androidx.compose.material.icons.outlined.Description20import androidx.compose.material.icons.outlined.Key21import androidx.compose.material.icons.outlined.Lock22import androidx.compose.material.icons.outlined.Settings23import androidx.compose.material.icons.rounded.Add24import androidx.compose.material.icons.rounded.Search25import androidx.compose.material3.Icon26import androidx.compose.material3.Text27import androidx.compose.runtime.Composable28import androidx.compose.ui.Alignment29import androidx.compose.ui.Modifier30import androidx.compose.ui.graphics.Color31import androidx.compose.ui.graphics.vector.ImageVector32import androidx.compose.ui.input.pointer.pointerInput33import androidx.compose.ui.unit.dp34import androidx.compose.ui.unit.em35import com.peachpasswords.ui.components.PeachWordmark36import com.peachpasswords.ui.theme.LocalPeachAccent37import com.peachpasswords.ui.theme.PeachRadius38import com.peachpasswords.ui.theme.PeachSpacing39import com.peachpasswords.ui.theme.PeachType40import com.peachpasswords.ui.theme.peachColors4142@Composable43internal fun PeachVaultIdentity(section: String, modifier: Modifier = Modifier, onHome: () -> Unit) {44 Row(45 modifier.fillMaxWidth().height(64.dp),46 verticalAlignment = Alignment.CenterVertically,47 ) {48 Box(Modifier.clickable(onClickLabel = "Open vault") { onHome() }) {49 PeachWordmark()50 }51 Spacer(Modifier.width(PeachSpacing.md))52 Text(section.uppercase(), color = peachColors.T2, style = PeachType.labelMono.copy(letterSpacing = 0.08.em))53 }54}5556@Composable57internal fun PeachDeckBottomBar(58 onSearch: () -> Unit,59 onAdd: () -> Unit,60 onNotes: () -> Unit,61 onSettings: () -> Unit,62 onLock: () -> Unit,63 onSwipeUp: () -> Unit,64 notesSelected: Boolean = false,65 modifier: Modifier = Modifier,66) {67 val accent = LocalPeachAccent.current68 Row(69 modifier.fillMaxWidth()70 .padding(horizontal = PeachSpacing.xl, vertical = PeachSpacing.sm)71 .height(64.dp)72 .background(peachColors.S1, RoundedCornerShape(PeachRadius.Pill))73 .border(1.dp, peachColors.T3, RoundedCornerShape(PeachRadius.Pill))74 .pointerInput(onSwipeUp) {75 var opened = false76 detectVerticalDragGestures(77 onDragEnd = { opened = false },78 onDragCancel = { opened = false },79 ) { _, dragAmount ->80 if (!opened && dragAmount < -4f) {81 opened = true82 onSwipeUp()83 }84 }85 }86 .padding(horizontal = PeachSpacing.md),87 horizontalArrangement = Arrangement.SpaceBetween,88 verticalAlignment = Alignment.CenterVertically,89 ) {90 DeckAction(Icons.Rounded.Search, "search", accent, onSearch, offsetX = 1.dp)91 92 93 94 DeckAction(Icons.Rounded.Add, "new", peachColors.T0, onAdd, iconSize = 28.dp)95 DeckAction(96 if (notesSelected) Icons.Outlined.Key else Icons.Outlined.Description,97 if (notesSelected) "Back to entry" else "Notes",98 if (notesSelected) accent else peachColors.T0,99 onNotes,100 )101 DeckAction(Icons.Outlined.Settings, "settings", peachColors.T0, onSettings)102 DeckAction(Icons.Outlined.Lock, "Lock vault", accent, onLock)103 }104}105106@Composable107private fun DeckAction(108 icon: ImageVector,109 label: String,110 tint: Color,111 onClick: () -> Unit,112 iconSize: androidx.compose.ui.unit.Dp = 22.dp,113 offsetX: androidx.compose.ui.unit.Dp = 0.dp,114) {115 Box(116 Modifier.size(48.dp).clickable(onClick = onClick),117 contentAlignment = Alignment.Center,118 ) {119 Icon(120 icon,121 contentDescription = label,122 tint = tint,123 modifier = Modifier.size(iconSize).offset(x = offsetX),124 )125 }126}