Dont create labels in the library mode

This commit is contained in:
Jackson Harper
2023-05-12 17:00:16 +08:00
parent 6c2059807f
commit 42d9c5fea8

View File

@ -227,7 +227,6 @@ fun LabelsSelectionSheetContent(
onSave: (List<SavedItemLabel>) -> Unit,
onCreateLabel: (String, String) -> Unit
) {
val keyboardController = LocalSoftwareKeyboardController.current
val interactionSource = remember { MutableInteractionSource() }
val state = rememberChipTextFieldState(initialSelectedLabels.map {
@ -299,7 +298,15 @@ fun LabelsSelectionSheetContent(
state = state,
value = filterTextValue,
onValueChange = onFilterTextValueChange,
onSubmit = { LabelChipView(findOrCreateLabel(it)) },
onSubmit = {
if (isLibraryMode) {
currentLabel?.let {
LabelChipView(it)
} ?: null
} else {
LabelChipView(findOrCreateLabel(it))
}
},
chipLeadingIcon = { chip -> CircleIcon(colorHex = chip.label.color) },
chipTrailingIcon = { chip -> CloseButton(state, chip) },
interactionSource = interactionSource,