Define a constants instead of duplicating String literals
This commit is contained in:
+9
-7
@@ -117,6 +117,8 @@ fun RenderContentAsMarkdown(
|
||||
}
|
||||
}
|
||||
|
||||
private const val PREVIEW_CALLBACK_URI = "nostr:something"
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun RenderContentAsMarkdownPreview() {
|
||||
@@ -162,7 +164,7 @@ fun RenderContentAsMarkdownPreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
@@ -212,7 +214,7 @@ fun RenderContentAsMarkdownListsPreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
@@ -266,7 +268,7 @@ fun RenderContentAsMarkdownCodePreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
@@ -306,7 +308,7 @@ fun RenderContentAsMarkdownTablesPreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
@@ -344,7 +346,7 @@ fun RenderContentAsMarkdownFootNotesPreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
@@ -405,7 +407,7 @@ fun RenderContentAsMarkdownUserPreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
@@ -455,7 +457,7 @@ fun RenderContentAsMarkdownNotePreview() {
|
||||
remember {
|
||||
mutableStateOf(background)
|
||||
},
|
||||
callbackUri = "nostr:something",
|
||||
callbackUri = PREVIEW_CALLBACK_URI,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav,
|
||||
)
|
||||
|
||||
@@ -51,6 +51,9 @@ import com.vitorpamplona.amethyst.ui.theme.Size55Modifier
|
||||
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
|
||||
import com.vitorpamplona.quartz.utils.TimeUtils
|
||||
|
||||
private const val PREVIEW_AUTHOR = "This is my author"
|
||||
private const val PREVIEW_MESSAGE = "This is a message from this person"
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun ChannelNamePreview() {
|
||||
@@ -65,11 +68,11 @@ fun ChannelNamePreview() {
|
||||
)
|
||||
},
|
||||
firstRow = {
|
||||
Text("This is my author", Modifier.weight(1f))
|
||||
Text(PREVIEW_AUTHOR, Modifier.weight(1f))
|
||||
TimeAgo(TimeUtils.now())
|
||||
},
|
||||
secondRow = {
|
||||
Text("This is a message from this person", Modifier.weight(1f))
|
||||
Text(PREVIEW_MESSAGE, Modifier.weight(1f))
|
||||
Spacer(modifier = Height4dpModifier)
|
||||
NewItemsBubble()
|
||||
},
|
||||
@@ -81,13 +84,13 @@ fun ChannelNamePreview() {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("This is my author", Modifier.weight(1f))
|
||||
Text(PREVIEW_AUTHOR, Modifier.weight(1f))
|
||||
TimeAgo(TimeUtils.now())
|
||||
}
|
||||
},
|
||||
supportingContent = {
|
||||
Row {
|
||||
Text("This is a message from this person", Modifier.weight(1f))
|
||||
Text(PREVIEW_MESSAGE, Modifier.weight(1f))
|
||||
NewItemsBubble()
|
||||
}
|
||||
},
|
||||
@@ -106,13 +109,13 @@ fun ChannelNamePreview() {
|
||||
SlimListItem(
|
||||
headlineContent = {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("This is my author", Modifier.weight(1f))
|
||||
Text(PREVIEW_AUTHOR, Modifier.weight(1f))
|
||||
TimeAgo(TimeUtils.now())
|
||||
}
|
||||
},
|
||||
supportingContent = {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text("This is a message from this person", Modifier.weight(1f))
|
||||
Text(PREVIEW_MESSAGE, Modifier.weight(1f))
|
||||
NewItemsBubble()
|
||||
}
|
||||
},
|
||||
|
||||
+9
-6
@@ -80,6 +80,9 @@ import kotlin.math.max
|
||||
* This is a copy of Material3's ListItemLayout.kt file, with the only change being the padding change from 16.dp to 10.dp
|
||||
*/
|
||||
|
||||
private const val PREVIEW_AUTHOR = "This is my author"
|
||||
private const val PREVIEW_MESSAGE = "This is a message from this person"
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun ChannelNamePreview() {
|
||||
@@ -94,11 +97,11 @@ fun ChannelNamePreview() {
|
||||
)
|
||||
},
|
||||
firstRow = {
|
||||
Text("This is my author", Modifier.weight(1f))
|
||||
Text(PREVIEW_AUTHOR, Modifier.weight(1f))
|
||||
TimeAgo(TimeUtils.now())
|
||||
},
|
||||
secondRow = {
|
||||
Text("This is a message from this person", Modifier.weight(1f))
|
||||
Text(PREVIEW_MESSAGE, Modifier.weight(1f))
|
||||
NewItemsBubble()
|
||||
},
|
||||
onClick = {},
|
||||
@@ -109,13 +112,13 @@ fun ChannelNamePreview() {
|
||||
SlimListItem(
|
||||
headlineContent = {
|
||||
Row(verticalAlignment = CenterVertically) {
|
||||
Text("This is my author", Modifier.weight(1f))
|
||||
Text(PREVIEW_AUTHOR, Modifier.weight(1f))
|
||||
TimeAgo(TimeUtils.now())
|
||||
}
|
||||
},
|
||||
supportingContent = {
|
||||
Row(verticalAlignment = CenterVertically) {
|
||||
Text("This is a message from this person", Modifier.weight(1f))
|
||||
Text(PREVIEW_MESSAGE, Modifier.weight(1f))
|
||||
Spacer(modifier = Height4dpModifier)
|
||||
NewItemsBubble()
|
||||
}
|
||||
@@ -135,13 +138,13 @@ fun ChannelNamePreview() {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Row(verticalAlignment = CenterVertically) {
|
||||
Text("This is my author", Modifier.weight(1f))
|
||||
Text(PREVIEW_AUTHOR, Modifier.weight(1f))
|
||||
TimeAgo(TimeUtils.now())
|
||||
}
|
||||
},
|
||||
supportingContent = {
|
||||
Row(verticalAlignment = CenterVertically) {
|
||||
Text("This is a message from this person", Modifier.weight(1f))
|
||||
Text(PREVIEW_MESSAGE, Modifier.weight(1f))
|
||||
Spacer(modifier = Height4dpModifier)
|
||||
NewItemsBubble()
|
||||
}
|
||||
|
||||
@@ -1542,33 +1542,38 @@ fun ReactionChoicePopupContent(
|
||||
}
|
||||
}
|
||||
|
||||
private const val EMOJI_ROCKET = "\uD83D\uDE80"
|
||||
private const val EMOJI_THINKING = "\uD83E\uDD14"
|
||||
private const val EMOJI_SCREAM = "\uD83D\uDE31"
|
||||
private const val EMOJI_PARTY = "\uD83C\uDF89"
|
||||
|
||||
@Preview()
|
||||
@Composable
|
||||
fun ReactionChoicePopupPeeview() {
|
||||
ThemeComparisonColumn {
|
||||
ReactionChoicePopupContent(
|
||||
persistentListOf(
|
||||
"\uD83D\uDE80",
|
||||
EMOJI_ROCKET,
|
||||
"\uD83E\uDEC2",
|
||||
"\uD83D\uDC40",
|
||||
"\uD83D\uDE02",
|
||||
"\uD83C\uDF89",
|
||||
"\uD83E\uDD14",
|
||||
"\uD83D\uDE31",
|
||||
"\uD83E\uDD14",
|
||||
"\uD83D\uDE31",
|
||||
EMOJI_PARTY,
|
||||
EMOJI_THINKING,
|
||||
EMOJI_SCREAM,
|
||||
EMOJI_THINKING,
|
||||
EMOJI_SCREAM,
|
||||
"+",
|
||||
"-",
|
||||
"\uD83C\uDF89",
|
||||
"\uD83E\uDD14",
|
||||
"\uD83D\uDE31",
|
||||
"\uD83E\uDD14",
|
||||
"\uD83D\uDE31",
|
||||
EMOJI_PARTY,
|
||||
EMOJI_THINKING,
|
||||
EMOJI_SCREAM,
|
||||
EMOJI_THINKING,
|
||||
EMOJI_SCREAM,
|
||||
"\uD83D\uDE80\uDB40\uDD58\uDB40\uDD64\uDB40\uDD64\uDB40\uDD60\uDB40\uDD63\uDB40\uDD2A\uDB40\uDD1F\uDB40\uDD1F\uDB40\uDD53\uDB40\uDD54\uDB40\uDD5E\uDB40\uDD1E\uDB40\uDD63\uDB40\uDD51\uDB40\uDD64\uDB40\uDD55\uDB40\uDD5C\uDB40\uDD5C\uDB40\uDD59\uDB40\uDD64\uDB40\uDD55\uDB40\uDD1E\uDB40\uDD55\uDB40\uDD51\uDB40\uDD62\uDB40\uDD64\uDB40\uDD58\uDB40\uDD1F\uDB40\uDD29\uDB40\uDD24\uDB40\uDD27\uDB40\uDD55\uDB40\uDD24\uDB40\uDD51\uDB40\uDD52\uDB40\uDD22\uDB40\uDD54\uDB40\uDD23\uDB40\uDD21\uDB40\uDD21\uDB40\uDD25\uDB40\uDD52\uDB40\uDD55\uDB40\uDD25\uDB40\uDD26\uDB40\uDD25\uDB40\uDD51\uDB40\uDD24\uDB40\uDD29\uDB40\uDD53\uDB40\uDD56\uDB40\uDD25\uDB40\uDD54\uDB40\uDD52\uDB40\uDD20\uDB40\uDD22\uDB40\uDD25\uDB40\uDD25\uDB40\uDD29\uDB40\uDD56\uDB40\uDD23\uDB40\uDD21\uDB40\uDD20\uDB40\uDD53\uDB40\uDD51\uDB40\uDD20\uDB40\uDD51\uDB40\uDD26\uDB40\uDD54\uDB40\uDD54\uDB40\uDD56\uDB40\uDD54\uDB40\uDD54\uDB40\uDD52\uDB40\uDD54\uDB40\uDD24\uDB40\uDD52\uDB40\uDD54\uDB40\uDD28\uDB40\uDD53\uDB40\uDD52\uDB40\uDD55\uDB40\uDD53\uDB40\uDD24\uDB40\uDD24\uDB40\uDD29\uDB40\uDD29\uDB40\uDD25\uDB40\uDD53\uDB40\uDD22\uDB40\uDD55\uDB40\uDD27\uDB40\uDD1E\uDB40\uDD67\uDB40\uDD55\uDB40\uDD52\uDB40\uDD60",
|
||||
),
|
||||
onClick = {},
|
||||
onChangeAmount = {},
|
||||
toRemove = persistentSetOf("\uD83D\uDE80", "\uD83E\uDD14", "\uD83D\uDE31"),
|
||||
toRemove = persistentSetOf(EMOJI_ROCKET, EMOJI_THINKING, EMOJI_SCREAM),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,6 +433,10 @@ fun ObserveAndDrawInnerUserPicture(
|
||||
)
|
||||
}
|
||||
|
||||
private const val PREVIEW_USER_HEX = "989c3734c46abac7ce3ce229971581a5a6ee39cdd6aa7261a55823fa7f8c4799"
|
||||
private const val PREVIEW_PICTURE_URL = "http://null"
|
||||
private const val PREVIEW_USER_NAME = "vitor"
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun ScoreTag55Preview() {
|
||||
@@ -442,9 +446,9 @@ fun ScoreTag55Preview() {
|
||||
var size = 75.dp
|
||||
Box(Modifier.size(size), contentAlignment = Alignment.TopEnd) {
|
||||
InnerUserPicture(
|
||||
userHex = "989c3734c46abac7ce3ce229971581a5a6ee39cdd6aa7261a55823fa7f8c4799",
|
||||
userPicture = "http://null",
|
||||
userName = "vitor",
|
||||
userHex = PREVIEW_USER_HEX,
|
||||
userPicture = PREVIEW_PICTURE_URL,
|
||||
userName = PREVIEW_USER_NAME,
|
||||
size = size,
|
||||
modifier = Modifier,
|
||||
accountViewModel = accountViewModel,
|
||||
@@ -455,9 +459,9 @@ fun ScoreTag55Preview() {
|
||||
size = 55.dp
|
||||
Box(Modifier.size(size), contentAlignment = Alignment.TopEnd) {
|
||||
InnerUserPicture(
|
||||
userHex = "989c3734c46abac7ce3ce229971581a5a6ee39cdd6aa7261a55823fa7f8c4799",
|
||||
userPicture = "http://null",
|
||||
userName = "vitor",
|
||||
userHex = PREVIEW_USER_HEX,
|
||||
userPicture = PREVIEW_PICTURE_URL,
|
||||
userName = PREVIEW_USER_NAME,
|
||||
size = size,
|
||||
modifier = Modifier,
|
||||
accountViewModel = accountViewModel,
|
||||
@@ -468,9 +472,9 @@ fun ScoreTag55Preview() {
|
||||
size = 35.dp
|
||||
Box(Modifier.size(size), contentAlignment = Alignment.TopEnd) {
|
||||
InnerUserPicture(
|
||||
userHex = "989c3734c46abac7ce3ce229971581a5a6ee39cdd6aa7261a55823fa7f8c4799",
|
||||
userPicture = "http://null",
|
||||
userName = "vitor",
|
||||
userHex = PREVIEW_USER_HEX,
|
||||
userPicture = PREVIEW_PICTURE_URL,
|
||||
userName = PREVIEW_USER_NAME,
|
||||
size = size,
|
||||
modifier = Modifier,
|
||||
accountViewModel = accountViewModel,
|
||||
@@ -481,9 +485,9 @@ fun ScoreTag55Preview() {
|
||||
size = 25.dp
|
||||
Box(Modifier.size(size), contentAlignment = Alignment.TopEnd) {
|
||||
InnerUserPicture(
|
||||
userHex = "989c3734c46abac7ce3ce229971581a5a6ee39cdd6aa7261a55823fa7f8c4799",
|
||||
userPicture = "http://null",
|
||||
userName = "vitor",
|
||||
userHex = PREVIEW_USER_HEX,
|
||||
userPicture = PREVIEW_PICTURE_URL,
|
||||
userName = PREVIEW_USER_NAME,
|
||||
size = size,
|
||||
modifier = Modifier,
|
||||
accountViewModel = accountViewModel,
|
||||
@@ -495,8 +499,8 @@ fun ScoreTag55Preview() {
|
||||
Box(Modifier.size(size), contentAlignment = Alignment.TopEnd) {
|
||||
InnerUserPicture(
|
||||
userHex = "AABBCC",
|
||||
userPicture = "http://null",
|
||||
userName = "vitor",
|
||||
userPicture = PREVIEW_PICTURE_URL,
|
||||
userName = PREVIEW_USER_NAME,
|
||||
size = size,
|
||||
modifier = Modifier,
|
||||
accountViewModel = accountViewModel,
|
||||
|
||||
+15
-11
@@ -71,6 +71,10 @@ import com.vitorpamplona.amethyst.ui.theme.SpacedBy2dp
|
||||
import com.vitorpamplona.amethyst.ui.theme.SpacedBy5dp
|
||||
import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
|
||||
|
||||
private const val PREVIEW_LIST_TITLE = "Sample List Title"
|
||||
private const val PREVIEW_LIST_DESCRIPTION = "Sample List Description"
|
||||
private const val PREVIEW_LIST_IMAGE = "http://some.com/image.png"
|
||||
|
||||
@Preview()
|
||||
@Composable
|
||||
private fun PeopleListItemPreview() {
|
||||
@@ -82,8 +86,8 @@ private fun PeopleListItemPreview() {
|
||||
PeopleList(
|
||||
identifierTag = "00001-2222",
|
||||
title = "Sample List Title, Very long title, very very very long",
|
||||
description = "Sample List Description",
|
||||
image = "http://some.com/image.png",
|
||||
description = PREVIEW_LIST_DESCRIPTION,
|
||||
image = PREVIEW_LIST_IMAGE,
|
||||
emptySet(),
|
||||
emptySet(),
|
||||
)
|
||||
@@ -91,9 +95,9 @@ private fun PeopleListItemPreview() {
|
||||
val samplePeopleList2 =
|
||||
PeopleList(
|
||||
identifierTag = "00001-2223",
|
||||
title = "Sample List Title",
|
||||
description = "Sample List Description",
|
||||
image = "http://some.com/image.png",
|
||||
title = PREVIEW_LIST_TITLE,
|
||||
description = PREVIEW_LIST_DESCRIPTION,
|
||||
image = PREVIEW_LIST_IMAGE,
|
||||
setOf(user1, user3),
|
||||
emptySet(),
|
||||
)
|
||||
@@ -101,9 +105,9 @@ private fun PeopleListItemPreview() {
|
||||
val samplePeopleList3 =
|
||||
PeopleList(
|
||||
identifierTag = "00001-2224",
|
||||
title = "Sample List Title",
|
||||
description = "Sample List Description",
|
||||
image = "http://some.com/image.png",
|
||||
title = PREVIEW_LIST_TITLE,
|
||||
description = PREVIEW_LIST_DESCRIPTION,
|
||||
image = PREVIEW_LIST_IMAGE,
|
||||
emptySet(),
|
||||
setOf(user1, user3),
|
||||
)
|
||||
@@ -111,9 +115,9 @@ private fun PeopleListItemPreview() {
|
||||
val samplePeopleList4 =
|
||||
PeopleList(
|
||||
identifierTag = "00001-2225",
|
||||
title = "Sample List Title",
|
||||
description = "Sample List Description",
|
||||
image = "http://some.com/image.png",
|
||||
title = PREVIEW_LIST_TITLE,
|
||||
description = PREVIEW_LIST_DESCRIPTION,
|
||||
image = PREVIEW_LIST_IMAGE,
|
||||
setOf(user3),
|
||||
setOf(user1, user2, user3),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user