From 50e1592c9be942bda7bdd00fd24ad2d3ccf89d3c Mon Sep 17 00:00:00 2001 From: Yahor Urbanovich Date: Sun, 3 Nov 2024 09:43:59 +0300 Subject: [PATCH] [Simple mode] Redesign actions --- .../ui/foundation/HorizontalDivider.kt | 16 ++ .../valkyrie/ui/foundation/TooltipButton.kt | 111 +++++----- .../valkyrie/ui/foundation/TopAppBar.kt | 124 +++++++++-- .../components/previewer/TopActions.kt | 18 +- .../valkyrie/ui/foundation/icons/Watch.kt | 68 ++++++ .../conversion/IconPackConversionScreen.kt | 4 +- .../conversion/SimpleConversionScreen.kt | 17 +- .../ui/SimpleConversionPickerStateUI.kt | 12 ++ .../ui/SimpleConversionPreviewUi.kt | 201 ------------------ .../ui/preview/SimpleConversionPreviewUi.kt | 162 ++++++++++++++ .../ui/preview/action/ExpandedActions.kt | 7 + .../ui/preview/action/ui/EditAction.kt | 53 +++++ .../ui/preview/action/ui/PreviewAction.kt | 35 +++ .../viewmodel/SimpleConversionState.kt | 4 +- .../viewmodel/SimpleConversionViewModel.kt | 4 +- .../settings/tabs/AboutSettingsScreen.kt | 10 +- 16 files changed, 535 insertions(+), 311 deletions(-) create mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/HorizontalDivider.kt create mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/icons/Watch.kt delete mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPreviewUi.kt create mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/SimpleConversionPreviewUi.kt create mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ExpandedActions.kt create mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/EditAction.kt create mode 100644 idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/PreviewAction.kt diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/HorizontalDivider.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/HorizontalDivider.kt new file mode 100644 index 00000000..7c2bca57 --- /dev/null +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/HorizontalDivider.kt @@ -0,0 +1,16 @@ +package io.github.composegears.valkyrie.ui.foundation + +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.Dp + +@Composable +fun HorizontalDivider(modifier: Modifier = Modifier) { + HorizontalDivider( + modifier = modifier, + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f), + thickness = Dp.Hairline, + ) +} diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TooltipButton.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TooltipButton.kt index 4d94905e..53f0c71b 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TooltipButton.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TooltipButton.kt @@ -26,84 +26,82 @@ import io.github.composegears.valkyrie.ui.foundation.icons.ValkyrieIcons import io.github.composegears.valkyrie.ui.foundation.icons.WhiteCircle import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme -@OptIn(ExperimentalFoundationApi::class) @Composable fun TooltipIconButton( - tooltipText: String, + hint: String, onClick: () -> Unit, icon: ImageVector, modifier: Modifier = Modifier, ) { - TooltipArea( + TooltipButton( modifier = modifier, - tooltip = { - Box( - modifier = Modifier - .clip(RoundedCornerShape(4.dp)) - .background(MaterialTheme.colorScheme.inverseSurface) - .padding(8.dp), - ) { - Text( - text = tooltipText, - color = MaterialTheme.colorScheme.inverseOnSurface, - style = MaterialTheme.typography.bodySmall, - ) - } - }, - content = { - Box( - modifier = Modifier.size(24.dp) - .clip(RoundedCornerShape(4.dp)) - .clickable(onClick = onClick), - contentAlignment = Alignment.Center, - ) { - Icon( - tint = MaterialTheme.colorScheme.onSurface, - imageVector = icon, - contentDescription = null, - ) - } - }, - ) + hint = hint, + ) { + Box( + modifier = Modifier.size(24.dp) + .clip(RoundedCornerShape(4.dp)) + .clickable(onClick = onClick), + contentAlignment = Alignment.Center, + ) { + Icon( + tint = MaterialTheme.colorScheme.onSurface, + imageVector = icon, + contentDescription = null, + ) + } + } } -@OptIn(ExperimentalFoundationApi::class) @Composable fun TooltipImageButton( - tooltipText: String, - icon: ImageVector, + hint: String, + image: ImageVector, onClick: () -> Unit, modifier: Modifier = Modifier, +) { + TooltipButton( + modifier = modifier, + hint = hint, + ) { + Box( + modifier = Modifier.size(24.dp) + .clip(RoundedCornerShape(4.dp)) + .clickable(onClick = onClick), + contentAlignment = Alignment.Center, + ) { + Image( + imageVector = image, + contentDescription = null, + ) + } + } +} + +@OptIn(ExperimentalFoundationApi::class) +@Composable +fun TooltipButton( + hint: String, + modifier: Modifier = Modifier, + content: @Composable () -> Unit, ) { TooltipArea( modifier = modifier, + delayMillis = 1_000, tooltip = { Box( modifier = Modifier .clip(RoundedCornerShape(4.dp)) .background(MaterialTheme.colorScheme.inverseSurface) - .padding(8.dp), + .padding(horizontal = 16.dp, vertical = 8.dp), ) { Text( - text = tooltipText, + text = hint, color = MaterialTheme.colorScheme.inverseOnSurface, style = MaterialTheme.typography.bodySmall, ) } }, - content = { - Box( - modifier = Modifier.size(24.dp) - .clip(RoundedCornerShape(4.dp)) - .clickable(onClick = onClick), - contentAlignment = Alignment.Center, - ) { - Image( - imageVector = icon, - contentDescription = null, - ) - } - }, + content = content, ) } @@ -112,19 +110,22 @@ fun TooltipImageButton( private fun TooltipButtonPreview() = PreviewTheme { Row { TooltipIconButton( - tooltipText = "Show pixel grid", + hint = "Show pixel grid", onClick = {}, icon = ValkyrieIcons.Chessboard, ) TooltipImageButton( - tooltipText = "Show white background", - icon = ValkyrieIcons.WhiteCircle, + hint = "Show white background", + image = ValkyrieIcons.WhiteCircle, onClick = {}, ) TooltipImageButton( - tooltipText = "Show black background", - icon = ValkyrieIcons.BlackCircle, + hint = "Show black background", + image = ValkyrieIcons.BlackCircle, onClick = {}, ) + TooltipButton(hint = "Test") { + Text(text = "Generic content") + } } } diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TopAppBar.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TopAppBar.kt index 5ad23fcb..2988dbaa 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TopAppBar.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/TopAppBar.kt @@ -1,23 +1,30 @@ package io.github.composegears.valkyrie.ui.foundation import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.material3.IconButtonDefaults import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import io.github.composegears.valkyrie.ui.foundation.icons.Back import io.github.composegears.valkyrie.ui.foundation.icons.Close import io.github.composegears.valkyrie.ui.foundation.icons.Copy +import io.github.composegears.valkyrie.ui.foundation.icons.Edit import io.github.composegears.valkyrie.ui.foundation.icons.Settings import io.github.composegears.valkyrie.ui.foundation.icons.ValkyrieIcons +import io.github.composegears.valkyrie.ui.foundation.icons.Watch import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme @Composable @@ -31,6 +38,7 @@ fun TopAppBar( .height(40.dp) .padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(4.dp), ) { content() } @@ -54,23 +62,27 @@ fun BackAction( modifier: Modifier = Modifier, onBack: () -> Unit, ) { - IconButton( + SelectableAction( modifier = modifier.size(32.dp), - onClick = onBack, - iconSize = 18.dp, imageVector = ValkyrieIcons.Back, + iconSize = 18.dp, + hint = "Back", + onClick = onBack, + selected = false, ) } @Composable -fun ClearAction( +fun CloseAction( modifier: Modifier = Modifier, - onClear: () -> Unit, + onClose: () -> Unit, ) { - IconButton( + SelectableAction( modifier = modifier.size(32.dp), imageVector = ValkyrieIcons.Close, - onClick = onClear, + hint = "Close", + onClick = onClose, + selected = false, ) } @@ -79,11 +91,13 @@ fun CopyAction( modifier: Modifier = Modifier, onCopy: () -> Unit, ) { - IconButton( + SelectableAction( modifier = modifier.size(32.dp), imageVector = ValkyrieIcons.Copy, + hint = "Copy", iconSize = 18.dp, onClick = onCopy, + selected = false, ) } @@ -92,23 +106,101 @@ fun SettingsAction( modifier: Modifier = Modifier, openSettings: () -> Unit, ) { - IconButton( + SelectableAction( modifier = modifier.size(32.dp), imageVector = ValkyrieIcons.Settings, + hint = "Settings", iconSize = 18.dp, onClick = openSettings, + selected = false, + ) +} + +@Composable +fun PreviewAction( + selected: Boolean, + modifier: Modifier = Modifier, + onPreview: () -> Unit, +) { + SelectableAction( + modifier = modifier.size(32.dp), + imageVector = ValkyrieIcons.Watch, + hint = "Preview", + iconSize = 18.dp, + onClick = onPreview, + selected = selected, ) } +@Composable +fun EditAction( + selected: Boolean, + modifier: Modifier = Modifier, + onEdit: () -> Unit, +) { + SelectableAction( + modifier = modifier.size(32.dp), + imageVector = ValkyrieIcons.Edit, + hint = "Edit", + iconSize = 18.dp, + onClick = onEdit, + selected = selected, + ) +} + +@Composable +private fun SelectableAction( + imageVector: ImageVector, + hint: String, + selected: Boolean, + modifier: Modifier = Modifier, + iconSize: Dp = Dp.Unspecified, + onClick: () -> Unit, +) { + TooltipButton( + hint = hint, + modifier = modifier, + ) { + IconButton( + imageVector = imageVector, + iconSize = iconSize, + onClick = onClick, + colors = if (selected) { + IconButtonDefaults.iconButtonColors().copy( + containerColor = MaterialTheme.colorScheme.primary, + contentColor = MaterialTheme.colorScheme.onPrimary, + ) + } else { + IconButtonDefaults.iconButtonColors() + }, + ) + } +} + @Preview @Composable private fun TopAppBarPreview() = PreviewTheme(alignment = Alignment.TopCenter) { - TopAppBar { - BackAction {} - AppBarTitle(title = "Title") - WeightSpacer() - ClearAction {} - CopyAction {} - SettingsAction {} + Column { + TopAppBar { + BackAction {} + AppBarTitle(title = "Title") + WeightSpacer() + CloseAction {} + CopyAction {} + PreviewAction(selected = false) { } + EditAction(selected = false) {} + SettingsAction {} + } + HorizontalDivider() + TopAppBar { + BackAction {} + AppBarTitle(title = "Title") + WeightSpacer() + CloseAction {} + CopyAction {} + EditAction(selected = true) {} + PreviewAction(selected = true) { } + SettingsAction {} + } } } diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/components/previewer/TopActions.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/components/previewer/TopActions.kt index d963f4d7..8abc0813 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/components/previewer/TopActions.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/components/previewer/TopActions.kt @@ -46,18 +46,18 @@ fun TopActions( horizontalArrangement = Arrangement.spacedBy(2.dp), ) { TooltipIconButton( - tooltipText = "Show pixel grid", + hint = "Show pixel grid", icon = ValkyrieIcons.Chessboard, onClick = { onBgTypeChange(BgType.PixelGrid) }, ) TooltipImageButton( - tooltipText = "Show white background", - icon = ValkyrieIcons.WhiteCircle, + hint = "Show white background", + image = ValkyrieIcons.WhiteCircle, onClick = { onBgTypeChange(BgType.White) }, ) TooltipImageButton( - tooltipText = "Show black background", - icon = ValkyrieIcons.BlackCircle, + hint = "Show black background", + image = ValkyrieIcons.BlackCircle, onClick = { onBgTypeChange(BgType.Black) }, ) VerticalDivider( @@ -65,22 +65,22 @@ fun TopActions( color = MaterialTheme.colorScheme.onSurface.disabled(), ) TooltipIconButton( - tooltipText = "Zoom In", + hint = "Zoom In", icon = ValkyrieIcons.ZoomIn, onClick = zoomIn, ) TooltipIconButton( - tooltipText = "Zoom Out", + hint = "Zoom Out", icon = ValkyrieIcons.ZoomOut, onClick = zoomOut, ) TooltipIconButton( - tooltipText = "Actual Size", + hint = "Actual Size", icon = ValkyrieIcons.ActualZoom, onClick = onActualSize, ) TooltipIconButton( - tooltipText = "Fit Zoom to Window", + hint = "Fit Zoom to Window", icon = ValkyrieIcons.FitContent, onClick = fitToWindow, ) diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/icons/Watch.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/icons/Watch.kt new file mode 100644 index 00000000..f429bd54 --- /dev/null +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/icons/Watch.kt @@ -0,0 +1,68 @@ +package io.github.composegears.valkyrie.ui.foundation.icons + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.path +import androidx.compose.ui.unit.dp +import kotlin.Suppress + +val ValkyrieIcons.Watch: ImageVector + get() { + if (_Watch != null) { + return _Watch!! + } + _Watch = ImageVector.Builder( + name = "Watch", + defaultWidth = 16.dp, + defaultHeight = 16.dp, + viewportWidth = 16f, + viewportHeight = 16f, + ).apply { + path( + fill = SolidColor(Color(0xFF6C707E)), + pathFillType = PathFillType.EvenOdd, + ) { + moveTo(6.625f, 6.547f) + curveTo(6.114f, 5.625f, 5.13f, 5f, 4f, 5f) + curveTo(2.694f, 5f, 1.583f, 5.835f, 1.171f, 7f) + horizontalLineTo(0.5f) + curveTo(0.224f, 7f, 0f, 7.224f, 0f, 7.5f) + curveTo(0f, 7.776f, 0.224f, 8f, 0.5f, 8f) + horizontalLineTo(1f) + curveTo(1f, 9.657f, 2.343f, 11f, 4f, 11f) + curveTo(5.657f, 11f, 7f, 9.657f, 7f, 8f) + curveTo(7f, 7.448f, 7.448f, 7f, 8f, 7f) + curveTo(8.552f, 7f, 9f, 7.448f, 9f, 8f) + curveTo(9f, 9.657f, 10.343f, 11f, 12f, 11f) + curveTo(13.657f, 11f, 15f, 9.657f, 15f, 8f) + horizontalLineTo(15.5f) + curveTo(15.776f, 8f, 16f, 7.776f, 16f, 7.5f) + curveTo(16f, 7.224f, 15.776f, 7f, 15.5f, 7f) + horizontalLineTo(14.829f) + curveTo(14.417f, 5.835f, 13.306f, 5f, 12f, 5f) + curveTo(10.87f, 5f, 9.886f, 5.625f, 9.375f, 6.547f) + curveTo(9.016f, 6.208f, 8.532f, 6f, 8f, 6f) + curveTo(7.468f, 6f, 6.984f, 6.208f, 6.625f, 6.547f) + close() + moveTo(4f, 10f) + curveTo(5.105f, 10f, 6f, 9.105f, 6f, 8f) + curveTo(6f, 6.895f, 5.105f, 6f, 4f, 6f) + curveTo(2.895f, 6f, 2f, 6.895f, 2f, 8f) + curveTo(2f, 9.105f, 2.895f, 10f, 4f, 10f) + close() + moveTo(10f, 8f) + curveTo(10f, 9.105f, 10.895f, 10f, 12f, 10f) + curveTo(13.105f, 10f, 14f, 9.105f, 14f, 8f) + curveTo(14f, 6.895f, 13.105f, 6f, 12f, 6f) + curveTo(10.895f, 6f, 10f, 6.895f, 10f, 8f) + close() + } + }.build() + + return _Watch!! + } + +@Suppress("ObjectPropertyName") +private var _Watch: ImageVector? = null diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionScreen.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionScreen.kt index d4c0317c..811dc1d0 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionScreen.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/conversion/IconPackConversionScreen.kt @@ -49,7 +49,7 @@ import com.intellij.openapi.vfs.VirtualFileManager import io.github.composegears.valkyrie.service.GlobalEventsHandler.PendingPathData import io.github.composegears.valkyrie.ui.foundation.AppBarTitle import io.github.composegears.valkyrie.ui.foundation.BackAction -import io.github.composegears.valkyrie.ui.foundation.ClearAction +import io.github.composegears.valkyrie.ui.foundation.CloseAction import io.github.composegears.valkyrie.ui.foundation.SettingsAction import io.github.composegears.valkyrie.ui.foundation.TopAppBar import io.github.composegears.valkyrie.ui.foundation.WeightSpacer @@ -173,7 +173,7 @@ private fun IconPackConversionUi( BackAction(onBack = onBack) } is IconPackCreationState -> { - ClearAction(onClear = onReset) + CloseAction(onClose = onReset) } } } diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt index 240122cd..7943a68c 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt @@ -18,18 +18,12 @@ import com.composegears.tiamat.navController import com.composegears.tiamat.navDestination import com.composegears.tiamat.navigationSlideInOut import com.composegears.tiamat.rememberSaveableViewModel -import io.github.composegears.valkyrie.ui.foundation.AppBarTitle -import io.github.composegears.valkyrie.ui.foundation.BackAction -import io.github.composegears.valkyrie.ui.foundation.ClearAction -import io.github.composegears.valkyrie.ui.foundation.SettingsAction -import io.github.composegears.valkyrie.ui.foundation.TopAppBar -import io.github.composegears.valkyrie.ui.foundation.WeightSpacer import io.github.composegears.valkyrie.ui.foundation.rememberSnackbar import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme import io.github.composegears.valkyrie.ui.platform.copyInClipboard import io.github.composegears.valkyrie.ui.platform.picker.rememberFilePicker import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.SimpleConversionPickerStateUI -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.SimpleConversionPreviewStateUi +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.SimpleConversionPreviewStateUi import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.Back import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.ClosePreview @@ -101,15 +95,6 @@ private fun ConversionUi( onAction: (SimpleConversionAction) -> Unit, ) { Column(modifier = Modifier.fillMaxSize()) { - TopAppBar { - when (state) { - is PickerState -> BackAction(onBack = { onAction(Back) }) - is ConversionState -> ClearAction(onClear = { onAction(ClosePreview) }) - } - AppBarTitle(title = "Simple conversion") - WeightSpacer() - SettingsAction(openSettings = { onAction(OpenSettings) }) - } AnimatedContent( modifier = Modifier.fillMaxSize(), targetState = state, diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPickerStateUI.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPickerStateUI.kt index 2a8b8876..556ce87d 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPickerStateUI.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPickerStateUI.kt @@ -27,7 +27,11 @@ import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp +import io.github.composegears.valkyrie.ui.foundation.AppBarTitle +import io.github.composegears.valkyrie.ui.foundation.BackAction import io.github.composegears.valkyrie.ui.foundation.DragAndDropBox +import io.github.composegears.valkyrie.ui.foundation.SettingsAction +import io.github.composegears.valkyrie.ui.foundation.TopAppBar import io.github.composegears.valkyrie.ui.foundation.WeightSpacer import io.github.composegears.valkyrie.ui.foundation.disabled import io.github.composegears.valkyrie.ui.foundation.icons.AddFile @@ -41,9 +45,11 @@ import io.github.composegears.valkyrie.ui.platform.pasteFromClipboard import io.github.composegears.valkyrie.ui.platform.rememberCurrentOs import io.github.composegears.valkyrie.ui.platform.rememberFileDragAndDropHandler import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.Back import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OnDragAndDropPath import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OnPasteFromClipboard import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OpenFilePicker +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OpenSettings import java.nio.file.Path @OptIn(ExperimentalComposeUiApi::class) @@ -75,6 +81,12 @@ fun SimpleConversionPickerStateUI( }, horizontalAlignment = Alignment.CenterHorizontally, ) { + TopAppBar { + BackAction(onBack = { onAction(Back) }) + AppBarTitle(title = "Simple conversion") + WeightSpacer() + SettingsAction(openSettings = { onAction(OpenSettings) }) + } WeightSpacer(weight = 0.3f) SelectableState( onDragAndDrop = { onAction(OnDragAndDropPath(it)) }, diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPreviewUi.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPreviewUi.kt deleted file mode 100644 index af9767e8..00000000 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/SimpleConversionPreviewUi.kt +++ /dev/null @@ -1,201 +0,0 @@ -package io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui - -import androidx.compose.desktop.ui.tooling.preview.Preview -import androidx.compose.foundation.Image -import androidx.compose.foundation.background -import androidx.compose.foundation.gestures.detectTapGestures -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.MaterialTheme -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.produceState -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.painter.Painter -import androidx.compose.ui.input.pointer.pointerInput -import androidx.compose.ui.platform.LocalInspectionMode -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp -import io.github.composegears.valkyrie.parser.svgxml.util.IconType.SVG -import io.github.composegears.valkyrie.ui.foundation.CopyAction -import io.github.composegears.valkyrie.ui.foundation.FocusableTextField -import io.github.composegears.valkyrie.ui.foundation.FocusableTextFieldDefaults -import io.github.composegears.valkyrie.ui.foundation.HorizontalSpacer -import io.github.composegears.valkyrie.ui.foundation.SizeSpacer -import io.github.composegears.valkyrie.ui.foundation.VerticalSpacer -import io.github.composegears.valkyrie.ui.foundation.WeightSpacer -import io.github.composegears.valkyrie.ui.foundation.highlights.KotlinCodeViewer -import io.github.composegears.valkyrie.ui.foundation.previewbg.BgType -import io.github.composegears.valkyrie.ui.foundation.previewbg.PreviewBackground -import io.github.composegears.valkyrie.ui.foundation.rememberMutableState -import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.IconContent -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.IconSource -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OnCopyInClipboard -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OnIconNaneChange -import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionState.ConversionState -import io.github.composegears.valkyrie.util.PainterConverter -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext - -@Composable -fun SimpleConversionPreviewStateUi( - state: ConversionState, - onAction: (SimpleConversionAction) -> Unit, - modifier: Modifier = Modifier, -) { - var codePreview by rememberMutableState(state.iconContent.code) { state.iconContent.code } - - Column(modifier = modifier.fillMaxSize()) { - VerticalSpacer(4.dp) - HorizontalDivider( - color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f), - thickness = Dp.Hairline, - ) - VerticalSpacer(8.dp) - Row( - modifier = Modifier - .padding(horizontal = 16.dp, vertical = 2.dp) - .fillMaxWidth(), - verticalAlignment = Alignment.CenterVertically, - ) { - FocusableTextField( - value = state.iconContent.name, - onValueChange = { onAction(OnIconNaneChange(it)) }, - colors = FocusableTextFieldDefaults.colors().copy( - unfocusedBorderColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f), - focusedBorderColor = MaterialTheme.colorScheme.onSurface, - ), - ) - HorizontalSpacer(8.dp) - CopyAction(onCopy = { onAction(OnCopyInClipboard(codePreview)) }) - WeightSpacer() - IconPreview(state = state) - } - VerticalSpacer(8.dp) - HorizontalDivider( - color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f), - thickness = Dp.Hairline, - ) - KotlinCodeViewer( - modifier = Modifier.fillMaxSize(), - text = codePreview, - onChange = { - codePreview = it - }, - ) - } -} - -@Composable -private fun IconPreview(state: ConversionState) { - var bgType by rememberMutableState { BgType.PixelGrid } - - val iconPainter by produceState(initialValue = null) { - value = withContext(Dispatchers.Default) { - when (val source = state.iconSource) { - is IconSource.FileBasedIcon -> PainterConverter.from( - path = source.path, - ) - is IconSource.StringBasedIcon -> PainterConverter.from( - text = source.text, - iconType = state.iconContent.iconType, - ) - } - } - } - - when (val painter = iconPainter) { - null -> { - if (LocalInspectionMode.current) { - Spacer( - modifier = Modifier - .size(32.dp) - .clip(MaterialTheme.shapes.extraSmall) - .background(Color.LightGray), - ) - } else { - SizeSpacer(32.dp) - } - } - else -> { - Box( - modifier = Modifier - .size(32.dp) - .clip(MaterialTheme.shapes.extraSmall) - .pointerInput(Unit) { - detectTapGestures( - onTap = { - bgType = bgType.next() - }, - ) - }, - contentAlignment = Alignment.Center, - ) { - PreviewBackground( - bgType = bgType, - gridSize = (32f / 11f).dp, - modifier = Modifier.matchParentSize(), - ) - Image( - modifier = Modifier.matchParentSize(), - painter = painter, - contentDescription = null, - ) - } - } - } -} - -@Preview -@Composable -private fun SimpleConversionPreviewUiPreview() = PreviewTheme { - SimpleConversionPreviewStateUi( - state = ConversionState( - iconSource = IconSource.StringBasedIcon(""), - iconContent = IconContent( - name = "IconName", - iconType = SVG, - code = """ - package io.github.composegears.valkyrie.icons - - import androidx.compose.ui.graphics.vector.ImageVector - import androidx.compose.ui.unit.dp - - val WithoutPath: ImageVector - get() { - if (_WithoutPath != null) { - return _WithoutPath!! - } - _WithoutPath = ImageVector.Builder( - name = "WithoutPath", - defaultWidth = 24.dp, - defaultHeight = 24.dp, - viewportWidth = 18f, - viewportHeight = 18f - ).build() - - return _WithoutPath!! - } - - @Suppress("ObjectPropertyName") - private var _WithoutPath: ImageVector? = null - - """.trimIndent(), - ), - ), - onAction = {}, - ) -} diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/SimpleConversionPreviewUi.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/SimpleConversionPreviewUi.kt new file mode 100644 index 00000000..e76189fd --- /dev/null +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/SimpleConversionPreviewUi.kt @@ -0,0 +1,162 @@ +package io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview + +import androidx.compose.animation.AnimatedContent +import androidx.compose.animation.SizeTransform +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideInVertically +import androidx.compose.animation.slideOutVertically +import androidx.compose.animation.togetherWith +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import io.github.composegears.valkyrie.ir.IrImageVector +import io.github.composegears.valkyrie.ui.foundation.AppBarTitle +import io.github.composegears.valkyrie.ui.foundation.CloseAction +import io.github.composegears.valkyrie.ui.foundation.CopyAction +import io.github.composegears.valkyrie.ui.foundation.EditAction +import io.github.composegears.valkyrie.ui.foundation.HorizontalDivider +import io.github.composegears.valkyrie.ui.foundation.PreviewAction +import io.github.composegears.valkyrie.ui.foundation.SettingsAction +import io.github.composegears.valkyrie.ui.foundation.TopAppBar +import io.github.composegears.valkyrie.ui.foundation.WeightSpacer +import io.github.composegears.valkyrie.ui.foundation.highlights.KotlinCodeViewer +import io.github.composegears.valkyrie.ui.foundation.rememberMutableState +import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.action.ExpandedActions +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.action.ui.EditAction +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.action.ui.PreviewAction +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.IconContent +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.IconSource +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.ClosePreview +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OnCopyInClipboard +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OnIconNaneChange +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionAction.OpenSettings +import io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel.SimpleConversionState.ConversionState + +@Composable +fun SimpleConversionPreviewStateUi( + state: ConversionState, + onAction: (SimpleConversionAction) -> Unit, + modifier: Modifier = Modifier, +) { + var codePreview by rememberMutableState(state.iconContent.code) { state.iconContent.code } + var expandedAction by rememberMutableState { ExpandedActions.None } + + Column(modifier = modifier.fillMaxSize()) { + TopAppBar { + CloseAction(onClose = { onAction(ClosePreview) }) + AppBarTitle(title = "Simple conversion") + WeightSpacer() + EditAction( + onEdit = { + expandedAction = when (expandedAction) { + ExpandedActions.Edit -> ExpandedActions.None + else -> ExpandedActions.Edit + } + }, + selected = expandedAction == ExpandedActions.Edit, + ) + PreviewAction( + onPreview = { + expandedAction = when (expandedAction) { + ExpandedActions.Preview -> ExpandedActions.None + else -> ExpandedActions.Preview + } + }, + selected = expandedAction == ExpandedActions.Preview, + ) + CopyAction(onCopy = { onAction(OnCopyInClipboard(codePreview)) }) + SettingsAction(openSettings = { onAction(OpenSettings) }) + } + AnimatedContent( + modifier = Modifier.fillMaxWidth(), + targetState = expandedAction, + transitionSpec = { + if (initialState != targetState) { + (slideInVertically { height -> -height } + fadeIn()) togetherWith + slideOutVertically { height -> -height } + fadeOut() + } else { + slideInVertically { height -> height } + fadeIn() togetherWith + slideOutVertically { height -> height } + fadeOut() + }.using( + SizeTransform(clip = true), + ) + }, + ) { actions -> + when (actions) { + ExpandedActions.Edit -> { + EditAction( + iconName = state.iconContent.name, + onNameChange = { onAction(OnIconNaneChange(it)) }, + ) + } + ExpandedActions.Preview -> PreviewAction(irImageVector = state.iconContent.irImageVector) + ExpandedActions.None -> Spacer(modifier = Modifier.fillMaxWidth()) + } + } + HorizontalDivider() + KotlinCodeViewer( + modifier = Modifier.fillMaxSize(), + text = codePreview, + onChange = { + codePreview = it + }, + ) + } +} + +@Preview +@Composable +private fun SimpleConversionPreviewUiPreview() = PreviewTheme { + SimpleConversionPreviewStateUi( + state = ConversionState( + iconSource = IconSource.StringBasedIcon(""), + iconContent = IconContent( + name = "IconName", + irImageVector = IrImageVector( + name = "WithoutPath", + defaultWidth = 24f, + defaultHeight = 24f, + viewportWidth = 18f, + viewportHeight = 18f, + nodes = emptyList(), + ), + code = """ + package io.github.composegears.valkyrie.icons + + import androidx.compose.ui.graphics.vector.ImageVector + import androidx.compose.ui.unit.dp + + val WithoutPath: ImageVector + get() { + if (_WithoutPath != null) { + return _WithoutPath!! + } + _WithoutPath = ImageVector.Builder( + name = "WithoutPath", + defaultWidth = 24.dp, + defaultHeight = 24.dp, + viewportWidth = 18f, + viewportHeight = 18f + ).build() + + return _WithoutPath!! + } + + @Suppress("ObjectPropertyName") + private var _WithoutPath: ImageVector? = null + + """.trimIndent(), + ), + ), + onAction = {}, + ) +} diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ExpandedActions.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ExpandedActions.kt new file mode 100644 index 00000000..a39146c8 --- /dev/null +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ExpandedActions.kt @@ -0,0 +1,7 @@ +package io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.action + +enum class ExpandedActions { + Edit, + Preview, + None, +} diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/EditAction.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/EditAction.kt new file mode 100644 index 00000000..b44d2da8 --- /dev/null +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/EditAction.kt @@ -0,0 +1,53 @@ +package io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.action.ui + +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import io.github.composegears.valkyrie.ui.foundation.FocusableTextField +import io.github.composegears.valkyrie.ui.foundation.FocusableTextFieldDefaults +import io.github.composegears.valkyrie.ui.foundation.HorizontalDivider +import io.github.composegears.valkyrie.ui.foundation.disabled +import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme + +@Composable +fun EditAction( + iconName: String, + modifier: Modifier = Modifier, + onNameChange: (String) -> Unit, +) { + Column(modifier = modifier.fillMaxWidth()) { + HorizontalDivider() + Column(modifier = Modifier.padding(16.dp)) { + Text( + modifier = Modifier.padding(start = 4.dp, bottom = 4.dp), + text = "Name", + style = MaterialTheme.typography.labelSmall, + color = LocalContentColor.current.disabled(), + ) + FocusableTextField( + value = iconName, + onValueChange = onNameChange, + colors = FocusableTextFieldDefaults.colors().copy( + unfocusedBorderColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f), + focusedBorderColor = MaterialTheme.colorScheme.onSurface, + ), + ) + } + } +} + +@Preview +@Composable +private fun EditActionPreview() = PreviewTheme { + EditAction( + iconName = "IconName", + onNameChange = {}, + ) +} diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/PreviewAction.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/PreviewAction.kt new file mode 100644 index 00000000..97ff5a49 --- /dev/null +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/ui/preview/action/ui/PreviewAction.kt @@ -0,0 +1,35 @@ +package io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.ui.preview.action.ui + +import androidx.compose.desktop.ui.tooling.preview.Preview +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import io.github.composegears.valkyrie.ir.IR_STUB +import io.github.composegears.valkyrie.ir.IrImageVector +import io.github.composegears.valkyrie.ui.foundation.HorizontalDivider +import io.github.composegears.valkyrie.ui.foundation.components.previewer.ImageVectorPreviewPanel +import io.github.composegears.valkyrie.ui.foundation.theme.PreviewTheme + +@Composable +fun PreviewAction( + irImageVector: IrImageVector, + modifier: Modifier = Modifier, +) { + Column(modifier = modifier.fillMaxWidth()) { + HorizontalDivider() + ImageVectorPreviewPanel( + modifier = Modifier.height(250.dp), + irImageVector = irImageVector, + ) + } +} + +@Preview +@Composable +private fun PreviewActionPreview() = PreviewTheme(alignment = Alignment.TopCenter) { + PreviewAction(irImageVector = IR_STUB) +} diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionState.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionState.kt index accae80e..ac7be347 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionState.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionState.kt @@ -1,6 +1,6 @@ package io.github.composegears.valkyrie.ui.screen.mode.simple.conversion.viewmodel -import io.github.composegears.valkyrie.parser.svgxml.util.IconType +import io.github.composegears.valkyrie.ir.IrImageVector import java.nio.file.Path sealed interface SimpleConversionState { @@ -20,5 +20,5 @@ sealed interface IconSource { data class IconContent( val name: String, val code: String, - val iconType: IconType, + val irImageVector: IrImageVector, ) diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionViewModel.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionViewModel.kt index 950494ca..7127123f 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionViewModel.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/viewmodel/SimpleConversionViewModel.kt @@ -177,7 +177,7 @@ class SimpleConversionViewModel( IconContent( name = name, code = output.content, - iconType = parserOutput.iconType, + irImageVector = parserOutput.irImageVector, ) }.getOrNull() } @@ -209,7 +209,7 @@ class SimpleConversionViewModel( IconContent( name = iconName, code = output.content, - iconType = parserOutput.iconType, + irImageVector = parserOutput.irImageVector, ) }.getOrNull() } diff --git a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/AboutSettingsScreen.kt b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/AboutSettingsScreen.kt index 046d3e35..003780b5 100644 --- a/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/AboutSettingsScreen.kt +++ b/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/AboutSettingsScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.text.BasicText import androidx.compose.foundation.text.InlineTextContent import androidx.compose.foundation.text.appendInlineContent -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.LocalContentColor import androidx.compose.material3.LocalTextStyle @@ -27,13 +26,12 @@ import androidx.compose.ui.text.PlaceholderVerticalAlign import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.withLink -import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.composegears.tiamat.navDestination import io.github.composegears.valkyrie.extensions.cast +import io.github.composegears.valkyrie.ui.foundation.HorizontalDivider import io.github.composegears.valkyrie.ui.foundation.VerticalSpacer import io.github.composegears.valkyrie.ui.foundation.dim -import io.github.composegears.valkyrie.ui.foundation.disabled import io.github.composegears.valkyrie.ui.foundation.icons.ExternalLink import io.github.composegears.valkyrie.ui.foundation.icons.PluginIcon import io.github.composegears.valkyrie.ui.foundation.icons.ValkyrieIcons @@ -74,11 +72,7 @@ private fun AboutSettingsUi() { } } VerticalSpacer(16.dp) - HorizontalDivider( - modifier = Modifier.padding(horizontal = 16.dp), - color = LocalContentColor.current.disabled(), - thickness = Dp.Hairline, - ) + HorizontalDivider(modifier = Modifier.padding(horizontal = 16.dp)) VerticalSpacer(16.dp) val browser = rememberBrowser()