Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -15,7 +15,6 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Bookmark
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.outlined.BookmarkBorder
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand All @@ -30,7 +29,6 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import kotlindictionarymultiplatform.composeapp.generated.resources.Res
import kotlindictionarymultiplatform.composeapp.generated.resources.add_bookmark
import kotlindictionarymultiplatform.composeapp.generated.resources.icon
import kotlindictionarymultiplatform.composeapp.generated.resources.remove_bookmark
import org.jetbrains.compose.resources.stringResource

Expand Down Expand Up @@ -63,7 +61,12 @@ fun TopicCard(
.background(MaterialTheme.colorScheme.primary, CircleShape),
contentAlignment = Alignment.Center,
) {
Icon(Icons.Filled.Search, contentDescription = stringResource(Res.string.icon))
Text(
text = topic.firstOrNull()?.uppercase() ?: "?",
style = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.onPrimary,
),
)
}

Spacer(modifier = Modifier.width(12.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class TopicViewModel(
val result = repository.getTopics()
_topics.value = result.fold(
ifLeft = { UiState.Error(it) },
ifRight = {
_bookmarkedStates.value = List(it.size) { true }
UiState.Success(it)
ifRight = { list ->
val sortedList = list.sortedBy { it.name.lowercase() }
_bookmarkedStates.value = List(sortedList.size) { true }
UiState.Success(sortedList)
},
)
}
Expand Down
Loading