Skip to content

Commit 982b2ed

Browse files
committed
feat: Add query settings panel
1 parent 38a9054 commit 982b2ed

4 files changed

Lines changed: 70 additions & 28 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ caffeine.version=3.2.2
1616

1717
api.version=1.16.3
1818
core.version=1.18.9
19-
ui.version=1.19.0
19+
ui.version=1.19.1
2020
app.version=1.6.4

ui/src/main/kotlin/dev/paulee/ui/components/TableView.kt

Lines changed: 67 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,37 +103,54 @@ fun TableView(
103103
Box(modifier = modifier) {
104104
Column(modifier = Modifier.fillMaxSize()) {
105105
Row(
106-
verticalAlignment = Alignment.CenterVertically,
106+
verticalAlignment = Alignment.Top,
107107
horizontalArrangement = Arrangement.SpaceBetween,
108108
modifier = Modifier.fillMaxWidth()
109109
) {
110-
IconButton(
111-
onClick = {
112-
onSelectionChange(emptySet())
113-
}, enabled = selectedIndices.isNotEmpty(), modifier = Modifier.width(48.dp).padding(bottom = 12.dp)
114-
) {
115-
Icon(Icons.Default.Delete, contentDescription = locale["table.delete"])
116-
}
110+
Column(horizontalAlignment = Alignment.Start) {
111+
Row(verticalAlignment = Alignment.CenterVertically) {
112+
IconButton(
113+
onClick = {
114+
onSelectionChange(emptySet())
115+
},
116+
enabled = selectedIndices.isNotEmpty(),
117+
modifier = Modifier.width(48.dp).padding(bottom = 12.dp)
118+
) {
119+
Icon(Icons.Default.Delete, contentDescription = locale["table.delete"])
120+
}
117121

118-
OutlinedButton(
119-
onClick = {
120-
settingsExpanded = !settingsExpanded
121-
if (settingsExpanded) panelExpanded = false
122-
},
123-
enabled = false,
124-
shape = RoundedCornerShape(50.dp),
125-
contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp),
126-
modifier = Modifier.width(120.dp).padding(bottom = 12.dp)
127-
) {
128-
Icon(
129-
imageVector = if (settingsExpanded) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown,
130-
contentDescription = locale["settings.title"],
131-
modifier = Modifier.size(18.dp)
132-
)
122+
Spacer(modifier = Modifier.width(8.dp))
123+
124+
OutlinedButton(
125+
onClick = {
126+
settingsExpanded = !settingsExpanded
127+
if (settingsExpanded) panelExpanded = false
128+
},
129+
shape = RoundedCornerShape(50.dp),
130+
contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp),
131+
modifier = Modifier.width(120.dp).padding(bottom = 12.dp)
132+
) {
133+
Icon(
134+
imageVector = if (settingsExpanded) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown,
135+
contentDescription = locale["settings.title"],
136+
modifier = Modifier.size(18.dp)
137+
)
133138

134-
Spacer(Modifier.width(8.dp))
139+
Spacer(Modifier.width(8.dp))
140+
141+
Text(locale["settings.title"])
142+
}
143+
}
135144

136-
Text(locale["settings.title"])
145+
AnimatedVisibility(
146+
visible = settingsExpanded,
147+
enter = fadeIn() + expandVertically(),
148+
exit = fadeOut() + shrinkVertically()
149+
) {
150+
QuerySettingsPanel(
151+
modifier = Modifier.padding(bottom = 12.dp)
152+
)
153+
}
137154
}
138155

139156
Column(
@@ -166,7 +183,7 @@ fun TableView(
166183
}
167184

168185
AnimatedVisibility(
169-
visible = panelExpanded || settingsExpanded,
186+
visible = panelExpanded,
170187
enter = fadeIn() + expandVertically(),
171188
exit = fadeOut() + shrinkVertically()
172189
) {
@@ -402,7 +419,7 @@ fun TableView(
402419
) {
403420
Box(
404421
modifier = Modifier
405-
.size(22.dp)
422+
.size(19.dp)
406423
.clip(RoundedCornerShape(6.dp))
407424
.background(MaterialTheme.colors.primary.copy(alpha = 0.08f))
408425
.border(
@@ -453,6 +470,29 @@ fun TableView(
453470
}
454471
}
455472

473+
@Composable
474+
private fun QuerySettingsPanel(
475+
modifier: Modifier = Modifier,
476+
) {
477+
val locale = LocalI18n.current
478+
479+
Surface(
480+
modifier = modifier.widthIn(min = 200.dp, max = 280.dp),
481+
shape = RoundedCornerShape(16.dp),
482+
border = BorderStroke(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.08f))
483+
) {
484+
Column(modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp)) {
485+
Text(
486+
text = locale["main.query_settings.title"],
487+
style = MaterialTheme.typography.subtitle1
488+
)
489+
490+
Spacer(modifier = Modifier.height(8.dp))
491+
492+
}
493+
}
494+
}
495+
456496
@Composable
457497
private fun ColumnChip(
458498
label: String,

ui/src/main/resources/i18n/strings_de.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ main.error_load=Erstellen des Datenpools fehlgeschlagen
2020
main.status.success=Erfolg
2121
main.status.error=Fehler
2222
main.tooltip.no_semantic=Semantische Suche ist nicht verfügbar für diesen Datenpool.
23+
main.query_settings.title=Sucheinstellungen
2324

2425
# Pools Management Window
2526

ui/src/main/resources/i18n/strings_en.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ main.error_load=Failed to create a data pool
2020
main.status.success=Success
2121
main.status.error=Error
2222
main.tooltip.no_semantic=Semantic search is not available for this data pool.
23+
main.query_settings.title=Search Settings
2324

2425
# Pools Management Window
2526

0 commit comments

Comments
 (0)