Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication: Improve auto completion for tagging users and channels #76

Merged
merged 7 commits into from
Nov 15, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ internal open class ConversationViewModel(
val exerciseAutoCompleteItems =
course
.exercises
.filter { query in it.title.orEmpty() }
.filter { it.title.orEmpty().contains(query, ignoreCase = true) }
.mapNotNull { exercise ->
val exerciseTag = when (exercise) {
is FileUploadExercise -> "file-upload"
Expand Down Expand Up @@ -498,7 +498,7 @@ internal open class ConversationViewModel(
conversationsDataState.bind { conversations ->
val conversationAutoCompleteItems = conversations
.filterIsInstance<ChannelChat>()
.filter { query in it.name }
.filter { it.name.contains(query, ignoreCase = true) }
.map { channel ->
AutoCompleteHint(
hint = channel.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.compose.ui.window.PopupProperties
import de.tum.informatics.www1.artemis.native_app.feature.metis.conversation.R

private val HintHorizontalPadding = 16.dp
private val PopupTopPadding = 8.dp

@Composable
internal fun ReplyAutoCompletePopup(
Expand All @@ -46,7 +47,8 @@ internal fun ReplyAutoCompletePopup(
) {
ReplyAutoCompletePopupBody(
modifier = Modifier
.heightIn(max = maxHeight)
.padding(top = PopupTopPadding)
.heightIn(max = maxHeight - PopupTopPadding)
.width(targetWidth),
autoCompleteCategories = autoCompleteCategories,
performAutoComplete = performAutoComplete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private fun CreateReplyUi(
.onSizeChanged { textFieldWidth = it.width }
.padding(vertical = 8.dp, horizontal = 8.dp)
.onGloballyPositioned { coordinates ->
val textFieldWindowTopLeft = coordinates.localToWindow(Offset.Zero)
val textFieldWindowTopLeft = coordinates.localToRoot(Offset.Zero)
popupMaxHeight = textFieldWindowTopLeft.y.toInt()
}
.testTag(TEST_TAG_REPLY_TEXT_FIELD),
Expand Down
Loading