Skip to content

Commit

Permalink
fix: bug when the name of subcategory is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dixidroid committed Mar 18, 2024
1 parent beedcb3 commit 2e3a962
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,24 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
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.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.*
import androidx.compose.material.Card
import androidx.compose.material.Divider
import androidx.compose.material.Icon
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.outlined.HelpOutline
Expand Down Expand Up @@ -616,16 +631,19 @@ fun TopicItem(
topic: Topic,
onClick: (String, String) -> Unit,
) {
val topicName = topic.name.ifEmpty {
stringResource(id = R.string.discussion_unnamed_subcategory)
}
Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onClick(topic.id, topic.name) }
.clickable { onClick(topic.id, topicName) }
.padding(horizontal = 8.dp, vertical = 24.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
text = topic.name, style = MaterialTheme.appTypography.titleMedium,
text = topicName, style = MaterialTheme.appTypography.titleMedium,
color = MaterialTheme.appColors.textPrimary
)
Icon(
Expand Down

0 comments on commit 2e3a962

Please sign in to comment.