GroupWelcomeView: wrap message editor/preview and buttons in SectionView cards

This commit is contained in:
another-simple-pixel
2026-05-16 13:04:02 -07:00
parent 9114a36848
commit edb3495a8f
@@ -23,6 +23,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import chat.simplex.common.model.*
import chat.simplex.common.ui.theme.DEFAULT_PADDING
import chat.simplex.common.ui.theme.DEFAULT_PADDING_HALF
import chat.simplex.common.views.chat.item.MarkdownText
import chat.simplex.common.views.helpers.*
import chat.simplex.common.model.ChatModel
@@ -95,19 +96,21 @@ private fun GroupWelcomeLayout(
AppBarTitle(stringResource(MR.strings.group_welcome_title))
val wt = rememberSaveable { welcomeText }
if (groupInfo.isOwner && groupInfo.businessChat?.chatType == null) {
if (editMode.value) {
val focusRequester = remember { FocusRequester() }
TextEditor(
wt,
Modifier.height(140.dp), stringResource(MR.strings.enter_welcome_message),
focusRequester = focusRequester
)
LaunchedEffect(Unit) {
delay(300)
focusRequester.requestFocus()
SectionView(contentPadding = PaddingValues(vertical = DEFAULT_PADDING_HALF)) {
if (editMode.value) {
val focusRequester = remember { FocusRequester() }
TextEditor(
wt,
Modifier.height(140.dp), stringResource(MR.strings.enter_welcome_message),
focusRequester = focusRequester
)
LaunchedEffect(Unit) {
delay(300)
focusRequester.requestFocus()
}
} else {
TextPreview(wt.value, linkMode)
}
} else {
TextPreview(wt.value, linkMode)
}
SectionTextFooter(
if (!welcomeTextFitsLimit(wt)) { generalGetString(MR.strings.message_too_large) } else "",
@@ -116,15 +119,17 @@ private fun GroupWelcomeLayout(
Spacer(Modifier.size(8.dp))
ChangeModeButton(
editMode.value,
click = {
editMode.value = !editMode.value
},
wt.value.isEmpty()
)
val clipboard = LocalClipboardManager.current
CopyTextButton { clipboard.setText(AnnotatedString(wt.value)) }
SectionView {
ChangeModeButton(
editMode.value,
click = {
editMode.value = !editMode.value
},
wt.value.isEmpty()
)
val clipboard = LocalClipboardManager.current
CopyTextButton { clipboard.setText(AnnotatedString(wt.value)) }
}
SectionDividerSpaced(maxBottomPadding = false)
@@ -134,8 +139,12 @@ private fun GroupWelcomeLayout(
)
} else {
val clipboard = LocalClipboardManager.current
TextPreview(wt.value, linkMode)
CopyTextButton { clipboard.setText(AnnotatedString(wt.value)) }
SectionView(contentPadding = PaddingValues(vertical = DEFAULT_PADDING_HALF)) {
TextPreview(wt.value, linkMode)
}
SectionView {
CopyTextButton { clipboard.setText(AnnotatedString(wt.value)) }
}
}
SectionBottomSpacer()
}