Skip to content

Commit

Permalink
chore: Optimize TransferInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
tevincent committed Nov 26, 2024
1 parent 3ce7ee0 commit d9011fa
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ fun TransferInfo(getTransfer: () -> TransferUi) {

val filesCount by remember { derivedStateOf { getTransfer().files.count() } }
val downloadedCount by remember { derivedStateOf { getTransfer().downloadLimit - getTransfer().downloadLeft } }
val expiresInDays by remember { derivedStateOf { getTransfer().expiresInDays } }
val downloadLimit by remember { derivedStateOf { getTransfer().downloadLimit } }
val sizeUploaded by remember { derivedStateOf { getTransfer().sizeUploaded } }

Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
Expand All @@ -62,7 +65,7 @@ fun TransferInfo(getTransfer: () -> TransferUi) {
Spacer(Modifier.width(Margin.Mini))
TextDotText(
firstText = { pluralStringResource(R.plurals.filesCount, filesCount, filesCount) },
secondText = { Formatter.formatShortFileSize(LocalContext.current, getTransfer().sizeUploaded) },
secondText = { Formatter.formatShortFileSize(LocalContext.current, sizeUploaded) },
color = SwissTransferTheme.colors.primaryTextColor,
)
}
Expand All @@ -71,14 +74,14 @@ fun TransferInfo(getTransfer: () -> TransferUi) {

IconText(
icon = AppIcons.Clock,
text = stringResource(R.string.expiresIn, getTransfer().expiresInDays),
text = stringResource(R.string.expiresIn, expiresInDays),
)

HorizontalDivider(modifier = Modifier.padding(vertical = Margin.Medium))

IconText(
icon = AppIcons.ArrowDownFile,
text = stringResource(R.string.downloadedTransferLabel, downloadedCount, getTransfer().downloadLimit),
text = stringResource(R.string.downloadedTransferLabel, downloadedCount, downloadLimit),
)
}

Expand Down

0 comments on commit d9011fa

Please sign in to comment.