Small adjustment on the previous feature.
This commit is contained in:
parent
3bb25f4e63
commit
81c6450dbe
3 changed files with 13 additions and 31 deletions
|
|
@ -5,10 +5,7 @@ import com.pixelized.desktop.lwa.ui.screen.gamemaster.common.tag.GMTagUio
|
||||||
import com.pixelized.desktop.lwa.utils.extention.unAccent
|
import com.pixelized.desktop.lwa.utils.extention.unAccent
|
||||||
import com.pixelized.shared.lwa.model.campaign.Campaign
|
import com.pixelized.shared.lwa.model.campaign.Campaign
|
||||||
import com.pixelized.shared.lwa.model.characterSheet.CharacterSheetPreview
|
import com.pixelized.shared.lwa.model.characterSheet.CharacterSheetPreview
|
||||||
import lwacharactersheet.composeapp.generated.resources.Res
|
import java.text.Collator
|
||||||
import lwacharactersheet.composeapp.generated.resources.game_master__character_tag__character
|
|
||||||
import lwacharactersheet.composeapp.generated.resources.game_master__character_tag__npc
|
|
||||||
import org.jetbrains.compose.resources.getString
|
|
||||||
|
|
||||||
class GMCharacterFactory {
|
class GMCharacterFactory {
|
||||||
|
|
||||||
|
|
@ -49,7 +46,7 @@ class GMCharacterFactory {
|
||||||
character = it,
|
character = it,
|
||||||
tagIdMap = tagIdMap,
|
tagIdMap = tagIdMap,
|
||||||
)
|
)
|
||||||
}
|
}.sortedWith(compareBy(Collator.getInstance()) { it.name })
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun convertToGMCharacterPreviewUio(
|
private suspend fun convertToGMCharacterPreviewUio(
|
||||||
|
|
@ -90,25 +87,4 @@ class GMCharacterFactory {
|
||||||
actions = actions,
|
actions = actions,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun convertToGMTagItemUio(
|
|
||||||
id: String?,
|
|
||||||
highlight: Boolean,
|
|
||||||
): GMTagUio? {
|
|
||||||
return when (id) {
|
|
||||||
PLAYER_ID -> GMTagUio(
|
|
||||||
id = id,
|
|
||||||
label = getString(Res.string.game_master__character_tag__character),
|
|
||||||
highlight = highlight,
|
|
||||||
)
|
|
||||||
|
|
||||||
NPC_ID -> GMTagUio(
|
|
||||||
id = id,
|
|
||||||
label = getString(Res.string.game_master__character_tag__npc),
|
|
||||||
highlight = highlight,
|
|
||||||
)
|
|
||||||
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -21,6 +21,7 @@ import kotlinx.coroutines.runBlocking
|
||||||
import lwacharactersheet.composeapp.generated.resources.Res
|
import lwacharactersheet.composeapp.generated.resources.Res
|
||||||
import lwacharactersheet.composeapp.generated.resources.game_master__character__filter
|
import lwacharactersheet.composeapp.generated.resources.game_master__character__filter
|
||||||
import org.jetbrains.compose.resources.getString
|
import org.jetbrains.compose.resources.getString
|
||||||
|
import java.text.Collator
|
||||||
|
|
||||||
class GMCharacterViewModel(
|
class GMCharacterViewModel(
|
||||||
private val networkRepository: NetworkRepository,
|
private val networkRepository: NetworkRepository,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.pixelized.desktop.lwa.ui.screen.gamemaster.common.tag
|
package com.pixelized.desktop.lwa.ui.screen.gamemaster.common.tag
|
||||||
|
|
||||||
import com.pixelized.shared.lwa.model.tag.Tag
|
import com.pixelized.shared.lwa.model.tag.Tag
|
||||||
|
import java.text.Collator
|
||||||
|
|
||||||
class GMTagFactory {
|
class GMTagFactory {
|
||||||
|
|
||||||
|
|
@ -8,12 +9,16 @@ class GMTagFactory {
|
||||||
tags: Collection<Tag>,
|
tags: Collection<Tag>,
|
||||||
selectedTagId: String?,
|
selectedTagId: String?,
|
||||||
): List<GMTagUio> {
|
): List<GMTagUio> {
|
||||||
return tags.map { tag ->
|
return tags
|
||||||
|
.map { tag ->
|
||||||
convertToGMTagItemUio(
|
convertToGMTagItemUio(
|
||||||
tag = tag,
|
tag = tag,
|
||||||
selectedTagId = selectedTagId,
|
selectedTagId = selectedTagId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
.sortedWith(
|
||||||
|
comparator = compareBy(Collator.getInstance()) { it.label }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun convertToGMTagItemUio(
|
fun convertToGMTagItemUio(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue