Skip to content

Commit

Permalink
UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jsixface committed Mar 13, 2024
1 parent 2b23aee commit f1798d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 32 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ij_continuation_indent_size = 4
# ij_smart_tabs = false
# ij_visual_guides =
# ij_wrap_on_typing = false
ij_java_use_single_class_imports = true

[*.yml]
indent_size = 2
16 changes: 5 additions & 11 deletions composeApp/src/commonMain/kotlin/ui/home/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
Expand Down Expand Up @@ -53,7 +54,7 @@ object HomeScreen : Screen {
private var selectedVideo by mutableStateOf<VideoFile?>(null)
private var showFileDetails by mutableStateOf(false)
private val bottomPad = Modifier.padding(0.dp, 0.dp, 0.dp, 8.dp)
private val sidePad = Modifier.padding(0.dp, 16.dp)
private val sidePad = Modifier.padding(8.dp, 0.dp, 0.dp, 0.dp)

override val name: String
get() = "Home"
Expand Down Expand Up @@ -158,16 +159,9 @@ object HomeScreen : Screen {
label = { Text("File name") },
leadingIcon = { Icon(Icons.Rounded.Search, contentDescription = "Search") })
val videoOptions = list.asSequence().flatMap { it.videos }.map { it.codec }.toSet().toList().sorted()
FilterOptions(
"Video Codecs", videoOptions,
filteredVideoCodec
) { filteredVideoCodec = it }
FilterOptions("Video Codecs", videoOptions, filteredVideoCodec) { filteredVideoCodec = it }
val audioOptions = list.asSequence().flatMap { it.audios }.map { it.codec }.toSet().toList().sorted()
FilterOptions(
"Audio Codecs", audioOptions,
filteredAudioCodec
) { filteredAudioCodec = it }

FilterOptions("Audio Codecs", audioOptions, filteredAudioCodec) { filteredAudioCodec = it }
IconButton(modifier = sidePad, onClick = onRefresh) {
Icon(Icons.Rounded.Refresh, contentDescription = "Refresh")
}
Expand Down Expand Up @@ -210,7 +204,7 @@ object HomeScreen : Screen {
onSelect: (String) -> Unit
) {
var expanded by remember { mutableStateOf(false) }
ExposedDropdownMenuBox(expanded, onExpandedChange = { expanded = it }, modifier = sidePad) {
ExposedDropdownMenuBox(expanded, onExpandedChange = { expanded = it }, modifier = sidePad.height(32.dp)) {
TextField(
// The `menuAnchor` modifier must be passed to the text field for correctness.
modifier = sidePad.menuAnchor(),
Expand Down
30 changes: 10 additions & 20 deletions composeApp/src/desktopMain/kotlin/Previews.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@

import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.runtime.Composable
import io.github.jsixface.common.*
import ui.*
import io.github.jsixface.common.ConversionJob
import io.github.jsixface.common.JobStatus
import io.github.jsixface.common.MediaTrack
import io.github.jsixface.common.TrackType
import io.github.jsixface.common.VideoFile
import kotlin.random.Random
import ui.BackendDialogContent
import ui.BackupsScreen
import ui.JobsScreen
import ui.SettingsScreen
import ui.home.FileDetails
import ui.home.HomeScreen
import ui.theme.AppTheme
import kotlin.random.Random


private val videos = listOf(
Expand Down Expand Up @@ -83,23 +90,6 @@ fun previewBackendDialog() {
}
}


@Composable
@Preview
fun previewMainScreen() {
AppTheme {
MainScreen()
}
}

@Preview
@Composable
private fun seeHomeScreen() {
AppTheme {
HomeScreen.content()
}
}

@Preview
@Composable
private fun seeFileDetails() {
Expand Down
2 changes: 1 addition & 1 deletion composeApp/src/wasmJsMain/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Compose App</title>
<title>Codecs Conversion</title>
<script type="application/javascript" src="skiko.js"></script>
<script type="application/javascript" src="composeApp.js"></script>
</head>
Expand Down

0 comments on commit f1798d5

Please sign in to comment.