Skip to content

Commit

Permalink
Merge pull request #25 from paug/remove-live-update
Browse files Browse the repository at this point in the history
Remove real time updates
  • Loading branch information
martinbonnin authored Mar 27, 2024
2 parents 0eaeae0 + 9b2be88 commit 12b9c5a
Show file tree
Hide file tree
Showing 25 changed files with 590 additions and 448 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ activityCompose = "1.8.2"
appcompat = "1.6.1"
kotlin_lang = "1.9.22"
kotlin_coroutines = "1.8.0"
kotlinx_datetime = "0.5.0"
kotlinx_datetime = "0.6.0-RC.2"
kotlinx_serialization = "1.6.3"
androidx_core = "1.12.0"
firebase_common = "20.4.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ private fun CommentItemsPreview() {
comments = listOf(
UIComment(
id = "",
voteItemId = "",
message = "Nice comment",
createdAt = "08 August 2023",
upVotes = 8,
dots = listOf(UIDot(x = .5f, y = .5f, color = "FF00CC")),
votedByUser = true
votedByUser = true,
fromUser = false
),
UIComment(
id = "",
voteItemId = "",
message = "Another comment",
createdAt = "08 August 2023",
upVotes = 0,
dots = listOf(UIDot(x = .5f, y = .5f, color = "FF00CC")),
votedByUser = true
votedByUser = true,
fromUser = false
)
),
commentInput = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ private fun CommentPreview() {
Comment(
comment = UIComment(
id = "",
voteItemId = "",
message = "Super talk and great speakers!",
createdAt = "08 August 2023",
upVotes = 8,
dots = listOf(UIDot(x = .5f, y = .5f, color = "FF00CC")),
votedByUser = true
votedByUser = true,
fromUser = false
),
onClick = {}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,27 @@ private fun OpenFeedbackLayoutPreview() {
MaterialTheme {
OpenFeedbackLayout(
sessionFeedback = UISessionFeedback(
commentValue = "",
commentVoteItemId = "",
comments = listOf(
UIComment(
id = "",
voteItemId = "",
message = "Nice comment",
createdAt = "08 August 2023",
upVotes = 8,
dots = listOf(UIDot(x = .5f, y = .5f, color = "FF00CC")),
votedByUser = true
votedByUser = true,
fromUser = false
),
UIComment(
id = "",
voteItemId = "",
message = "Another one",
createdAt = "08 August 2023",
upVotes = 0,
dots = listOf(UIDot(x = .5f, y = .5f, color = "FF00CC")),
votedByUser = true
votedByUser = true,
fromUser = false
)
),
voteItem = listOf(
voteItems = listOf(
UIVoteItem(
id = "",
text = "Fun",
Expand All @@ -56,14 +54,15 @@ private fun OpenFeedbackLayoutPreview() {
dots = listOf(UIDot(x = .5f, y = .5f, color = "FF00CC")),
votedByUser = true
)
)
),
colors = emptyList()
),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
commentInput = {
CommentInput(value = "", onValueChange = {}, onSubmit = {})
},
comment = { Comment(comment = it, onClick = {}) }
comment = { Comment(comment = it, onClick = {}) },
) {
VoteCard(
voteModel = it,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fun Comment(
style = subStyle
)
Text(
text = comment.createdAt,
text = comment.createdAt + (if (comment.fromUser) stringResource(MR.strings.from_you) else ""),
color = contentColor.copy(alpha = .7f),
style = subStyle
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import androidx.compose.foundation.layout.height
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -52,6 +56,8 @@ fun OpenFeedback(
is OpenFeedbackUiState.Loading -> loading()
is OpenFeedbackUiState.Success -> {
val session = (uiState.value as OpenFeedbackUiState.Success).session
var text by remember { mutableStateOf("") }

OpenFeedbackLayout(
sessionFeedback = session,
modifier = modifier,
Expand All @@ -64,9 +70,9 @@ fun OpenFeedback(
},
commentInput = {
CommentInput(
value = session.commentValue,
onValueChange = viewModel::valueChangedComment,
onSubmit = viewModel::submitComment,
value = text,
onValueChange = { text = it },
onSubmit = { viewModel.submitComment(text) },
modifier = Modifier.fillMaxWidth()
)
},
Expand Down Expand Up @@ -101,13 +107,13 @@ fun OpenFeedbackLayout(
verticalArrangement = verticalArrangement
) {
VoteItems(
voteItems = sessionFeedback.voteItem,
voteItems = sessionFeedback.voteItems,
columnCount = columnCount,
horizontalArrangement = horizontalArrangement,
verticalArrangement = verticalArrangement,
content = content
)
if (sessionFeedback.commentVoteItemId != null) {
if (sessionFeedback.comments.isNotEmpty()) {
Spacer(modifier = Modifier.height(8.dp))
CommentItems(
comments = sessionFeedback.comments,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ data class OpenFeedbackFirebaseConfig(
apiKey = "AIzaSyB3ELJsaiItrln0uDGSuuHE1CfOJO67Hb4",
databaseUrl = "https://open-feedback-42.firebaseio.com/"
)

}
}
}
Expand Down
Loading

0 comments on commit 12b9c5a

Please sign in to comment.