Skip to content

Commit 9192bc3

Browse files
committed
refactor(searcher): Optimize status card and fix toolbar spacing
- Compact SearchStatusCard layout (80dp → 60dp height) - Reduce padding from 12dp to 4dp - Smaller icons (24dp → 20dp) - Tighter spacing and narrower action buttons - Fix toolbar height estimates to match actual rendered heights - Expanded: 180dp → 164dp - Collapsed: 40dp → 44dp - Maintains consistent 16dp gap between toolbar and status card - Fix null safety in FileInfoBottomSheet for optional file sizes
1 parent 4089d26 commit 9192bc3

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

app-workspace-searcher/src/main/java/eu/darken/butler/searcher/ui/search/SearchStatusCard.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ fun SearchStatusCard(
5050
Column(
5151
modifier = Modifier
5252
.fillMaxWidth()
53-
.padding(horizontal = 16.dp, vertical = 12.dp)
53+
.padding(horizontal = 16.dp, vertical = 4.dp)
5454
) {
5555
Row(
5656
modifier = Modifier.fillMaxWidth(),
5757
verticalAlignment = Alignment.CenterVertically,
58-
horizontalArrangement = Arrangement.spacedBy(12.dp)
58+
horizontalArrangement = Arrangement.spacedBy(8.dp)
5959
) {
6060
// Icon - show circular progress when searching, static icon otherwise
6161
if (state.isSearching) {
6262
CircularProgressIndicator(
63-
modifier = Modifier.size(24.dp),
63+
modifier = Modifier.size(20.dp),
6464
color = MaterialTheme.colorScheme.primary,
6565
strokeWidth = 2.dp
6666
)
@@ -75,7 +75,7 @@ fun SearchStatusCard(
7575

7676
Column(
7777
modifier = Modifier.weight(1f),
78-
verticalArrangement = Arrangement.spacedBy(2.dp)
78+
verticalArrangement = Arrangement.spacedBy(0.dp)
7979
) {
8080
// Primary message
8181
Text(
@@ -126,7 +126,7 @@ fun SearchStatusCard(
126126

127127
// Fixed-width container for action area to prevent width changes
128128
Box(
129-
modifier = Modifier.width(72.dp), // Fixed width for consistent layout
129+
modifier = Modifier.width(64.dp), // Fixed width for consistent layout
130130
contentAlignment = Alignment.Center
131131
) {
132132
// Always show an action button to maintain consistent UI

app-workspace-searcher/src/main/java/eu/darken/butler/searcher/ui/search/SearcherWorkspacePage.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ fun SearcherWorkspacePage(
127127

128128
// Set the top toolbar heights (expanded and collapsed)
129129
topToolbarScrollBehavior.state.setHeights(
130-
expandedHeightDp = 180.dp, // Full card with all options
131-
collapsedHeightDp = 40.dp // Minimal compact state
130+
expandedHeightDp = 164.dp, // Full card with all options (actual measured height)
131+
collapsedHeightDp = 44.dp // Minimal compact state (actual measured height)
132132
)
133133

134134
// Derived states for stable recomposition - at top level for immediate reactivity
@@ -144,7 +144,7 @@ fun SearcherWorkspacePage(
144144

145145
// Get current toolbar height for layout calculations
146146
val currentToolbarHeight = topToolbarScrollBehavior.state.getCurrentHeightDp()
147-
val statusCardHeight = 80.dp // Fixed height for status card
147+
val statusCardHeight = 60.dp // Fixed height for status card
148148

149149
// Determine if status card should be visible
150150
val showStatusCard = state?.let { currentState ->
@@ -212,7 +212,7 @@ fun SearcherWorkspacePage(
212212
contentPadding = PaddingValues(
213213
start = 16.dp,
214214
end = 16.dp,
215-
top = 16.dp + currentToolbarHeight + 16.dp + (if (showStatusCard) statusCardHeight + 16.dp else 0.dp),
215+
top = 16.dp + currentToolbarHeight + 16.dp + (if (showStatusCard) statusCardHeight + 8.dp else 0.dp),
216216
bottom = run {
217217
val actionBarHeight = if (hasActions) 64.dp else 0.dp
218218
val clipboardHeight = if (hasClipboard) 88.dp else 0.dp

app-workspace/src/main/java/eu/darken/butler/workspace/ui/dialogs/FileInfoBottomSheet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ private fun FileInfoContent(
176176
)
177177

178178
// Size - always shown for files, shown for directories if available
179-
if (lookup.fileType == FileType.FILE || lookup.size > 0) {
179+
if (lookup.fileType == FileType.FILE || (lookup.size ?: 0) > 0) {
180180
InfoRow(
181181
label = stringResource(R.string.workspace_file_info_size_label),
182-
value = formatFileSize(lookup.size)
182+
value = formatFileSize(lookup.size ?: 0)
183183
)
184184
}
185185

0 commit comments

Comments
 (0)