Compare commits
27
Commits
release/1.5.0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeeabe81c7 | ||
|
|
87eff715f6 | ||
|
|
63c80f0bae | ||
|
|
f36c8ba315 | ||
|
|
7fc16e78de | ||
|
|
f8f38c9197 | ||
|
|
6e508547fc | ||
|
|
eea6825ac7 | ||
|
|
d8c7cc498d | ||
|
|
7d2e8cae5d | ||
|
|
f680b04533 | ||
|
|
fe5c0f94b2 | ||
|
|
664b47aa75 | ||
|
|
ce795582f9 | ||
|
|
bd87e5acf5 | ||
|
|
9081891d8f | ||
|
|
9b6d43253e | ||
|
|
321892bfac | ||
|
|
7daa0802cc | ||
|
|
84c6359583 | ||
|
|
fbdf3f5382 | ||
|
|
6fd871ef1f | ||
|
|
8b1cddea55 | ||
|
|
0abcc7ae1b | ||
|
|
6f8c14e8fb | ||
|
|
69512a4f1d | ||
|
|
02bf7bcc04 |
@@ -131,11 +131,11 @@ npm-run-%: node_modules ## npm run (script)
|
|||||||
|
|
||||||
.PHONY: docker-compose-up
|
.PHONY: docker-compose-up
|
||||||
docker-compose-up: ## docker compose up
|
docker-compose-up: ## docker compose up
|
||||||
$(DOCKER) compose up -d
|
$(DOCKER) compose up -d --wait --no-recreate
|
||||||
|
|
||||||
.PHONY: docker-compose-up-%
|
.PHONY: docker-compose-up-%
|
||||||
docker-compose-up-%: ## docker compose up (container)
|
docker-compose-up-%: ## docker compose up (container)
|
||||||
$(DOCKER) compose up -d $*
|
$(DOCKER) compose up -d --wait --no-recreate $*
|
||||||
|
|
||||||
.PHONY: docker-compose-down
|
.PHONY: docker-compose-down
|
||||||
docker-compose-down: ## docker compose down
|
docker-compose-down: ## docker compose down
|
||||||
|
|||||||
@@ -5,18 +5,18 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "tout-doux",
|
"name": "tout-doux",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lucide/vue": "^1.24.0",
|
"@lucide/vue": "^1.25.0",
|
||||||
"cron-parser": "^5.6.2",
|
"cron-parser": "^5.6.2",
|
||||||
"date-fns": "^4.4.0",
|
"date-fns": "^4.4.0",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "^3.0.4",
|
||||||
"random-word-slugs": "^0.1.7",
|
"random-word-slugs": "^0.1.7",
|
||||||
"rrule": "^2.8.1",
|
"rrule": "^2.8.1",
|
||||||
"vue": "^3.5.39",
|
"vue": "^3.5.40",
|
||||||
"vue-i18n": "^11.4.6",
|
"vue-i18n": "^11.4.6",
|
||||||
"vue-router": "^5.1.0",
|
"vue-router": "^5.2.0",
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/vite": "^4.3.2",
|
"@tailwindcss/vite": "^4.3.3",
|
||||||
"@tsconfig/node24": "^24.0.4",
|
"@tsconfig/node24": "^24.0.4",
|
||||||
"@types/node": "^24.13.3",
|
"@types/node": "^24.13.3",
|
||||||
"@vitejs/plugin-vue": "^6.0.8",
|
"@vitejs/plugin-vue": "^6.0.8",
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
"npm-run-all2": "^8.0.4",
|
"npm-run-all2": "^8.0.4",
|
||||||
"oxlint": "^1.74.0",
|
"oxlint": "^1.74.0",
|
||||||
"sass-embedded": "^1.100.0",
|
"sass-embedded": "^1.100.0",
|
||||||
"tailwindcss": "^4.3.2",
|
"tailwindcss": "^4.3.3",
|
||||||
"typescript": "~5.9.3",
|
"typescript": "~5.9.3",
|
||||||
"vite": "^8.1.4",
|
"vite": "^8.1.5",
|
||||||
"vite-plugin-vue-devtools": "^8.1.5",
|
"vite-plugin-vue-devtools": "^8.1.5",
|
||||||
"vue-tsc": "^3.3.7",
|
"vue-tsc": "^3.3.7",
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tout-doux",
|
"name": "tout-doux",
|
||||||
"version": "1.5.0",
|
"version": "1.7.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "tout-doux"
|
name = "tout-doux"
|
||||||
version = "1.5.0"
|
version = "1.7.6"
|
||||||
description = ""
|
description = ""
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
+12
-6
@@ -22,10 +22,14 @@
|
|||||||
"Sunday"
|
"Sunday"
|
||||||
],
|
],
|
||||||
"month": {
|
"month": {
|
||||||
"st": "st",
|
"st": "The {0}st",
|
||||||
"nd": "nd",
|
"nd": "The {0}nd",
|
||||||
"rd": "rd",
|
"rd": "The {0}rd",
|
||||||
"th": "th"
|
"th": "The {0}th",
|
||||||
|
"first_day": "First day of month",
|
||||||
|
"last_day": "Last day of month",
|
||||||
|
"last": "Last",
|
||||||
|
"first": "First"
|
||||||
},
|
},
|
||||||
"year": [
|
"year": [
|
||||||
"January",
|
"January",
|
||||||
@@ -40,7 +44,8 @@
|
|||||||
"October",
|
"October",
|
||||||
"November",
|
"November",
|
||||||
"December"
|
"December"
|
||||||
]
|
],
|
||||||
|
"rrule_start": "Start:"
|
||||||
},
|
},
|
||||||
"checked": "Checked",
|
"checked": "Checked",
|
||||||
"resets": "Resets",
|
"resets": "Resets",
|
||||||
@@ -61,7 +66,8 @@
|
|||||||
"reverse_sort": "Reverse sort",
|
"reverse_sort": "Reverse sort",
|
||||||
"last_checked": "Show last checked time",
|
"last_checked": "Show last checked time",
|
||||||
"next_reset": "Show next reset time",
|
"next_reset": "Show next reset time",
|
||||||
"separate_completed": "Separate completed tasks below"
|
"separate_completed": "Separate completed tasks below",
|
||||||
|
"missed": "Show in red missed tasks (reset without check)"
|
||||||
},
|
},
|
||||||
"alerts": {
|
"alerts": {
|
||||||
"task_updated": "Task updated",
|
"task_updated": "Task updated",
|
||||||
|
|||||||
+12
-6
@@ -22,10 +22,14 @@
|
|||||||
"Dimanche"
|
"Dimanche"
|
||||||
],
|
],
|
||||||
"month": {
|
"month": {
|
||||||
"st": "",
|
"st": "Le {0}",
|
||||||
"nd": "",
|
"nd": "Le {0}",
|
||||||
"rd": "",
|
"rd": "Le {0}",
|
||||||
"th": ""
|
"th": "Le {0}",
|
||||||
|
"first_day": "Premier jour du mois",
|
||||||
|
"last_day": "Dernier jour du mois",
|
||||||
|
"last": "Dernier",
|
||||||
|
"first": "Premier"
|
||||||
},
|
},
|
||||||
"year": [
|
"year": [
|
||||||
"Janvier",
|
"Janvier",
|
||||||
@@ -40,7 +44,8 @@
|
|||||||
"Octobre",
|
"Octobre",
|
||||||
"Novembre",
|
"Novembre",
|
||||||
"Décembre"
|
"Décembre"
|
||||||
]
|
],
|
||||||
|
"rrule_start": "Début :"
|
||||||
},
|
},
|
||||||
"checked": "Complété",
|
"checked": "Complété",
|
||||||
"resets": "Reviens",
|
"resets": "Reviens",
|
||||||
@@ -61,7 +66,8 @@
|
|||||||
"reverse_sort": "Inverser le tri",
|
"reverse_sort": "Inverser le tri",
|
||||||
"last_checked": "Afficher la dernière completion",
|
"last_checked": "Afficher la dernière completion",
|
||||||
"next_reset": "Afficher la prochaine réinitialisation",
|
"next_reset": "Afficher la prochaine réinitialisation",
|
||||||
"separate_completed": "Séparer les tâches complétées plus bas"
|
"separate_completed": "Séparer les tâches complétées plus bas",
|
||||||
|
"missed": "Indiquer en rouge les tâches manquées (réinitialisées sans completion)"
|
||||||
},
|
},
|
||||||
"alerts": {
|
"alerts": {
|
||||||
"task_updated": "Tâche mise a jour",
|
"task_updated": "Tâche mise a jour",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ onMounted(() => {
|
|||||||
<div class="hero bg-hero grow">
|
<div class="hero bg-hero grow">
|
||||||
<div class="hero-content text-center p-0">
|
<div class="hero-content text-center p-0">
|
||||||
<div
|
<div
|
||||||
class="max-w-md min-w-96 bg-base-100 rounded-box shadow-md p-4"
|
class="max-w-96 min-w-screen sm:min-w-96 bg-base-100 rounded-box shadow-md p-4"
|
||||||
>
|
>
|
||||||
<router-link
|
<router-link
|
||||||
to="/"
|
to="/"
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useAlertStore } from "@/stores/alerts";
|
import { useAlertStore } from "@/stores/alerts";
|
||||||
import { defineAsyncComponent } from "vue";
|
import AlertItem from "@/components/AlertItem.vue";
|
||||||
const AlertItem = defineAsyncComponent(
|
|
||||||
() => import("@/components/AlertItem.vue"),
|
|
||||||
);
|
|
||||||
|
|
||||||
const { alerts } = useAlertStore();
|
const { alerts } = useAlertStore();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { ref, onBeforeMount, watch } from "vue";
|
import { ref, onBeforeMount, watch } from "vue";
|
||||||
import { getCron, parseCron, validCron } from "@/lib/recurrence";
|
import { getCron, parseCron, validCron } from "@/lib/recurrence";
|
||||||
import { CronType } from "@/enums";
|
import { CronType } from "@/enums";
|
||||||
|
import DateInput from "@/components/DateInput.vue";
|
||||||
|
|
||||||
const DEFAULT_CRON = "0 0 * * *";
|
const DEFAULT_CRON = "0 0 * * *";
|
||||||
|
|
||||||
@@ -11,28 +12,38 @@ const valid = ref<boolean>(true);
|
|||||||
const props = defineProps<{ editMode: boolean }>();
|
const props = defineProps<{ editMode: boolean }>();
|
||||||
|
|
||||||
const cronType = ref<CronType>(CronType.MANUAL);
|
const cronType = ref<CronType>(CronType.MANUAL);
|
||||||
const cronValue = ref<number>(0);
|
const cronValue = ref<string>("0");
|
||||||
|
const cronDate = ref<Date>(new Date());
|
||||||
|
|
||||||
function onCronChanged() {
|
function onCronChanged() {
|
||||||
const data = parseCron(cron.value);
|
const data = parseCron(cron.value);
|
||||||
rawCron.value = cron.value ?? DEFAULT_CRON;
|
rawCron.value = cron.value ?? DEFAULT_CRON;
|
||||||
cronType.value = data.type;
|
cronType.value = data.type;
|
||||||
cronValue.value = data.value;
|
cronValue.value = data.value.toFixed(0);
|
||||||
|
cronDate.value = data.date ?? new Date();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCron() {
|
function updateCron() {
|
||||||
cron.value = getCron(cronType.value, cronValue.value, rawCron.value);
|
cron.value = getCron(
|
||||||
|
cronType.value,
|
||||||
|
parseInt(cronValue.value),
|
||||||
|
cronDate.value,
|
||||||
|
rawCron.value,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChangeCronType() {
|
function onChangeCronType() {
|
||||||
switch (cronType.value) {
|
switch (cronType.value) {
|
||||||
case CronType.EVERY_DAY:
|
case CronType.EVERY_DAY:
|
||||||
cronValue.value = 0;
|
cronValue.value = "0";
|
||||||
break;
|
break;
|
||||||
case CronType.EVERY_WEEK:
|
case CronType.EVERY_WEEK:
|
||||||
case CronType.EVERY_MONTH:
|
case CronType.EVERY_MONTH:
|
||||||
case CronType.EVERY_YEAR:
|
case CronType.EVERY_YEAR:
|
||||||
cronValue.value = 1;
|
case CronType.EVERY_N_DAYS:
|
||||||
|
case CronType.EVERY_N_WEEKS:
|
||||||
|
case CronType.EVERY_N_MONTHS:
|
||||||
|
cronValue.value = "1";
|
||||||
break;
|
break;
|
||||||
case CronType.CUSTOM:
|
case CronType.CUSTOM:
|
||||||
cron.value ??= DEFAULT_CRON;
|
cron.value ??= DEFAULT_CRON;
|
||||||
@@ -45,6 +56,10 @@ function onChangeCronValue() {
|
|||||||
updateCron();
|
updateCron();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onChangeCronDate() {
|
||||||
|
updateCron();
|
||||||
|
}
|
||||||
|
|
||||||
function onInputRawCron() {
|
function onInputRawCron() {
|
||||||
valid.value = validCron(rawCron.value);
|
valid.value = validCron(rawCron.value);
|
||||||
if (valid.value) {
|
if (valid.value) {
|
||||||
@@ -62,8 +77,12 @@ watch(cron, () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2 flex-wrap">
|
||||||
<select v-model="cronType" class="select flex-1" @change="onChangeCronType">
|
<select
|
||||||
|
v-model="cronType"
|
||||||
|
class="select flex-1"
|
||||||
|
@change="onChangeCronType"
|
||||||
|
>
|
||||||
<option :value="CronType.MANUAL">
|
<option :value="CronType.MANUAL">
|
||||||
{{ $t("cron.type.manual") }}
|
{{ $t("cron.type.manual") }}
|
||||||
</option>
|
</option>
|
||||||
@@ -95,20 +114,6 @@ watch(cron, () => {
|
|||||||
{{ $t("cron.type.one_time") }}
|
{{ $t("cron.type.one_time") }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</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}`"
|
|
||||||
:value="i"
|
|
||||||
>
|
|
||||||
{{ i.toFixed(0).padStart(2, "0") }}:00
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<select
|
<select
|
||||||
v-if="cronType === CronType.EVERY_WEEK"
|
v-if="cronType === CronType.EVERY_WEEK"
|
||||||
v-model="cronValue"
|
v-model="cronValue"
|
||||||
@@ -117,7 +122,7 @@ watch(cron, () => {
|
|||||||
>
|
>
|
||||||
<option
|
<option
|
||||||
v-for="i in Array.from(Array(7).keys())"
|
v-for="i in Array.from(Array(7).keys())"
|
||||||
:key="`w${i}`"
|
:key="`w${i + 1}`"
|
||||||
:value="i + 1"
|
:value="i + 1"
|
||||||
>
|
>
|
||||||
{{ $t(`cron.week.${i.toFixed(0)}`) }}
|
{{ $t(`cron.week.${i.toFixed(0)}`) }}
|
||||||
@@ -129,20 +134,37 @@ watch(cron, () => {
|
|||||||
class="select flex-1"
|
class="select flex-1"
|
||||||
@change="onChangeCronValue"
|
@change="onChangeCronValue"
|
||||||
>
|
>
|
||||||
|
<option :value="1">{{ $t("cron.month.first_day") }}</option>
|
||||||
|
<option :value="32">{{ $t("cron.month.last_day") }}</option>
|
||||||
<option
|
<option
|
||||||
v-for="i in Array.from(Array(31).keys())"
|
v-for="i in Array.from(Array(7).keys())"
|
||||||
:key="`d${i}`"
|
:key="`d${-(i + 1)}`"
|
||||||
:value="i + 1"
|
:value="-(i + 1)"
|
||||||
>
|
>
|
||||||
{{ i + 1
|
{{ $t("cron.month.first") }}
|
||||||
}}{{
|
{{ $t(`cron.week.${i.toFixed(0)}`).toLowerCase() }}
|
||||||
i % 10 == 0
|
</option>
|
||||||
? $t("cron.month.st")
|
<option
|
||||||
: i % 10 === 1
|
v-for="i in Array.from(Array(7).keys())"
|
||||||
? $t("cron.month.nd")
|
:key="`d${-(i + 8)}`"
|
||||||
: i % 10 === 2
|
:value="-(i + 8)"
|
||||||
? $t("cron.month.rd")
|
>
|
||||||
: $t("cron.month.th")
|
{{ $t("cron.month.last") }}
|
||||||
|
{{ $t(`cron.week.${i.toFixed(0)}`).toLowerCase() }}
|
||||||
|
</option>
|
||||||
|
<option
|
||||||
|
v-for="i in Array.from(Array(30).keys())"
|
||||||
|
:key="`d${i + 2}`"
|
||||||
|
:value="i + 2"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
i % 10 == 9 && i !== 9
|
||||||
|
? $t("cron.month.st", [i + 2])
|
||||||
|
: i % 10 === 0 && i !== 10
|
||||||
|
? $t("cron.month.nd", [i + 2])
|
||||||
|
: i % 10 === 1 && i !== 11
|
||||||
|
? $t("cron.month.rd", [i + 2])
|
||||||
|
: $t("cron.month.th", [i + 2])
|
||||||
}}
|
}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -169,13 +191,33 @@ watch(cron, () => {
|
|||||||
@input="onInputRawCron"
|
@input="onInputRawCron"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
v-if="cronType === CronType.EVERY_N_DAYS || cronType === CronType.EVERY_N_WEEKS || cronType === CronType.EVERY_N_MONTHS"
|
v-if="
|
||||||
|
cronType === CronType.EVERY_N_DAYS ||
|
||||||
|
cronType === CronType.EVERY_N_WEEKS ||
|
||||||
|
cronType === CronType.EVERY_N_MONTHS
|
||||||
|
"
|
||||||
v-model="cronValue"
|
v-model="cronValue"
|
||||||
type="number"
|
type="number"
|
||||||
min="1"
|
min="1"
|
||||||
step="1"
|
step="1"
|
||||||
class="input font-mono flex-1"
|
class="input font-mono flex-1"
|
||||||
@input="onChangeCronValue"
|
@change="onChangeCronValue"
|
||||||
/>
|
/>
|
||||||
|
<label
|
||||||
|
v-if="
|
||||||
|
cronType === CronType.EVERY_N_DAYS ||
|
||||||
|
cronType === CronType.EVERY_N_WEEKS ||
|
||||||
|
cronType === CronType.EVERY_N_MONTHS
|
||||||
|
"
|
||||||
|
class="label flex-1 basis-full"
|
||||||
|
>
|
||||||
|
{{ $t("cron.rrule_start") }}
|
||||||
|
<date-input
|
||||||
|
v-model="cronDate"
|
||||||
|
required
|
||||||
|
class="input font-mono"
|
||||||
|
@change="onChangeCronDate"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const emit = defineEmits<(e: "input"|"change", value: Date) => void>();
|
||||||
|
|
||||||
|
const date = defineModel<Date>({ required: true });
|
||||||
|
|
||||||
|
function onInput(event: Event) {
|
||||||
|
const inputValue = (event.target as HTMLInputElement).value;
|
||||||
|
date.value = new Date(inputValue);
|
||||||
|
emit('input', date.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onChange(event: Event) {
|
||||||
|
const inputValue = (event.target as HTMLInputElement).value;
|
||||||
|
date.value = new Date(inputValue);
|
||||||
|
emit('change', date.value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<input
|
||||||
|
:value="date.toISOString().substring(0, 10)"
|
||||||
|
type="date"
|
||||||
|
@input="onInput"
|
||||||
|
@change="onChange"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ArrowDownUpIcon, Settings2Icon } from "@lucide/vue";
|
||||||
|
import { SortType } from "@/enums";
|
||||||
|
|
||||||
|
defineEmits<(e: "changeSort") => void>();
|
||||||
|
|
||||||
|
const sortType = defineModel<SortType>("sortType", { required: true });
|
||||||
|
const sortReverse = defineModel<boolean>("sortReverse", { required: true });
|
||||||
|
const showLastChecked = defineModel<boolean>("showLastChecked", {
|
||||||
|
required: true,
|
||||||
|
});
|
||||||
|
const showNextReset = defineModel<boolean>("showNextReset", { required: true });
|
||||||
|
const separateCompleted = defineModel<boolean>("separateCompleted", {
|
||||||
|
required: true,
|
||||||
|
});
|
||||||
|
const showMissed = defineModel<boolean>("showMissed", { required: true });
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="collapse collapse-arrow font-light text-sm">
|
||||||
|
<input id="options-dropdown p-0" type="checkbox" />
|
||||||
|
<div class="collapse-title p-0 content-center">
|
||||||
|
<settings-2-icon class="inline" :size="16" />
|
||||||
|
{{ $t("options.title") }}
|
||||||
|
</div>
|
||||||
|
<div class="collapse-content">
|
||||||
|
<div class="w-full flex flex-col gap-2 text-left overflow-scroll">
|
||||||
|
<label class="label">
|
||||||
|
<arrow-down-up-icon class="inline" />
|
||||||
|
{{ $t("options.sort_by") }}
|
||||||
|
<select
|
||||||
|
v-model="sortType"
|
||||||
|
class="select"
|
||||||
|
@change="$emit('changeSort')"
|
||||||
|
>
|
||||||
|
<option :value="SortType.CREATED_AT">
|
||||||
|
{{ $t("options.sort.created_at") }}
|
||||||
|
</option>
|
||||||
|
<option :value="SortType.UPDATED_AT">
|
||||||
|
{{ $t("options.sort.updated_at") }}
|
||||||
|
</option>
|
||||||
|
<option :value="SortType.CHECK_DATE">
|
||||||
|
{{ $t("options.sort.check_date") }}
|
||||||
|
</option>
|
||||||
|
<option :value="SortType.RESET_DATE">
|
||||||
|
{{ $t("options.sort.reset_date") }}
|
||||||
|
</option>
|
||||||
|
<option :value="SortType.NAME">
|
||||||
|
{{ $t("options.sort.name") }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="label text-wrap">
|
||||||
|
<input
|
||||||
|
v-model="sortReverse"
|
||||||
|
type="checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
@change="$emit('changeSort')"
|
||||||
|
/>
|
||||||
|
{{ $t("options.reverse_sort") }}
|
||||||
|
</label>
|
||||||
|
<label class="label text-wrap">
|
||||||
|
<input
|
||||||
|
v-model="showLastChecked"
|
||||||
|
type="checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
/>
|
||||||
|
{{ $t("options.last_checked") }}
|
||||||
|
</label>
|
||||||
|
<label class="label text-wrap">
|
||||||
|
<input
|
||||||
|
v-model="showNextReset"
|
||||||
|
type="checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
/>
|
||||||
|
{{ $t("options.next_reset") }}
|
||||||
|
</label>
|
||||||
|
<label class="label text-wrap">
|
||||||
|
<input
|
||||||
|
v-model="separateCompleted"
|
||||||
|
type="checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
/>
|
||||||
|
{{ $t("options.separate_completed") }}
|
||||||
|
</label>
|
||||||
|
<label class="label text-wrap">
|
||||||
|
<input
|
||||||
|
v-model="showMissed"
|
||||||
|
type="checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
/>
|
||||||
|
{{ $t("options.missed") }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,17 +1,13 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getMetadata } from "@/api/meta";
|
import { getMetadata } from "@/api/meta";
|
||||||
import type { Metadata } from "@/types";
|
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 metadata = ref<Metadata | null>(null);
|
||||||
|
|
||||||
const LangInput = defineAsyncComponent(
|
|
||||||
() => import("@/components/LangInput.vue"),
|
|
||||||
);
|
|
||||||
|
|
||||||
function fetchMetadata() {
|
function fetchMetadata() {
|
||||||
void getMetadata()
|
void getMetadata().then((data) => {
|
||||||
.then((data) => {
|
|
||||||
metadata.value = data;
|
metadata.value = data;
|
||||||
setTimeout(fetchMetadata, 600000);
|
setTimeout(fetchMetadata, 600000);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,16 +4,18 @@ import {
|
|||||||
ref,
|
ref,
|
||||||
watch,
|
watch,
|
||||||
computed,
|
computed,
|
||||||
defineAsyncComponent,
|
|
||||||
nextTick,
|
nextTick,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import type { Task } from "@/types";
|
import type { Task } from "@/types";
|
||||||
import { CopyIcon, TrashIcon, SaveIcon, XIcon } from "@lucide/vue";
|
import { CopyIcon, TrashIcon, SaveIcon, XIcon } from "@lucide/vue";
|
||||||
import { updateTask } from "@/api/tasks";
|
import { updateTask } from "@/api/tasks";
|
||||||
const CronInput = defineAsyncComponent(
|
import CronInput from "@/components/CronInput.vue";
|
||||||
() => import("@/components/CronInput.vue"),
|
import {
|
||||||
);
|
isTemporary,
|
||||||
import { isTemporary, taskCompleted, taskNextReset } from "@/lib/tasks";
|
taskCompleted,
|
||||||
|
taskFutureReset,
|
||||||
|
taskNextReset,
|
||||||
|
} from "@/lib/tasks";
|
||||||
import { relativeTime } from "@/lib/dates";
|
import { relativeTime } from "@/lib/dates";
|
||||||
import { useAlertStore } from "@/stores/alerts";
|
import { useAlertStore } from "@/stores/alerts";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
@@ -23,7 +25,11 @@ const emit =
|
|||||||
defineEmits<(e: "clone" | "delete" | "updated", task: Task) => void>();
|
defineEmits<(e: "clone" | "delete" | "updated", task: Task) => void>();
|
||||||
|
|
||||||
const task = defineModel<Task>({ required: true });
|
const task = defineModel<Task>({ required: true });
|
||||||
defineProps<{ showLastChecked: boolean; showNextReset: boolean }>();
|
defineProps<{
|
||||||
|
showLastChecked: boolean;
|
||||||
|
showNextReset: boolean;
|
||||||
|
showMissed: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
const editMode = ref<boolean>(false);
|
const editMode = ref<boolean>(false);
|
||||||
const editName = ref<string>("");
|
const editName = ref<string>("");
|
||||||
@@ -33,6 +39,13 @@ const editNameInput = ref<HTMLInputElement | null>(null);
|
|||||||
|
|
||||||
const checked = computed<boolean>(() => taskCompleted(task.value));
|
const checked = computed<boolean>(() => taskCompleted(task.value));
|
||||||
const nextReset = computed<Date | null>(() => taskNextReset(task.value));
|
const nextReset = computed<Date | null>(() => taskNextReset(task.value));
|
||||||
|
const futureReset = computed<Date | null>(() => taskFutureReset(task.value));
|
||||||
|
const missed = computed<boolean>(
|
||||||
|
() =>
|
||||||
|
!checked.value &&
|
||||||
|
futureReset.value !== null &&
|
||||||
|
futureReset.value.getTime() < new Date().getTime(),
|
||||||
|
);
|
||||||
|
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|
||||||
@@ -157,6 +170,7 @@ watch(task, () => {
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="cursor-pointer text-lg select-none"
|
class="cursor-pointer text-lg select-none"
|
||||||
|
:class="showMissed && missed ? 'text-error' : ''"
|
||||||
@click.prevent="onOpen"
|
@click.prevent="onOpen"
|
||||||
>
|
>
|
||||||
<div>{{ task.name }}</div>
|
<div>{{ task.name }}</div>
|
||||||
|
|||||||
@@ -7,51 +7,82 @@ const ONE_TIME_VALUE = "@one-time";
|
|||||||
export function parseCron(cron: string | null): {
|
export function parseCron(cron: string | null): {
|
||||||
type: CronType;
|
type: CronType;
|
||||||
value: number;
|
value: number;
|
||||||
|
date: Date | null;
|
||||||
} {
|
} {
|
||||||
let value: RegExpMatchArray | null;
|
let value: RegExpMatchArray | null;
|
||||||
if (cron === null) {
|
if (cron === null) {
|
||||||
return {
|
return {
|
||||||
type: CronType.MANUAL,
|
type: CronType.MANUAL,
|
||||||
value: 0,
|
value: 0,
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
} else if (cron === ONE_TIME_VALUE) {
|
} else if (cron === ONE_TIME_VALUE) {
|
||||||
return {
|
return {
|
||||||
type: CronType.ONE_TIME,
|
type: CronType.ONE_TIME,
|
||||||
value: 0,
|
value: 0,
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
} else if (cron.startsWith("RRULE:")) {
|
} else if (isRrule(cron)) {
|
||||||
return parseRrule(cron);
|
return parseRrule(cron);
|
||||||
} else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) {
|
} else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) {
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_DAY,
|
type: CronType.EVERY_DAY,
|
||||||
value: parseInt(value[1] ?? ""),
|
value: parseInt(value[1] ?? ""),
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
} else if ((value = /^0 0 \* \* (\d+)$/i.exec(cron)) !== null) {
|
} else if ((value = /^0 0 \* \* (\d+)$/i.exec(cron)) !== null) {
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_WEEK,
|
type: CronType.EVERY_WEEK,
|
||||||
value: parseInt(value[1] ?? ""),
|
value: parseInt(value[1] ?? ""),
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
} else if ((value = /^0 0 (\d+) \* \*$/i.exec(cron)) !== null) {
|
} else if ((value = /^0 0 (\d+) \* \*$/i.exec(cron)) !== null) {
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_MONTH,
|
type: CronType.EVERY_MONTH,
|
||||||
value: parseInt(value[1] ?? ""),
|
value: parseInt(value[1] ?? ""),
|
||||||
|
date: null,
|
||||||
|
};
|
||||||
|
} else if ((value = /^0 0 L \* \*$/i.exec(cron)) !== null) {
|
||||||
|
return {
|
||||||
|
type: CronType.EVERY_MONTH,
|
||||||
|
value: 32,
|
||||||
|
date: null,
|
||||||
|
};
|
||||||
|
} else if ((value = /^0 0 \* \* (\d+)#1$/i.exec(cron)) !== null) {
|
||||||
|
return {
|
||||||
|
type: CronType.EVERY_MONTH,
|
||||||
|
value: -parseInt(value[1] ?? ""),
|
||||||
|
date: null,
|
||||||
|
};
|
||||||
|
} else if ((value = /^0 0 \* \* (\d+)L$/i.exec(cron)) !== null) {
|
||||||
|
return {
|
||||||
|
type: CronType.EVERY_MONTH,
|
||||||
|
value: -parseInt(value[1] ?? "") - 7,
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
} else if ((value = /^0 0 1 (\d+) \*$/i.exec(cron)) !== null) {
|
} else if ((value = /^0 0 1 (\d+) \*$/i.exec(cron)) !== null) {
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_YEAR,
|
type: CronType.EVERY_YEAR,
|
||||||
value: parseInt(value[1] ?? ""),
|
value: parseInt(value[1] ?? ""),
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
type: CronType.CUSTOM,
|
type: CronType.CUSTOM,
|
||||||
value: 0,
|
value: 0,
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isRrule(cron: string): boolean {
|
||||||
|
return cron.startsWith("RRULE:") || cron.startsWith("DTSTART:");
|
||||||
|
}
|
||||||
|
|
||||||
export function parseRrule(rule: string): {
|
export function parseRrule(rule: string): {
|
||||||
type: CronType;
|
type: CronType;
|
||||||
value: number;
|
value: number;
|
||||||
|
date: Date | null;
|
||||||
} {
|
} {
|
||||||
try {
|
try {
|
||||||
const rrule = RRule.parseString(rule);
|
const rrule = RRule.parseString(rule);
|
||||||
@@ -60,21 +91,25 @@ export function parseRrule(rule: string): {
|
|||||||
return {
|
return {
|
||||||
type: CronType.EVERY_N_MONTHS,
|
type: CronType.EVERY_N_MONTHS,
|
||||||
value: (rrule.interval ?? 1) * 12,
|
value: (rrule.interval ?? 1) * 12,
|
||||||
|
date: rrule.dtstart ?? null,
|
||||||
};
|
};
|
||||||
case RRule.MONTHLY:
|
case RRule.MONTHLY:
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_N_MONTHS,
|
type: CronType.EVERY_N_MONTHS,
|
||||||
value: rrule.interval ?? 1,
|
value: rrule.interval ?? 1,
|
||||||
|
date: rrule.dtstart ?? null,
|
||||||
};
|
};
|
||||||
case RRule.WEEKLY:
|
case RRule.WEEKLY:
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_N_WEEKS,
|
type: CronType.EVERY_N_WEEKS,
|
||||||
value: rrule.interval ?? 1,
|
value: rrule.interval ?? 1,
|
||||||
|
date: rrule.dtstart ?? null,
|
||||||
};
|
};
|
||||||
case RRule.DAILY:
|
case RRule.DAILY:
|
||||||
return {
|
return {
|
||||||
type: CronType.EVERY_N_DAYS,
|
type: CronType.EVERY_N_DAYS,
|
||||||
value: rrule.interval ?? 1,
|
value: rrule.interval ?? 1,
|
||||||
|
date: rrule.dtstart ?? null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@@ -83,22 +118,33 @@ export function parseRrule(rule: string): {
|
|||||||
return {
|
return {
|
||||||
type: CronType.MANUAL,
|
type: CronType.MANUAL,
|
||||||
value: 0,
|
value: 0,
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCron(
|
export function getCron(
|
||||||
type: CronType,
|
type: CronType,
|
||||||
value: number,
|
value: number,
|
||||||
|
date: Date,
|
||||||
fallback: string,
|
fallback: string,
|
||||||
): string | null {
|
): string | null {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CronType.ONE_TIME:
|
case CronType.ONE_TIME:
|
||||||
return ONE_TIME_VALUE;
|
return ONE_TIME_VALUE;
|
||||||
case CronType.EVERY_DAY:
|
case CronType.EVERY_DAY:
|
||||||
return `0 ${value.toFixed(0)} * * *`;
|
return `0 0 * * *`;
|
||||||
case CronType.EVERY_WEEK:
|
case CronType.EVERY_WEEK:
|
||||||
return `0 0 * * ${value.toFixed(0)}`;
|
return `0 0 * * ${value.toFixed(0)}`;
|
||||||
case CronType.EVERY_MONTH:
|
case CronType.EVERY_MONTH:
|
||||||
|
if (value === 32) {
|
||||||
|
return `0 0 L * *`;
|
||||||
|
}
|
||||||
|
if (value < 0 && value >= -7) {
|
||||||
|
return `0 0 * * ${(-value).toFixed(0)}#1`;
|
||||||
|
}
|
||||||
|
if (value < -7 && value >= -14) {
|
||||||
|
return `0 0 * * ${(-value - 7).toFixed(0)}L`;
|
||||||
|
}
|
||||||
return `0 0 ${value.toFixed(0)} * *`;
|
return `0 0 ${value.toFixed(0)} * *`;
|
||||||
case CronType.EVERY_YEAR:
|
case CronType.EVERY_YEAR:
|
||||||
return `0 0 1 ${value.toFixed(0)} *`;
|
return `0 0 1 ${value.toFixed(0)} *`;
|
||||||
@@ -106,16 +152,19 @@ export function getCron(
|
|||||||
return new RRule({
|
return new RRule({
|
||||||
freq: RRule.MONTHLY,
|
freq: RRule.MONTHLY,
|
||||||
interval: value,
|
interval: value,
|
||||||
|
dtstart: date,
|
||||||
}).toString();
|
}).toString();
|
||||||
case CronType.EVERY_N_WEEKS:
|
case CronType.EVERY_N_WEEKS:
|
||||||
return new RRule({
|
return new RRule({
|
||||||
freq: RRule.WEEKLY,
|
freq: RRule.WEEKLY,
|
||||||
interval: value,
|
interval: value,
|
||||||
|
dtstart: date,
|
||||||
}).toString();
|
}).toString();
|
||||||
case CronType.EVERY_N_DAYS:
|
case CronType.EVERY_N_DAYS:
|
||||||
return new RRule({
|
return new RRule({
|
||||||
freq: RRule.DAILY,
|
freq: RRule.DAILY,
|
||||||
interval: value,
|
interval: value,
|
||||||
|
dtstart: date,
|
||||||
}).toString();
|
}).toString();
|
||||||
case CronType.CUSTOM:
|
case CronType.CUSTOM:
|
||||||
if (validCron(fallback)) {
|
if (validCron(fallback)) {
|
||||||
@@ -140,23 +189,22 @@ export function validCron(cron: string): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function nextCronReset(
|
export function nextCronReset(
|
||||||
date: Date | null,
|
date: Date,
|
||||||
cron: string | null,
|
cron: string | null,
|
||||||
hash: string,
|
hash: string,
|
||||||
): Date | null {
|
): Date | null {
|
||||||
if (date === null || cron === null || isOneTime(cron)) {
|
if (cron === null || isOneTime(cron)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (cron.startsWith("RRULE:")) {
|
if (isRrule(cron)) {
|
||||||
try {
|
try {
|
||||||
const rule = new RRule({
|
const rule = new RRule({
|
||||||
...RRule.parseString(cron),
|
...RRule.parseString(cron),
|
||||||
dtstart: date,
|
|
||||||
count: 2,
|
count: 2,
|
||||||
});
|
});
|
||||||
|
|
||||||
return rule.all()[1] ?? null;
|
return rule.after(date) ?? null;
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-39
@@ -35,65 +35,77 @@ export function isTemporary(task: Task): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function taskNextReset(task: Task): Date | null {
|
export function taskNextReset(task: Task): Date | null {
|
||||||
return nextCronReset(task.check_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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function taskSortReset(task: Task): Date | null {
|
||||||
|
let resetDate = taskNextReset(task);
|
||||||
|
while (resetDate !== null && resetDate.getTime() < new Date().getTime()) {
|
||||||
|
resetDate = nextCronReset(resetDate, task.reset_cron, task.id);
|
||||||
|
}
|
||||||
|
return resetDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function taskCompleted(task: Task): boolean {
|
export function taskCompleted(task: Task): boolean {
|
||||||
|
if (task.check_date === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const nextReset = taskNextReset(task);
|
const nextReset = taskNextReset(task);
|
||||||
if (nextReset === null) {
|
if (nextReset === null) {
|
||||||
return task.check_date !== null;
|
return true;
|
||||||
}
|
}
|
||||||
return nextReset.getTime() > new Date().getTime();
|
return nextReset.getTime() > new Date().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sortTasks(
|
export function fallbackDate(task: Task): Date {
|
||||||
tasks: Task[],
|
return new Date(
|
||||||
|
(task.check_date ?? task.created_at).getFullYear() + 100,
|
||||||
|
(task.check_date ?? task.created_at).getMonth(),
|
||||||
|
(task.check_date ?? task.created_at).getDate(),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function taskSortFunction(
|
||||||
sortType: SortType,
|
sortType: SortType,
|
||||||
reverse: boolean,
|
reverse: boolean,
|
||||||
): Task[] {
|
): (a: Task, b: Task) => number {
|
||||||
switch (sortType) {
|
switch (sortType) {
|
||||||
case SortType.CREATED_AT:
|
case SortType.CREATED_AT:
|
||||||
return tasks
|
return (a: Task, b: Task) =>
|
||||||
.slice()
|
|
||||||
.sort(
|
|
||||||
(a: Task, b: Task) =>
|
|
||||||
(reverse ? -1 : 1) *
|
(reverse ? -1 : 1) *
|
||||||
(a.created_at.getTime() - b.created_at.getTime()),
|
(a.created_at.getTime() - b.created_at.getTime());
|
||||||
);
|
|
||||||
case SortType.UPDATED_AT:
|
case SortType.UPDATED_AT:
|
||||||
return tasks
|
return (a: Task, b: Task) =>
|
||||||
.slice()
|
|
||||||
.sort(
|
|
||||||
(a: Task, b: Task) =>
|
|
||||||
(reverse ? -1 : 1) *
|
(reverse ? -1 : 1) *
|
||||||
(a.updated_at.getTime() - b.updated_at.getTime()),
|
(a.updated_at.getTime() - b.updated_at.getTime());
|
||||||
);
|
|
||||||
case SortType.CHECK_DATE:
|
case SortType.CHECK_DATE:
|
||||||
return tasks
|
return (a: Task, b: Task) =>
|
||||||
.slice()
|
|
||||||
.sort(
|
|
||||||
(a: Task, b: Task) =>
|
|
||||||
(reverse ? -1 : 1) *
|
(reverse ? -1 : 1) *
|
||||||
((a.check_date ?? a.created_at).getTime() -
|
((a.check_date ?? fallbackDate(a)).getTime() -
|
||||||
(b.check_date ?? b.created_at).getTime()),
|
(b.check_date ?? fallbackDate(b)).getTime());
|
||||||
);
|
|
||||||
case SortType.RESET_DATE:
|
case SortType.RESET_DATE:
|
||||||
return tasks
|
return (a: Task, b: Task) =>
|
||||||
.slice()
|
|
||||||
.sort(
|
|
||||||
(a: Task, b: Task) =>
|
|
||||||
(reverse ? -1 : 1) *
|
(reverse ? -1 : 1) *
|
||||||
(taskNextReset(a) ?? a.created_at).getTime() -
|
((taskSortReset(a) ?? fallbackDate(a)).getTime() -
|
||||||
(taskNextReset(b) ?? b.created_at).getTime(),
|
(taskSortReset(b) ?? fallbackDate(b)).getTime());
|
||||||
);
|
|
||||||
case SortType.NAME:
|
case SortType.NAME:
|
||||||
return tasks
|
return (a: Task, b: Task) =>
|
||||||
.slice()
|
(reverse ? -1 : 1) * a.name.localeCompare(b.name);
|
||||||
.sort(
|
|
||||||
(a: Task, b: Task) =>
|
|
||||||
(reverse ? -1 : 1) * a.name.localeCompare(b.name),
|
|
||||||
);
|
|
||||||
default:
|
|
||||||
return tasks.slice();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
import { useListStore } from "@/stores/lists";
|
import { useListStore } from "@/stores/lists";
|
||||||
import { ArrowBigRightDashIcon, DicesIcon, HistoryIcon } from "@lucide/vue";
|
import { ArrowBigRightDashIcon, DicesIcon, HistoryIcon } from "@lucide/vue";
|
||||||
import { generateSlug } from "random-word-slugs";
|
import { generateSlug } from "random-word-slugs";
|
||||||
import { defineAsyncComponent, onBeforeMount, ref } from "vue";
|
import { onBeforeMount, ref } from "vue";
|
||||||
import { onBeforeRouteUpdate } from "vue-router";
|
import { onBeforeRouteUpdate } from "vue-router";
|
||||||
const RecentItem = defineAsyncComponent(
|
import RecentItem from "@/components/RecentItem.vue";
|
||||||
() => import("@/components/RecentItem.vue"),
|
|
||||||
);
|
|
||||||
|
|
||||||
const listNameInput = ref<string>(generateSlug(4));
|
const listNameInput = ref<string>(generateSlug(4));
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onBeforeMount, computed, defineAsyncComponent } from "vue";
|
import { ref, onBeforeMount, computed } from "vue";
|
||||||
import type { Task } from "@/types";
|
import type { Task } from "@/types";
|
||||||
import { getTasks, createTask, deleteTask } from "@/api/tasks";
|
import { getTasks, createTask, deleteTask } from "@/api/tasks";
|
||||||
import {
|
import {
|
||||||
CirclePlusIcon,
|
CirclePlusIcon,
|
||||||
ArrowDownUpIcon,
|
|
||||||
Settings2Icon,
|
|
||||||
CircleCheckBigIcon,
|
CircleCheckBigIcon,
|
||||||
CheckCheckIcon,
|
CheckCheckIcon,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
Share2Icon,
|
Share2Icon,
|
||||||
} from "@lucide/vue";
|
} from "@lucide/vue";
|
||||||
const TaskItem = defineAsyncComponent(
|
import TaskItem from "@/components/TaskItem.vue";
|
||||||
() => import("@/components/TaskItem.vue"),
|
import ListOptions from "@/components/ListOptions.vue";
|
||||||
);
|
import { taskCompleted, taskSortFunction, newTemporaryTask } from "@/lib/tasks";
|
||||||
import { taskCompleted, sortTasks, newTemporaryTask } from "@/lib/tasks";
|
|
||||||
import { SortType } from "@/enums";
|
import { SortType } from "@/enums";
|
||||||
import { booleanCookieRef, enumCookieRef } from "@/lib/cookies";
|
import { booleanCookieRef, enumCookieRef } from "@/lib/cookies";
|
||||||
import { useAlertStore } from "@/stores/alerts";
|
import { useAlertStore } from "@/stores/alerts";
|
||||||
@@ -36,6 +33,7 @@ const sortReverse = booleanCookieRef("sortReverse", false);
|
|||||||
const showLastChecked = booleanCookieRef("showLastChecked", false);
|
const showLastChecked = booleanCookieRef("showLastChecked", false);
|
||||||
const showNextReset = booleanCookieRef("showNextReset", false);
|
const showNextReset = booleanCookieRef("showNextReset", false);
|
||||||
const separateCompleted = booleanCookieRef("separateCompleted", true);
|
const separateCompleted = booleanCookieRef("separateCompleted", true);
|
||||||
|
const showMissed = booleanCookieRef("showMissed", true);
|
||||||
|
|
||||||
const completedCount = computed<number>(
|
const completedCount = computed<number>(
|
||||||
() => tasks.value.filter(taskCompleted).length,
|
() => tasks.value.filter(taskCompleted).length,
|
||||||
@@ -77,7 +75,7 @@ function fetchTasks(requestedList: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reSortTasks(update = false) {
|
function reSortTasks(update = false) {
|
||||||
tasks.value = sortTasks(tasks.value, sortType.value, sortReverse.value);
|
tasks.value.sort(taskSortFunction(sortType.value, sortReverse.value));
|
||||||
if (update) {
|
if (update) {
|
||||||
updateTitle();
|
updateTitle();
|
||||||
if (tasks.value.length && list.value) {
|
if (tasks.value.length && list.value) {
|
||||||
@@ -146,14 +144,6 @@ function onDeleteTask(task: Task) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChangeSortType() {
|
|
||||||
reSortTasks();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onChangeSortReverse() {
|
|
||||||
reSortTasks();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onShare() {
|
function onShare() {
|
||||||
if (!empty.value) {
|
if (!empty.value) {
|
||||||
shareLink(
|
shareLink(
|
||||||
@@ -229,6 +219,7 @@ onBeforeRouteLeave(() => {
|
|||||||
v-model="tasks[i]"
|
v-model="tasks[i]"
|
||||||
:show-last-checked="showLastChecked"
|
:show-last-checked="showLastChecked"
|
||||||
:show-next-reset="showNextReset"
|
:show-next-reset="showNextReset"
|
||||||
|
:show-missed="showMissed"
|
||||||
@updated="onUpdateTask"
|
@updated="onUpdateTask"
|
||||||
@clone="onCloneTask"
|
@clone="onCloneTask"
|
||||||
@delete="onDeleteTask"
|
@delete="onDeleteTask"
|
||||||
@@ -256,6 +247,7 @@ onBeforeRouteLeave(() => {
|
|||||||
v-model="tasks[i]"
|
v-model="tasks[i]"
|
||||||
:show-last-checked="showLastChecked"
|
:show-last-checked="showLastChecked"
|
||||||
:show-next-reset="showNextReset"
|
:show-next-reset="showNextReset"
|
||||||
|
:show-missed="showMissed"
|
||||||
@clone="onCloneTask"
|
@clone="onCloneTask"
|
||||||
@delete="onDeleteTask"
|
@delete="onDeleteTask"
|
||||||
/>
|
/>
|
||||||
@@ -281,76 +273,15 @@ onBeforeRouteLeave(() => {
|
|||||||
<circle-plus-icon />
|
<circle-plus-icon />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<list-options
|
||||||
v-if="!empty"
|
v-if="!empty"
|
||||||
class="mt-4 -mb-4 collapse collapse-arrow font-light text-sm"
|
v-model:sort-type="sortType"
|
||||||
>
|
v-model:sort-reverse="sortReverse"
|
||||||
<input id="options-dropdown p-0" type="checkbox" />
|
v-model:show-last-checked="showLastChecked"
|
||||||
<div class="collapse-title p-0 content-center">
|
v-model:show-next-reset="showNextReset"
|
||||||
<settings-2-icon class="inline" :size="16" />
|
v-model:separate-completed="separateCompleted"
|
||||||
{{ $t("options.title") }}
|
v-model:show-missed="showMissed"
|
||||||
</div>
|
class="mt-4 -mb-4"
|
||||||
<div class="collapse-content">
|
@change-sort="reSortTasks"
|
||||||
<fieldset class="fieldset flex flex-col gap-2">
|
|
||||||
<label class="label">
|
|
||||||
<arrow-down-up-icon class="inline" />
|
|
||||||
{{ $t("options.sort_by") }}
|
|
||||||
<select
|
|
||||||
v-model="sortType"
|
|
||||||
class="select"
|
|
||||||
@change="onChangeSortType"
|
|
||||||
>
|
|
||||||
<option :value="SortType.CREATED_AT">
|
|
||||||
{{ $t("options.sort.created_at") }}
|
|
||||||
</option>
|
|
||||||
<option :value="SortType.UPDATED_AT">
|
|
||||||
{{ $t("options.sort.updated_at") }}
|
|
||||||
</option>
|
|
||||||
<option :value="SortType.CHECK_DATE">
|
|
||||||
{{ $t("options.sort.check_date") }}
|
|
||||||
</option>
|
|
||||||
<option :value="SortType.RESET_DATE">
|
|
||||||
{{ $t("options.sort.reset_date") }}
|
|
||||||
</option>
|
|
||||||
<option :value="SortType.NAME">
|
|
||||||
{{ $t("options.sort.name") }}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<label class="label">
|
|
||||||
<input
|
|
||||||
v-model="sortReverse"
|
|
||||||
type="checkbox"
|
|
||||||
class="checkbox"
|
|
||||||
@change="onChangeSortReverse"
|
|
||||||
/>
|
/>
|
||||||
{{ $t("options.reverse_sort") }}
|
|
||||||
</label>
|
|
||||||
<label class="label">
|
|
||||||
<input
|
|
||||||
v-model="showLastChecked"
|
|
||||||
type="checkbox"
|
|
||||||
class="checkbox"
|
|
||||||
/>
|
|
||||||
{{ $t("options.last_checked") }}
|
|
||||||
</label>
|
|
||||||
<label class="label">
|
|
||||||
<input
|
|
||||||
v-model="showNextReset"
|
|
||||||
type="checkbox"
|
|
||||||
class="checkbox"
|
|
||||||
/>
|
|
||||||
{{ $t("options.next_reset") }}
|
|
||||||
</label>
|
|
||||||
<label class="label">
|
|
||||||
<input
|
|
||||||
v-model="separateCompleted"
|
|
||||||
type="checkbox"
|
|
||||||
class="checkbox"
|
|
||||||
/>
|
|
||||||
{{ $t("options.separate_completed") }}
|
|
||||||
</label>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ asyncpg = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tout-doux"
|
name = "tout-doux"
|
||||||
version = "1.5.0"
|
version = "1.7.6"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "flask", extra = ["async"] },
|
{ name = "flask", extra = ["async"] },
|
||||||
|
|||||||
Reference in New Issue
Block a user