Skip to content

Commit

Permalink
feat: Use a FlowRow to display a list of emails instead of a single o…
Browse files Browse the repository at this point in the history
…ne in UploadSuccessEmail screen
  • Loading branch information
KevinBoulongne committed Oct 23, 2024
1 parent fec6e07 commit 83bbff1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ import androidx.compose.material3.SuggestionChipDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.infomaniak.swisstransfer.ui.theme.CustomShapes
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme

@Composable
fun EmailAddressChip(text: String) {
fun EmailAddressChip(
text: String,
modifier: Modifier = Modifier,
) {
SuggestionChip(
onClick = { },
label = {
Expand All @@ -37,6 +41,7 @@ fun EmailAddressChip(text: String) {
style = SwissTransferTheme.typography.bodyRegular,
)
},
modifier = modifier,
enabled = false,
shape = CustomShapes.ROUNDED,
colors = SuggestionChipDefaults.suggestionChipColors(
Expand All @@ -53,7 +58,7 @@ fun EmailAddressChip(text: String) {
private fun EmailAddressChipPreview() {
SwissTransferTheme {
Surface {
EmailAddressChip("[email protected]")
EmailAddressChip(text = "[email protected]")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,26 @@ import com.infomaniak.swisstransfer.ui.theme.Margin
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows

// TODO: Use correct emails instead of hard-coded values
@Composable
fun UploadSuccessEmailScreen(email: String) {
fun UploadSuccessEmailScreen(
emails: List<String> = listOf(
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"email@[123.123.123.123]",
"\"email\"@example.com",
"[email protected]",
"[email protected]",
"_______@example.com",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
),
) {
BottomStickyButtonScaffold(
topBar = { BrandTopAppBar() },
bottomButton = {
Expand All @@ -43,12 +61,13 @@ fun UploadSuccessEmailScreen(email: String) {
onClick = { /* TODO */ },
)
},
content = { Content(email) },
content = { Content(emails) },
)
}

@OptIn(ExperimentalLayoutApi::class)
@Composable
private fun Content(email: String) {
private fun Content(emails: List<String>) {
Column(
modifier = Modifier
.fillMaxSize()
Expand All @@ -64,9 +83,17 @@ private fun Content(email: String) {
modifier = Modifier.padding(horizontal = Margin.Medium),
)

Spacer(Modifier.height(Margin.Small))

EmailAddressChip(text = email)
FlowRow(
modifier = Modifier.padding(Margin.Medium),
horizontalArrangement = Arrangement.Center,
) {
emails.forEach {
EmailAddressChip(
text = it,
modifier = Modifier.padding(horizontal = Margin.XSmall)
)
}
}
}
}

Expand All @@ -75,7 +102,7 @@ private fun Content(email: String) {
private fun UploadSuccessEmailScreenPreview() {
SwissTransferTheme {
Surface {
UploadSuccessEmailScreen("[email protected]")
UploadSuccessEmailScreen()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows
@Composable
fun UploadSuccessScreen(transferType: TransferType) {
if (transferType == TransferType.MAIL) {
UploadSuccessEmailScreen(email = "[email protected]") // TODO: Use correct email instead of hard-coded value
UploadSuccessEmailScreen()
} else {
UploadSuccessQrScreen(transferType)
}
Expand Down

0 comments on commit 83bbff1

Please sign in to comment.