|
315 | 315 | <span>{{ unscheduledEntries.length }}</span> |
316 | 316 | </div> |
317 | 317 | <button |
318 | | - v-if="unscheduledDoneCount > 0" |
| 318 | + v-if="doneUnscheduledIdList.length > 0" |
319 | 319 | type="button" |
320 | 320 | class="rounded-pill border border-line bg-surface px-2.5 py-1 text-[10px] font-semibold tracking-wider text-ink-subtle uppercase hover:border-brand hover:text-brand" |
321 | | - @click="onArchiveDoneUnscheduled" |
| 321 | + @click="onArchiveDoneUnscheduled(doneUnscheduledIdList)" |
322 | 322 | > |
323 | 323 | {{ |
324 | 324 | $t('dailyRoutine.archiveDone', { |
325 | | - n: unscheduledDoneCount, |
| 325 | + n: doneUnscheduledIdList.length, |
326 | 326 | }) |
327 | 327 | }} |
328 | 328 | </button> |
|
373 | 373 | :week-start="weekStart" |
374 | 374 | :is-mobile="isMobile" |
375 | 375 | :is-tablet="isTablet" |
| 376 | + @select-day="onSelectDay" |
376 | 377 | @toggle="onToggle" |
377 | 378 | @edit="onEdit" |
378 | 379 | @create="onCreateAt" |
|
464 | 465 | <button |
465 | 466 | v-if="!selectMode" |
466 | 467 | type="button" |
467 | | - class="fixed right-4 bottom-20 z-20 flex h-12 w-12 items-center justify-center rounded-full bg-brand text-on-accent shadow-tmgr-md transition-transform hover:scale-105 hover:bg-brand-hover md:right-6 md:bottom-6 md:h-14 md:w-14" |
| 468 | + class="fixed right-4 bottom-20 z-20 flex h-12 w-12 items-center justify-center rounded-full bg-brand text-on-accent shadow-tmgr-md transition-transform hover:scale-105 hover:bg-brand-hover md:right-6 md:bottom-[calc(var(--statusbar-h,0px)+1.5rem)] md:h-14 md:w-14" |
468 | 469 | :title="$t('dailyRoutine.page.newRoutineTitle')" |
469 | 470 | :aria-label="$t('dailyRoutine.page.newRoutine')" |
470 | 471 | data-tour="routines.add" |
|
536 | 537 | startOfMonth, |
537 | 538 | startOfWeek, |
538 | 539 | } from '@/utils/dailyRoutines/dateHelpers'; |
| 540 | + import { getArchivedDailyTasksCount } from '@/actions/tmgr/daily-tasks'; |
| 541 | + import { doneUnscheduledIds } from '@/utils/dailyRoutines/archiveDone'; |
539 | 542 | import { sortUnscheduledNewestFirst } from '@/utils/dailyRoutines/sortRoutines'; |
540 | 543 | import { requestCache } from '@/utils/requestCache'; |
541 | 544 | import { nowDateIn, todayDateIn, todayIn } from '@/utils/timezone'; |
|
644 | 647 | entries.value.filter((e) => !e.time && e.date === todayIso.value), |
645 | 648 | ), |
646 | 649 | ); |
647 | | - const unscheduledDoneCount = computed( |
648 | | - () => unscheduledEntries.value.filter((e) => e.completed).length, |
| 650 | + const doneUnscheduledIdList = computed(() => |
| 651 | + doneUnscheduledIds(unscheduledEntries.value), |
649 | 652 | ); |
| 653 | + const archivedCount = ref(0); |
| 654 | + async function refreshArchivedCount() { |
| 655 | + try { |
| 656 | + archivedCount.value = Number(await getArchivedDailyTasksCount()); |
| 657 | + } catch { |
| 658 | + archivedCount.value = 0; |
| 659 | + } |
| 660 | + } |
650 | 661 | const scheduledEntries = computed(() => |
651 | 662 | entries.value.filter((e) => !!e.time), |
652 | 663 | ); |
|
656 | 667 | return { |
657 | 668 | routines: todays.length, |
658 | 669 | completed: todays.filter((e) => e.completed).length, |
659 | | - archived: 0, |
| 670 | + archived: archivedCount.value, |
660 | 671 | }; |
661 | 672 | }); |
662 | 673 |
|
|
842 | 853 | const snapshotKey = routinesSnapshotKey(); |
843 | 854 | viewPending.value = true; |
844 | 855 | viewError.value = null; |
| 856 | + void refreshArchivedCount(); |
845 | 857 | try { |
846 | 858 | if (view.value === 'year') { |
847 | 859 | await Promise.all([ |
|
1024 | 1036 | await reload(); |
1025 | 1037 | } |
1026 | 1038 |
|
1027 | | - async function onArchiveDoneUnscheduled() { |
1028 | | - await store.dispatch('dailyRoutines/archiveDoneUnscheduled'); |
| 1039 | + async function onArchiveDoneUnscheduled(ids: number[]) { |
| 1040 | + await store.dispatch('dailyRoutines/archiveDoneUnscheduled', ids); |
1029 | 1041 | await reload(); |
1030 | 1042 | } |
1031 | 1043 |
|
|
0 commit comments