mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-29 22:52:39 +02:00
Merge branch 'main' of https://github.com/vitorpamplona/amethyst
This commit is contained in:
@@ -136,7 +136,9 @@ fun DrawerContent(
|
|||||||
drawerTonalElevation = 0.dp,
|
drawerTonalElevation = 0.dp,
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
Modifier.fillMaxHeight().verticalScroll(rememberScrollState()),
|
Modifier
|
||||||
|
.fillMaxHeight()
|
||||||
|
.verticalScroll(rememberScrollState()),
|
||||||
) {
|
) {
|
||||||
ProfileContent(
|
ProfileContent(
|
||||||
baseAccountUser = accountViewModel.account.userProfile(),
|
baseAccountUser = accountViewModel.account.userProfile(),
|
||||||
@@ -146,7 +148,7 @@ fun DrawerContent(
|
|||||||
)
|
)
|
||||||
|
|
||||||
Column(drawerSpacing) {
|
Column(drawerSpacing) {
|
||||||
EditStatusBoxes(accountViewModel.account.userProfile(), accountViewModel)
|
EditStatusBoxes(accountViewModel.account.userProfile(), accountViewModel, drawerState)
|
||||||
}
|
}
|
||||||
|
|
||||||
FollowingAndFollowerCounts(accountViewModel.account.userProfile(), onClickUser)
|
FollowingAndFollowerCounts(accountViewModel.account.userProfile(), onClickUser)
|
||||||
@@ -263,15 +265,16 @@ fun ProfileContentTemplate(
|
|||||||
private fun EditStatusBoxes(
|
private fun EditStatusBoxes(
|
||||||
baseAccountUser: User,
|
baseAccountUser: User,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
drawerState: DrawerState,
|
||||||
) {
|
) {
|
||||||
LoadStatuses(user = baseAccountUser, accountViewModel) { statuses ->
|
LoadStatuses(user = baseAccountUser, accountViewModel) { statuses ->
|
||||||
if (statuses.isEmpty()) {
|
if (statuses.isEmpty()) {
|
||||||
StatusEditBar(accountViewModel = accountViewModel)
|
StatusEditBar(accountViewModel = accountViewModel, drawerState = drawerState)
|
||||||
} else {
|
} else {
|
||||||
statuses.forEach {
|
statuses.forEach {
|
||||||
val originalStatus by it.live().content.observeAsState()
|
val originalStatus by it.live().content.observeAsState()
|
||||||
|
|
||||||
StatusEditBar(originalStatus, it.address, accountViewModel)
|
StatusEditBar(originalStatus, it.address, accountViewModel, drawerState = drawerState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,11 +285,17 @@ fun StatusEditBar(
|
|||||||
savedStatus: String? = null,
|
savedStatus: String? = null,
|
||||||
tag: ATag? = null,
|
tag: ATag? = null,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
drawerState: DrawerState,
|
||||||
) {
|
) {
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
|
|
||||||
val currentStatus = remember { mutableStateOf(savedStatus ?: "") }
|
val currentStatus = remember { mutableStateOf(savedStatus ?: "") }
|
||||||
val hasChanged = remember { derivedStateOf { currentStatus.value != (savedStatus ?: "") } }
|
val hasChanged = remember { derivedStateOf { currentStatus.value != (savedStatus ?: "") } }
|
||||||
|
LaunchedEffect(drawerState.isClosed) {
|
||||||
|
if (drawerState.isClosed) {
|
||||||
|
focusManager.clearFocus(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = currentStatus.value,
|
value = currentStatus.value,
|
||||||
|
Reference in New Issue
Block a user