Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e508547fc | ||
|
|
eea6825ac7 | ||
|
|
d8c7cc498d | ||
|
|
7d2e8cae5d | ||
|
|
f680b04533 |
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 0,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "tout-doux",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tout-doux",
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.3",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"engines": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "tout-doux"
|
||||
version = "1.7.2"
|
||||
version = "1.7.3"
|
||||
description = ""
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { useAlertStore } from "@/stores/alerts";
|
||||
import { defineAsyncComponent } from "vue";
|
||||
const AlertItem = defineAsyncComponent(
|
||||
() => import("@/components/AlertItem.vue"),
|
||||
);
|
||||
import AlertItem from "@/components/AlertItem.vue";
|
||||
|
||||
const { alerts } = useAlertStore();
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onBeforeMount, watch, defineAsyncComponent } from "vue";
|
||||
import { ref, onBeforeMount, watch } from "vue";
|
||||
import { getCron, parseCron, validCron } from "@/lib/recurrence";
|
||||
import { CronType } from "@/enums";
|
||||
const DateInput = defineAsyncComponent(
|
||||
() => import("@/components/DateInput.vue"),
|
||||
);
|
||||
import DateInput from "@/components/DateInput.vue";
|
||||
|
||||
const DEFAULT_CRON = "0 0 * * *";
|
||||
|
||||
@@ -116,20 +114,6 @@ watch(cron, () => {
|
||||
{{ $t("cron.type.one_time") }}
|
||||
</option>
|
||||
</select>
|
||||
<select
|
||||
v-if="cronType === CronType.EVERY_DAY"
|
||||
v-model="cronValue"
|
||||
class="select flex-1"
|
||||
@change="onChangeCronValue"
|
||||
>
|
||||
<option
|
||||
v-for="i in Array.from(Array(24).keys())"
|
||||
:key="`h${i + 1}`"
|
||||
:value="i"
|
||||
>
|
||||
{{ i.toFixed(0).padStart(2, "0") }}:00
|
||||
</option>
|
||||
</select>
|
||||
<select
|
||||
v-if="cronType === CronType.EVERY_WEEK"
|
||||
v-model="cronValue"
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { getMetadata } from "@/api/meta";
|
||||
import type { Metadata } from "@/types";
|
||||
import { defineAsyncComponent, onBeforeMount, ref } from "vue";
|
||||
import { onBeforeMount, ref } from "vue";
|
||||
import LangInput from "@/components/LangInput.vue";
|
||||
|
||||
const metadata = ref<Metadata|null>(null);
|
||||
|
||||
const LangInput = defineAsyncComponent(
|
||||
() => import("@/components/LangInput.vue"),
|
||||
);
|
||||
const metadata = ref<Metadata | null>(null);
|
||||
|
||||
function fetchMetadata() {
|
||||
void getMetadata()
|
||||
.then((data) => {
|
||||
metadata.value = data;
|
||||
setTimeout(fetchMetadata, 600000);
|
||||
});
|
||||
void getMetadata().then((data) => {
|
||||
metadata.value = data;
|
||||
setTimeout(fetchMetadata, 600000);
|
||||
});
|
||||
}
|
||||
|
||||
onBeforeMount(fetchMetadata);
|
||||
|
||||
@@ -4,15 +4,12 @@ import {
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
defineAsyncComponent,
|
||||
nextTick,
|
||||
} from "vue";
|
||||
import type { Task } from "@/types";
|
||||
import { CopyIcon, TrashIcon, SaveIcon, XIcon } from "@lucide/vue";
|
||||
import { updateTask } from "@/api/tasks";
|
||||
const CronInput = defineAsyncComponent(
|
||||
() => import("@/components/CronInput.vue"),
|
||||
);
|
||||
import CronInput from "@/components/CronInput.vue";
|
||||
import {
|
||||
isTemporary,
|
||||
taskCompleted,
|
||||
|
||||
@@ -128,7 +128,7 @@ export function getCron(
|
||||
case CronType.ONE_TIME:
|
||||
return ONE_TIME_VALUE;
|
||||
case CronType.EVERY_DAY:
|
||||
return `0 ${value.toFixed(0)} * * *`;
|
||||
return `0 0 * * *`;
|
||||
case CronType.EVERY_WEEK:
|
||||
return `0 0 * * ${value.toFixed(0)}`;
|
||||
case CronType.EVERY_MONTH:
|
||||
@@ -171,10 +171,6 @@ export function getCron(
|
||||
return null;
|
||||
}
|
||||
|
||||
function dtStartFormat(date: Date): string {
|
||||
return `${date.getFullYear().toFixed(0)}${(date.getMonth() + 1).toFixed(0).padStart(2, "0")}${date.getDate().toFixed(0).padStart(2, "0")}T000000Z`;
|
||||
}
|
||||
|
||||
export function isOneTime(cron: string | null): boolean {
|
||||
return cron === ONE_TIME_VALUE;
|
||||
}
|
||||
|
||||
@@ -35,11 +35,19 @@ export function isTemporary(task: Task): boolean {
|
||||
}
|
||||
|
||||
export function taskNextReset(task: Task): Date | null {
|
||||
return nextCronReset(task.check_date ?? new Date(), task.reset_cron, task.id);
|
||||
return nextCronReset(
|
||||
task.check_date ?? new Date(),
|
||||
task.reset_cron,
|
||||
task.id,
|
||||
);
|
||||
}
|
||||
|
||||
export function taskFutureReset(task: Task): Date | null {
|
||||
return nextCronReset(taskNextReset(task) ?? new Date(), task.reset_cron, task.id);
|
||||
return nextCronReset(
|
||||
taskNextReset(task) ?? new Date(),
|
||||
task.reset_cron,
|
||||
task.id,
|
||||
);
|
||||
}
|
||||
|
||||
export function taskCompleted(task: Task): boolean {
|
||||
@@ -53,6 +61,18 @@ export function taskCompleted(task: Task): boolean {
|
||||
return nextReset.getTime() > new Date().getTime();
|
||||
}
|
||||
|
||||
export function fallbackDate(task: Task): Date {
|
||||
return new Date(
|
||||
task.created_at.getFullYear() - 100,
|
||||
task.created_at.getMonth(),
|
||||
task.created_at.getDate(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
export function sortTasks(
|
||||
tasks: Task[],
|
||||
sortType: SortType,
|
||||
@@ -81,8 +101,8 @@ export function sortTasks(
|
||||
.sort(
|
||||
(a: Task, b: Task) =>
|
||||
(reverse ? -1 : 1) *
|
||||
((a.check_date ?? a.created_at).getTime() -
|
||||
(b.check_date ?? b.created_at).getTime()),
|
||||
((a.check_date ?? fallbackDate(a)).getTime() -
|
||||
(b.check_date ?? fallbackDate(b)).getTime()),
|
||||
);
|
||||
case SortType.RESET_DATE:
|
||||
return tasks
|
||||
@@ -90,8 +110,8 @@ export function sortTasks(
|
||||
.sort(
|
||||
(a: Task, b: Task) =>
|
||||
(reverse ? -1 : 1) *
|
||||
(taskNextReset(a) ?? a.created_at).getTime() -
|
||||
(taskNextReset(b) ?? b.created_at).getTime(),
|
||||
(taskNextReset(a) ?? fallbackDate(a)).getTime() -
|
||||
(taskNextReset(b) ?? fallbackDate(b)).getTime(),
|
||||
);
|
||||
case SortType.NAME:
|
||||
return tasks
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
import { useListStore } from "@/stores/lists";
|
||||
import { ArrowBigRightDashIcon, DicesIcon, HistoryIcon } from "@lucide/vue";
|
||||
import { generateSlug } from "random-word-slugs";
|
||||
import { defineAsyncComponent, onBeforeMount, ref } from "vue";
|
||||
import { onBeforeMount, ref } from "vue";
|
||||
import { onBeforeRouteUpdate } from "vue-router";
|
||||
const RecentItem = defineAsyncComponent(
|
||||
() => import("@/components/RecentItem.vue"),
|
||||
);
|
||||
import RecentItem from "@/components/RecentItem.vue";
|
||||
|
||||
const listNameInput = ref<string>(generateSlug(4));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onBeforeMount, computed, defineAsyncComponent } from "vue";
|
||||
import { ref, onBeforeMount, computed } from "vue";
|
||||
import type { Task } from "@/types";
|
||||
import { getTasks, createTask, deleteTask } from "@/api/tasks";
|
||||
import {
|
||||
@@ -9,12 +9,8 @@ import {
|
||||
SearchIcon,
|
||||
Share2Icon,
|
||||
} from "@lucide/vue";
|
||||
const TaskItem = defineAsyncComponent(
|
||||
() => import("@/components/TaskItem.vue"),
|
||||
);
|
||||
const ListOptions = defineAsyncComponent(
|
||||
() => import("@/components/ListOptions.vue"),
|
||||
);
|
||||
import TaskItem from "@/components/TaskItem.vue";
|
||||
import ListOptions from "@/components/ListOptions.vue";
|
||||
import { taskCompleted, sortTasks, newTemporaryTask } from "@/lib/tasks";
|
||||
import { SortType } from "@/enums";
|
||||
import { booleanCookieRef, enumCookieRef } from "@/lib/cookies";
|
||||
|
||||
Reference in New Issue
Block a user