Skip to content

Commit

Permalink
Fix: preview background reset after icon rename
Browse files Browse the repository at this point in the history
  • Loading branch information
egorikftp committed Nov 11, 2024
1 parent c8f963a commit 1ccc4b9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.git.luolix.topposegears.valkyrie.ui.screen.mode.iconpack.conversion

import io.git.luolix.topposegears.valkyrie.ir.IrImageVector
import io.git.luolix.topposegears.valkyrie.parser.svgxml.util.IconType
import io.git.luolix.topposegears.valkyrie.util.extension.Uuid

sealed interface IconPackConversionState {

Expand All @@ -20,11 +21,16 @@ sealed interface IconPackConversionState {
}

sealed interface BatchIcon {
val id: String
val iconName: IconName

data class Broken(override val iconName: IconName) : BatchIcon
data class Broken(
override val id: String = Uuid.random(),
override val iconName: IconName,
) : BatchIcon

data class Valid(
override val id: String = Uuid.random(),
override val iconName: IconName,
val iconPack: IconPack,
val iconType: IconType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fun BatchProcessingStateUi(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
items(items = state.icons, key = { it.iconName }) { batchIcon ->
items(items = state.icons, key = { it.id }) { batchIcon ->
when (batchIcon) {
is BatchIcon.Broken -> BrokenIconItem(
broken = batchIcon,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.git.luolix.topposegears.valkyrie.util.extension

import kotlin.uuid.ExperimentalUuidApi
import kotlin.uuid.Uuid

object Uuid {

@OptIn(ExperimentalUuidApi::class)
fun random() = Uuid.random().toString()
}

0 comments on commit 1ccc4b9

Please sign in to comment.