Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: preview background reset after icon rename #284

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
}