-
Notifications
You must be signed in to change notification settings - Fork 3
/
PollEnded.kt
81 lines (78 loc) · 3.36 KB
/
PollEnded.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package social.firefly.core.ui.notifications.cards
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import social.firefly.common.utils.StringFactory
import social.firefly.core.ui.common.utils.PreviewTheme
import social.firefly.core.ui.notifications.NotificationCard
import social.firefly.core.ui.notifications.NotificationInteractionsNoOp
import social.firefly.core.ui.notifications.NotificationUiState
import social.firefly.core.ui.poll.PollOptionUiState
import social.firefly.core.ui.poll.PollUiState
import social.firefly.core.ui.postcard.PostCardInteractions
import social.firefly.core.ui.postcard.PostCardInteractionsNoOp
import social.firefly.core.ui.postcard.PostContentUiState
import social.firefly.core.ui.postcard.components.PostContent
@Composable
internal fun PollEndedNotificationContent(
uiState: NotificationUiState.PollEnded,
postCardInteractions: PostCardInteractions,
) {
PostContent(
uiState = uiState.postContentUiState,
postCardInteractions = postCardInteractions,
)
}
@Preview
@Composable
private fun PollEndedNotificationPreview() {
PreviewTheme {
NotificationCard(
uiState = NotificationUiState.PollEnded(
id = 1,
timeStamp = StringFactory.literal("1 day ago"),
title = StringFactory.literal("A poll ended:"),
avatarUrl = "",
postContentUiState = PostContentUiState(
pollUiState = PollUiState(
pollOptions =
listOf(
PollOptionUiState(
fillFraction = 0.5f,
title = "option 1",
voteInfo = StringFactory.literal("50%"),
),
PollOptionUiState(
fillFraction = 0.25f,
title = "option 2 jfkdlsa jfdlsa jfd sjaf io jfkdlsj afod aj fid jifd",
voteInfo = StringFactory.literal("25%"),
),
PollOptionUiState(
fillFraction = 0.25f,
title = "option 3 with a really really long title that extends just too far",
voteInfo = StringFactory.literal("25%"),
),
),
pollInfoText = StringFactory.literal("3 votes - 5 hours left"),
isUserCreatedPoll = false,
showResults = true,
pollId = "",
isMultipleChoice = true,
usersVotes = listOf(0, 1, 2),
isExpired = false,
canVote = true,
),
statusTextHtml = "this is a status",
mediaAttachments = emptyList(),
mentions = emptyList(),
previewCard = null,
contentWarning = "",
),
accountId = "",
statusId = "",
accountName = "",
),
postCardInteractions = PostCardInteractionsNoOp,
notificationInteractions = NotificationInteractionsNoOp,
)
}
}