From 4c0e85fdbf27b68737e4aa6e56829cc69f4b9851 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sun, 26 Jul 2026 18:49:40 +0200 Subject: [PATCH] fix(imports): offer the manager when there is nothing to import into (#76) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every writable calendar being switched off, read-only or filled from contacts is exactly what empties the import picker — and that is the case the new "Missing a calendar?" footer exists for. The empty state returns before the picker is laid out, though, so it was the one screen that named no way out: the event form offered the manager, the import dead-ended. Carry the same route into the message. Co-Authored-By: Claude Opus 5 (1M context) --- .../calendula/ui/imports/ImportScreen.kt | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt index 32e60e8..253b02e 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/imports/ImportScreen.kt @@ -175,9 +175,18 @@ private fun ManyContent( onSelect: (Long) -> Unit, onManageCalendars: (() -> Unit)? = null, ) { - // No writable calendar to import into — tell the user honestly. + // No calendar to import into — tell the user honestly, and carry the same + // way out the picker's footer offers below. This is the state that footer + // exists for: every writable calendar being switched off, read-only or + // contact-filled is exactly what empties this list (#76). if (state.calendars.isEmpty()) { - CenteredMessage(stringResource(R.string.import_no_calendar), onClose = null) + CenteredMessage( + message = stringResource(R.string.import_no_calendar), + onClose = null, + actionLabel = stringResource(R.string.settings_manage_calendars) + .takeIf { onManageCalendars != null }, + onAction = onManageCalendars, + ) return } @@ -345,7 +354,12 @@ private fun WarningText(warning: IcsParseWarning) { } @Composable -private fun CenteredMessage(message: String, onClose: (() -> Unit)?) { +private fun CenteredMessage( + message: String, + onClose: (() -> Unit)?, + actionLabel: String? = null, + onAction: (() -> Unit)? = null, +) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Column( Modifier.padding(24.dp), @@ -356,6 +370,9 @@ private fun CenteredMessage(message: String, onClose: (() -> Unit)?) { if (onClose != null) { Button(onClick = onClose) { Text(stringResource(R.string.import_close)) } } + if (actionLabel != null && onAction != null) { + Button(onClick = onAction) { Text(actionLabel) } + } } } }