This commit is contained in:
1 parent
6c468e6b38
commit
7f3807c8fd
1 file changed
+11
-5
@@ -347,11 +347,15 @@ fun ListsScreen(
|
||||
todayOnly = choosingBlock.type == BlockType.PROGRESS,
|
||||
onPick = { source -> viewModel.chooseSource(content.view.id, choosingBlock.id, source) },
|
||||
onDismiss = { choosingSourceFor = null },
|
||||
onCustomRules = if (choosingBlock.type == BlockType.PROGRESS) null else ({ onEditBlockRules(content.view.id, choosingBlock.id) }),
|
||||
// Only a tile and a preview can show custom rules so far.
|
||||
onCustomRules = if (choosingBlock.type in CUSTOM_RULE_BLOCKS) ({ onEditBlockRules(content.view.id, choosingBlock.id) }) else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** The blocks that can show a [BlockSource.Rules] source. */
|
||||
private val CUSTOM_RULE_BLOCKS = setOf(BlockType.COUNT_TILE, BlockType.PREVIEW)
|
||||
|
||||
/**
|
||||
* Wording for a refused list write.
|
||||
*
|
||||
@@ -543,12 +547,13 @@ private fun Tile(
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
BlockType.COUNT_TILE -> state.counts[block.id]?.takeIf { filter != null }?.let { count ->
|
||||
// Custom rules have no screen of their own to open, so their tile only counts.
|
||||
BlockType.COUNT_TILE -> state.counts[block.id]?.takeIf { filter != null || source is BlockSource.Rules }?.let { count ->
|
||||
CountCard(
|
||||
style = tileStyle(source!!, state),
|
||||
count = count,
|
||||
modifier = modifier,
|
||||
onClick = { onOpenFilter(filter!!, scopeFor(block)) },
|
||||
onClick = { filter?.let { onOpenFilter(it, scopeFor(block)) } },
|
||||
)
|
||||
}
|
||||
else -> null
|
||||
@@ -588,7 +593,8 @@ private fun LazyListScope.previewSection(
|
||||
) {
|
||||
// TODO(#59): inline done.
|
||||
val source = block.source ?: return
|
||||
val filter = source.taskFilter ?: return
|
||||
val filter = source.taskFilter
|
||||
if (filter == null && source !is BlockSource.Rules) return
|
||||
val options = block.options as BlockOptions.Preview
|
||||
val tasks = state.previews[block.id].orEmpty()
|
||||
if (tasks.isEmpty()) return
|
||||
@@ -597,7 +603,7 @@ private fun LazyListScope.previewSection(
|
||||
UpcomingPreview(
|
||||
tasks = tasks,
|
||||
onOpenTask = onOpenTask,
|
||||
onViewAll = if (options.showAll) ({ onOpenFilter(filter) }) else null,
|
||||
onViewAll = if (options.showAll && filter != null) ({ onOpenFilter(filter) }) else null,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user