feat: last checked and next refresh
This commit is contained in:
@@ -4,11 +4,13 @@ import type { Task } from "@/types";
|
||||
import { Copy, Trash, Save, X } from "@lucide/vue";
|
||||
import { updateTask } from "@/api/tasks";
|
||||
import CronInput from "@/components/CronInput.vue";
|
||||
import { taskCompleted } from "@/lib/tasks";
|
||||
import { taskCompleted, taskNextReset } from "@/lib/tasks";
|
||||
import { relativeTime } from "@/lib/dates";
|
||||
|
||||
const emit = defineEmits<(e: 'clone' | 'delete', task: Task) => void>();
|
||||
|
||||
const task = defineModel<Task>({ required: true });
|
||||
defineProps<{ showLastChecked: boolean; showNextReset: boolean }>();
|
||||
|
||||
const editMode = ref<boolean>(false);
|
||||
const editName = ref<string>('');
|
||||
@@ -16,6 +18,7 @@ const editCron = ref<string|null>(null);
|
||||
const refreshKey = ref<number>(0);
|
||||
|
||||
const checked = computed<boolean>(() => taskCompleted(task.value));
|
||||
const nextReset = computed<Date | null>(() => taskNextReset(task.value));
|
||||
|
||||
function onClose() {
|
||||
editMode.value = false;
|
||||
@@ -80,7 +83,13 @@ watch(task, () => {
|
||||
class="cursor-pointer text-lg select-none"
|
||||
@click.prevent="editMode = true"
|
||||
>
|
||||
{{ task.name }}
|
||||
<div>{{ task.name }}</div>
|
||||
<div v-if="showLastChecked && !checked && task.check_date" class="font-light text-xs italic">
|
||||
Checked {{ relativeTime(task.check_date) }}
|
||||
</div>
|
||||
<div v-if="showNextReset && checked && nextReset" class="font-light text-xs italic">
|
||||
Resets {{ relativeTime(nextReset) }}
|
||||
</div>
|
||||
</div>
|
||||
<template v-else>
|
||||
<div class="flex flex-col gap-2">
|
||||
|
||||
Reference in New Issue
Block a user