fix(ui): Toast 撤销可暂停,存储告警提升为全局
- Toast 自动关闭支持悬停/聚焦暂停,移开后按剩余时间继续 - 存储异常提示移到 App 级,看板与今日视图都能看到 - 归档隐藏与筛选隐藏分开说明,并提示列内排序暂停原因
This commit is contained in:
+34
-9
@@ -19,8 +19,7 @@ const store = useTaskStore()
|
||||
const filters = useFilterStore()
|
||||
const toast = useToastStore()
|
||||
const ui = useUiStore()
|
||||
const { notice } = storeToRefs(store)
|
||||
const { filter } = storeToRefs(filters)
|
||||
const { filter, includeArchived } = storeToRefs(filters)
|
||||
|
||||
/** 详情抽屉当前编辑的任务 id;任务被删除后自动变为 null,抽屉随之关闭 */
|
||||
const editingId = ref<string | null>(null)
|
||||
@@ -54,6 +53,38 @@ const hiddenTotal = computed(() =>
|
||||
COLUMNS.reduce((total, column) => total + hiddenCounts.value[column.id], 0),
|
||||
)
|
||||
|
||||
/**
|
||||
* 被「隐藏归档」挡掉、且本来能通过当前筛选的任务数。
|
||||
*
|
||||
* 单独算一遍是为了给提示分层:用户看到「已隐藏 3 个」时,
|
||||
* 应该知道其中多少是搜索/筛选造成的、多少只是归档没显示。
|
||||
*/
|
||||
const archivedHiddenTotal = computed(() => {
|
||||
if (includeArchived.value) return 0
|
||||
const archived = store.tasks.filter((task) => task.archivedAt !== null)
|
||||
// filter.includeArchived 为 false 时会把归档任务直接排除,这里显式放开
|
||||
return filterTasks(archived, { ...filter.value, includeArchived: true }).length
|
||||
})
|
||||
|
||||
const filteredHiddenTotal = computed(() =>
|
||||
Math.max(0, hiddenTotal.value - archivedHiddenTotal.value),
|
||||
)
|
||||
|
||||
/**
|
||||
* 列内排序在「渲染的是子集」时会被禁用(见 drag.ts),
|
||||
* 这里把原因写出来,避免用户拖不动却不知道为什么。
|
||||
*/
|
||||
const hiddenNote = computed(() => {
|
||||
if (hiddenTotal.value === 0) return undefined
|
||||
|
||||
const reasons: string[] = []
|
||||
if (filteredHiddenTotal.value > 0) reasons.push(`筛选 ${filteredHiddenTotal.value}`)
|
||||
if (archivedHiddenTotal.value > 0) reasons.push(`归档 ${archivedHiddenTotal.value}`)
|
||||
const detail = reasons.length > 0 ? `(${reasons.join(' + ')},列内排序已暂停)` : ''
|
||||
|
||||
return `已隐藏 ${hiddenTotal.value} 个${detail}`
|
||||
})
|
||||
|
||||
const archivableTasks = computed(() => findArchivableTasks(store.tasks))
|
||||
|
||||
function archiveCompleted(): void {
|
||||
@@ -137,16 +168,10 @@ function handleKeyMove(payload: { id: string; direction: MoveDirection }): void
|
||||
<div class="flex min-h-0 flex-1 flex-col gap-3 p-4 md:p-6">
|
||||
<BoardToolbar
|
||||
ref="toolbarRef"
|
||||
:hidden-note="hiddenTotal > 0 ? `· 已隐藏 ${hiddenTotal} 个` : undefined"
|
||||
:hidden-note="hiddenNote"
|
||||
@archive="archiveCompleted"
|
||||
/>
|
||||
|
||||
<p
|
||||
v-if="notice"
|
||||
class="rounded-lg border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800"
|
||||
>
|
||||
{{ notice }}
|
||||
</p>
|
||||
|
||||
<!--
|
||||
移动端:整块区域滚动,各列按内容自然高度排布;
|
||||
|
||||
Reference in New Issue
Block a user