Skip to content

Commit

Permalink
fix: Address PR comments - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
omerhabib26 committed Oct 10, 2024
1 parent 44069d2 commit a4376c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
Expand Down Expand Up @@ -190,11 +190,7 @@ private fun DiscussionCommentsScreen(
mutableStateOf("")
}

val sendButtonColor = if (responseValue.isEmpty()) {
MaterialTheme.appColors.primaryButtonBackground.copy(alpha = 0.3f)
} else {
MaterialTheme.appColors.primaryButtonBackground
}
val sendButtonAlpha = if (responseValue.isEmpty()) 0.3f else 1f

Scaffold(
scaffoldState = scaffoldState,
Expand Down Expand Up @@ -398,7 +394,8 @@ private fun DiscussionCommentsScreen(
modifier = Modifier
.size(48.dp)
.clip(CircleShape)
.background(sendButtonColor)
.alpha(sendButtonAlpha)
.background(MaterialTheme.appColors.primaryButtonBackground)
.clickable {
keyboardController?.hide()
focusManager.clearFocus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.HelpOutline
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.ThumbUp
import androidx.compose.material.icons.outlined.ThumbUp
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
Expand Down Expand Up @@ -77,10 +79,10 @@ fun ThreadMainItem(
CoreR.drawable.core_ic_default_profile_picture
}

val votePainter = if (thread.voted) {
painterResource(id = R.drawable.discussion_ic_like_success)
val voteIcon = if (thread.voted) {
Icons.Filled.ThumbUp
} else {
painterResource(id = R.drawable.discussion_ic_like)
Icons.Outlined.ThumbUp
}
val reportText = if (thread.abuseFlagged) {
stringResource(id = R.string.discussion_unreport)
Expand Down Expand Up @@ -168,7 +170,7 @@ fun ThreadMainItem(
thread.voteCount,
thread.voteCount
),
painter = votePainter,
icon = voteIcon,
color = MaterialTheme.appColors.textPrimary,
textStyle = MaterialTheme.appTypography.labelLarge,
onClick = {
Expand Down Expand Up @@ -219,10 +221,10 @@ fun CommentItem(
} else {
MaterialTheme.appColors.textPrimary
}
val votePainter = if (comment.voted) {
painterResource(id = R.drawable.discussion_ic_like_success)
val voteIcon = if (comment.voted) {
Icons.Filled.ThumbUp
} else {
painterResource(id = R.drawable.discussion_ic_like)
Icons.Outlined.ThumbUp
}

val context = LocalContext.current
Expand Down Expand Up @@ -317,7 +319,7 @@ fun CommentItem(
comment.voteCount,
comment.voteCount
),
painter = votePainter,
icon = voteIcon,
color = MaterialTheme.appColors.textPrimary,
textStyle = MaterialTheme.appTypography.labelLarge,
onClick = {
Expand Down Expand Up @@ -375,10 +377,10 @@ fun CommentMainItem(
MaterialTheme.appColors.textPrimary
}

val votePainter = if (comment.voted) {
painterResource(id = R.drawable.discussion_ic_like_success)
val voteIcon = if (comment.voted) {
Icons.Filled.ThumbUp
} else {
painterResource(id = R.drawable.discussion_ic_like)
Icons.Outlined.ThumbUp
}

val context = LocalContext.current
Expand Down Expand Up @@ -452,7 +454,7 @@ fun CommentMainItem(
comment.voteCount,
comment.voteCount
),
painter = votePainter,
icon = voteIcon,
color = MaterialTheme.appColors.textPrimary,
textStyle = MaterialTheme.appTypography.labelLarge,
onClick = {
Expand Down
13 changes: 0 additions & 13 deletions discussion/src/main/res/drawable/discussion_ic_like.xml

This file was deleted.

17 changes: 0 additions & 17 deletions discussion/src/main/res/drawable/discussion_ic_like_success.xml

This file was deleted.

0 comments on commit a4376c4

Please sign in to comment.