Skip to content

Commit

Permalink
Merge pull request #273 from PermanentOrg/feature/VSP-1391
Browse files Browse the repository at this point in the history
Fixed demo comments for create your first archive screen's button.
  • Loading branch information
flaviahandrea-vsp authored Apr 15, 2024
2 parents a237e02 + e04fca4 commit 0e1e69c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import org.permanent.permanent.ui.composeComponents.MenuItem
@Composable
fun ArchiveTypeDropdown(
isTablet: Boolean = false,
onListItemClick: (archiveType: ArchiveType) -> Unit
onListItemClick: (archive: UIArchive) -> Unit
) {
val context = LocalContext.current
val whiteColor = Color(ContextCompat.getColor(context, R.color.white))
Expand Down Expand Up @@ -218,7 +218,7 @@ fun ArchiveTypeDropdown(
subtitle = stringResource(item.description)
) {
currentArchiveType = item
onListItemClick(item.type)
onListItemClick(item)
scope
.launch { sheetState.hide() }
.invokeOnCompletion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.pager.PagerState
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand Down Expand Up @@ -65,6 +69,9 @@ private fun TabletBody(
pagerState: PagerState,
onArchiveTypeClick: (archiveType: ArchiveType) -> Unit
) {
val context = LocalContext.current
var archiveTypeName by remember { mutableStateOf(context.getString(R.string.personal)) }

Row(
modifier = Modifier
.fillMaxWidth()
Expand Down Expand Up @@ -112,7 +119,10 @@ private fun TabletBody(

Spacer(modifier = Modifier.height(32.dp))

ArchiveTypeDropdown(isTablet = true, onListItemClick = onArchiveTypeClick)
ArchiveTypeDropdown(isTablet = true, onListItemClick = {
onArchiveTypeClick(it.type)
archiveTypeName = context.getString(it.title)
})

Spacer(modifier = Modifier.weight(1.0f))

Expand All @@ -135,15 +145,19 @@ private fun TabletBody(
}
}

val boldedWord = "Personal"
val partialBoldedText =
stringResource(id = R.string.lets_create_archive, boldedWord)
val start = partialBoldedText.indexOf(boldedWord)
if (archiveTypeName == context.getString(R.string.individual) ||
archiveTypeName == context.getString(R.string.organization)
) stringResource(
id = R.string.lets_create_an_archive, archiveTypeName
) else stringResource(id = R.string.lets_create_a_archive, archiveTypeName)

val start = partialBoldedText.indexOf(archiveTypeName)
val spanStyles = listOf(
AnnotatedString.Range(
SpanStyle(fontWeight = FontWeight.ExtraBold),
start = start,
end = start + boldedWord.length
end = start + archiveTypeName.length
)
)

Expand Down Expand Up @@ -204,7 +218,7 @@ private fun PhoneBody(
fontFamily = regularFont
)

ArchiveTypeDropdown(onListItemClick = onArchiveTypeClick)
ArchiveTypeDropdown(onListItemClick = { onArchiveTypeClick(it.type) })

Spacer(modifier = Modifier.weight(1f))

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@
<string name="community_description">Create an archive that captures a community’s life.</string>
<string name="organization">Organization</string>
<string name="organization_description">Create an archive that captures an organization’s life.</string>
<string name="lets_create_archive">Let’s create a %s archive</string>
<string name="lets_create_a_archive">Let’s create a %s archive</string>
<string name="lets_create_an_archive">Let’s create an %s archive</string>

<string name="leave_share">Leave share</string>

Expand Down

0 comments on commit 0e1e69c

Please sign in to comment.