feat(tasks): update due date text every minute
Related discussion: https://community.vikunja.io/t/text-describing-time-past-due-date-is-never-refreshed/1376/3
This commit is contained in:
parent
725fd1ad46
commit
abbc11528e
@ -49,7 +49,7 @@
|
|||||||
:labels="task.labels"
|
:labels="task.labels"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<assignee-list
|
<assignee-list
|
||||||
v-if="task.assignees.length > 0"
|
v-if="task.assignees.length > 0"
|
||||||
:assignees="task.assignees"
|
:assignees="task.assignees"
|
||||||
:avatar-size="25"
|
:avatar-size="25"
|
||||||
@ -70,7 +70,7 @@
|
|||||||
class="is-italic"
|
class="is-italic"
|
||||||
:aria-expanded="showDefer ? 'true' : 'false'"
|
:aria-expanded="showDefer ? 'true' : 'false'"
|
||||||
>
|
>
|
||||||
– {{ $t('task.detail.due', {at: formatDateSince(task.dueDate)}) }}
|
– {{ $t('task.detail.due', {at: dueDateFormatted}) }}
|
||||||
</time>
|
</time>
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
<CustomTransition name="fade">
|
<CustomTransition name="fade">
|
||||||
@ -119,7 +119,7 @@
|
|||||||
<icon icon="star" v-if="task.isFavorite"/>
|
<icon icon="star" v-if="task.isFavorite"/>
|
||||||
<icon :icon="['far', 'star']" v-else/>
|
<icon :icon="['far', 'star']" v-else/>
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
<slot />
|
<slot/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -127,7 +127,7 @@
|
|||||||
import {ref, watch, shallowReactive, onMounted, onBeforeUnmount, computed} from 'vue'
|
import {ref, watch, shallowReactive, onMounted, onBeforeUnmount, computed} from 'vue'
|
||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
|
|
||||||
import TaskModel, { getHexColor } from '@/models/task'
|
import TaskModel, {getHexColor} from '@/models/task'
|
||||||
import type {ITask} from '@/modelTypes/ITask'
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
|
|
||||||
import PriorityLabel from '@/components/tasks/partials/priorityLabel.vue'
|
import PriorityLabel from '@/components/tasks/partials/priorityLabel.vue'
|
||||||
@ -150,6 +150,7 @@ import {useProjectStore} from '@/stores/projects'
|
|||||||
import {useBaseStore} from '@/stores/base'
|
import {useBaseStore} from '@/stores/base'
|
||||||
import {useTaskStore} from '@/stores/tasks'
|
import {useTaskStore} from '@/stores/tasks'
|
||||||
import AssigneeList from '@/components/tasks/partials/assigneeList.vue'
|
import AssigneeList from '@/components/tasks/partials/assigneeList.vue'
|
||||||
|
import {useIntervalFn} from '@vueuse/core'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
theTask,
|
theTask,
|
||||||
@ -212,6 +213,20 @@ const taskDetailRoute = computed(() => ({
|
|||||||
// state: { backdropView: router.currentRoute.value.fullPath },
|
// state: { backdropView: router.currentRoute.value.fullPath },
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
function updateDueDate() {
|
||||||
|
if (!task.value.dueDate) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dueDateFormatted.value = formatDateSince(task.value.dueDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
const dueDateFormatted = ref('')
|
||||||
|
useIntervalFn(updateDueDate, 60_000, {
|
||||||
|
immediateCallback: true,
|
||||||
|
})
|
||||||
|
onMounted(updateDueDate)
|
||||||
|
|
||||||
|
|
||||||
async function markAsDone(checked: boolean) {
|
async function markAsDone(checked: boolean) {
|
||||||
const updateFunc = async () => {
|
const updateFunc = async () => {
|
||||||
@ -246,6 +261,7 @@ async function toggleFavorite() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deferDueDate = ref<typeof DeferTask | null>(null)
|
const deferDueDate = ref<typeof DeferTask | null>(null)
|
||||||
|
|
||||||
function hideDeferDueDatePopup(e) {
|
function hideDeferDueDatePopup(e) {
|
||||||
if (!showDefer.value) {
|
if (!showDefer.value) {
|
||||||
return
|
return
|
||||||
@ -281,7 +297,7 @@ function hideDeferDueDatePopup(e) {
|
|||||||
-webkit-line-clamp: 4;
|
-webkit-line-clamp: 4;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
flex: 1 0 50%;
|
flex: 1 0 50%;
|
||||||
|
|
||||||
.dueDate {
|
.dueDate {
|
||||||
@ -391,7 +407,7 @@ function hideDeferDueDatePopup(e) {
|
|||||||
color: var(--danger);
|
color: var(--danger);
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="checkbox"] {
|
input[type='checkbox'] {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ import {format, formatDistanceToNow} from 'date-fns'
|
|||||||
import {enGB, de, fr, ru} from 'date-fns/locale'
|
import {enGB, de, fr, ru} from 'date-fns/locale'
|
||||||
|
|
||||||
import {i18n} from '@/i18n'
|
import {i18n} from '@/i18n'
|
||||||
import { createSharedComposable, type MaybeRef } from '@vueuse/core'
|
import {createSharedComposable, type MaybeRef} from '@vueuse/core'
|
||||||
import { computed, unref } from 'vue'
|
import {computed, unref} from 'vue'
|
||||||
|
|
||||||
const locales = {en: enGB, de, ch: de, fr, ru}
|
const locales = {en: enGB, de, ch: de, fr, ru}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export const useDateTimeFormatter = createSharedComposable((options?: MaybeRef<I
|
|||||||
})
|
})
|
||||||
|
|
||||||
export function useWeekDayFromDate() {
|
export function useWeekDayFromDate() {
|
||||||
const dateTimeFormatter = useDateTimeFormatter({ weekday: 'short' })
|
const dateTimeFormatter = useDateTimeFormatter({weekday: 'short'})
|
||||||
|
|
||||||
return computed(() => (date: Date) => dateTimeFormatter.value.format(date))
|
return computed(() => (date: Date) => dateTimeFormatter.value.format(date))
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user