Author SHA1 Message Date
klemek 41e94c8bcb chore: 1.2.0
Python Lint CI / ruff (push) Successful in 6m27s
Python Lint CI / ty (push) Successful in 9m24s
Python Lint CI / ruff-format-check (push) Successful in 10m28s
TS Lint / ESLint (push) Successful in 11m35s
Docker Build / build (push) Successful in 19m33s
TS Lint / Oxlint (push) Successful in 10m26s
TS Lint / TypeScript (push) Successful in 9m7s
2026-07-16 11:47:43 +02:00
klemek 765f3e1f8a feat: title as menu link and updated lists history
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-16 11:47:35 +02:00
klemek fb48f64ed8 fix: paddings and margins
TS Lint / Oxlint (push) Successful in 57s
TS Lint / TypeScript (push) Successful in 1m8s
TS Lint / ESLint (push) Successful in 1m28s
Docker Build / build (push) Successful in 8m40s
2026-07-16 11:28:18 +02:00
klemek 5ae0684d39 chore: 1.1.0
Python Lint CI / ruff (push) Successful in 6m31s
Python Lint CI / ruff-format-check (push) Successful in 6m46s
Python Lint CI / ty (push) Successful in 6m58s
TS Lint / ESLint (push) Successful in 6m6s
TS Lint / TypeScript (push) Successful in 5m55s
TS Lint / Oxlint (push) Successful in 5m56s
Docker Build / build (push) Successful in 13m56s
2026-07-15 16:34:53 +02:00
klemek ea9a50a2f7 feat: recent lists
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-15 16:34:37 +02:00
klemek 5e60b5ad20 feat: hide unnecessary options at first
TS Lint / ESLint (push) Successful in 3m55s
TS Lint / TypeScript (push) Successful in 4m45s
TS Lint / Oxlint (push) Successful in 4m45s
Docker Build / build (push) Successful in 8m53s
2026-07-15 16:10:06 +02:00
klemek f811facff8 feat: add titles to icon-only buttons
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-15 16:08:52 +02:00
klemek db9ecb4773 fix: preview
TS Lint / Oxlint (push) Successful in 3m42s
TS Lint / ESLint (push) Successful in 3m42s
TS Lint / TypeScript (push) Successful in 3m44s
Docker Build / build (push) Successful in 9m19s
2026-07-15 15:49:34 +02:00
klemek 51801f67f9 fix: animated background 2026-07-15 15:49:29 +02:00
klemek fe41547ced fix: better preview 2026-07-15 15:22:05 +02:00
klemek e87068e379 chore: 1.0.5
Python Lint CI / ruff (push) Successful in 13m5s
Python Lint CI / ruff-format-check (push) Successful in 12m36s
Python Lint CI / ty (push) Successful in 8m48s
Docker Build / build (push) Successful in 18m24s
TS Lint / Oxlint (push) Successful in 6m1s
TS Lint / ESLint (push) Successful in 6m22s
TS Lint / TypeScript (push) Successful in 3m26s
2026-07-15 15:12:32 +02:00
klemek cc856c3402 fix: better preview shot
Docker Build / build (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
2026-07-15 15:12:13 +02:00
klemek b24f3bb656 fix: animated background compatibility 2026-07-15 15:11:28 +02:00
klemek cf2f48c84c feat: move new task bar below completed 2026-07-15 15:04:32 +02:00
klemek 0f5f3b2fc5 feat: animated background
TS Lint / Oxlint (push) Successful in 54s
TS Lint / TypeScript (push) Successful in 1m3s
TS Lint / ESLint (push) Successful in 1m4s
Docker Build / build (push) Successful in 9m19s
2026-07-15 15:00:15 +02:00
klemek 3a40b06354 chore: 1.0.4
Python Lint CI / ruff (push) Failing after 1m45s
Python Lint CI / ruff-format-check (push) Successful in 4m11s
Python Lint CI / ty (push) Successful in 6m6s
TS Lint / ESLint (push) Successful in 4m53s
Docker Build / build (push) Successful in 10m12s
TS Lint / Oxlint (push) Successful in 6m46s
TS Lint / TypeScript (push) Successful in 5m59s
2026-07-14 19:17:43 +02:00
klemek 117d3a2029 fix: initial loading of list
Docker Build / build (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-14 19:17:38 +02:00
klemek 478091b0ba chore: 1.0.3
Python Lint CI / ruff (push) Successful in 3m12s
Python Lint CI / ty (push) Successful in 8m28s
Python Lint CI / ruff-format-check (push) Successful in 8m46s
TS Lint / ESLint (push) Successful in 7m22s
TS Lint / Oxlint (push) Failing after 2m3s
TS Lint / TypeScript (push) Successful in 2m8s
Docker Build / build (push) Successful in 11m59s
2026-07-14 18:17:58 +02:00
klemek 08b3b06089 feat: better task item name input
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-14 18:17:50 +02:00
klemek 1c7d38fc15 chore: 1.0.2
Python Lint CI / ruff-format-check (push) Successful in 5m3s
Python Lint CI / ruff (push) Successful in 5m4s
Python Lint CI / ty (push) Successful in 4m29s
Docker Build / build (push) Successful in 9m50s
TS Lint / ESLint (push) Successful in 6m54s
TS Lint / Oxlint (push) Successful in 6m57s
TS Lint / TypeScript (push) Successful in 6m43s
2026-07-14 17:44:58 +02:00
klemek 350da88802 fix: max limit on list name
Docker Build / build (push) Has been cancelled
Python Lint CI / ruff (push) Has been cancelled
Python Lint CI / ruff-format-check (push) Has been cancelled
Python Lint CI / ty (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-14 17:44:52 +02:00
klemek 29cdf7bb7e fix: remove uselesse EXPOSE 2026-07-14 17:37:22 +02:00
klemek 105a879948 chore: 1.0.1
Python Lint CI / ruff (push) Successful in 3m24s
Python Lint CI / ruff-format-check (push) Successful in 3m52s
Python Lint CI / ty (push) Successful in 6m27s
Docker Build / build (push) Successful in 9m12s
TS Lint / ESLint (push) Successful in 6m30s
TS Lint / Oxlint (push) Successful in 5m37s
TS Lint / TypeScript (push) Successful in 3m30s
2026-07-14 17:32:28 +02:00
klemek 1b972ad65b fix: build with public folder 2026-07-14 17:32:18 +02:00
24 changed files with 371 additions and 159 deletions
+1 -1
View File
@@ -7,6 +7,7 @@ COPY *.json bun.lock ./
RUN bun ci RUN bun ci
COPY *.ts index.html ./ COPY *.ts index.html ./
COPY public ./public
COPY resources ./resources COPY resources ./resources
RUN bun run build RUN bun run build
@@ -24,7 +25,6 @@ RUN uv pip install . --system
ENV APP_ENV=production ENV APP_ENV=production
ENV PORT=5000 ENV PORT=5000
EXPOSE ${PORT}
ENV BIND=0.0.0.0 ENV BIND=0.0.0.0
COPY --from=front-end /app/dist ./dist COPY --from=front-end /app/dist ./dist
+2 -1
View File
@@ -155,7 +155,8 @@ docker-build: ## docker build
.PHONY: docker-run .PHONY: docker-run
docker-run: ## docker run docker-run: ## docker run
$(DOCKER) run -p $(PORT):5000 -v db.sqlite:/app/db.sqlite $(DOCKER_TAG) touch db.sqlite
$(DOCKER) run -p $(PORT):5000 -v $(PWD)/db.sqlite:/app/db.sqlite $(DOCKER_TAG)
.PHONY: tortoise-% .PHONY: tortoise-%
tortoise-%: .venv ## tortoise (command) tortoise-%: .venv ## tortoise (command)
+2
View File
@@ -4,6 +4,8 @@
> A shareable task list with auto resetting items. > A shareable task list with auto resetting items.
![](./public/assets/preview.jpg)
**[todo.klemek.fr](https://todo.klemek.fr)** **[todo.klemek.fr](https://todo.klemek.fr)**
## Running your own ## Running your own
+21
View File
@@ -0,0 +1,21 @@
from tortoise import migrations
from tortoise.migrations import operations as ops
from tortoise import fields
class Migration(migrations.Migration):
dependencies = [('models', '0001_initial')]
initial = False
operations = [
ops.AlterField(
model_name='Task',
name='list_name',
field=fields.CharField(db_index=True, max_length=128),
),
ops.AlterField(
model_name='Task',
name='reset_cron',
field=fields.CharField(null=True, max_length=64),
),
]
+1 -1
View File
@@ -10,7 +10,7 @@ CRONTAB_REGEX = r"^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@eve
class Task(AbstractModel): class Task(AbstractModel):
list_name = tortoise.fields.CharField(max_length=32, db_index=True, null=False) list_name = tortoise.fields.CharField(max_length=128, db_index=True, null=False)
name = tortoise.fields.TextField(null=False) name = tortoise.fields.TextField(null=False)
reset_cron = tortoise.fields.CharField( reset_cron = tortoise.fields.CharField(
max_length=64, max_length=64,
+2 -2
View File
@@ -58,13 +58,13 @@ class Server(gunicorn.app.base.BaseApplication):
@self.app.route("/api/lists/<list_name>/tasks", methods=["GET"]) @self.app.route("/api/lists/<list_name>/tasks", methods=["GET"])
async def get_tasks(list_name: str) -> list: async def get_tasks(list_name: str) -> list:
return await Task.filter(list_name=list_name).values() return await Task.filter(list_name=list_name[:128]).values()
@self.app.route("/api/lists/<list_name>/tasks", methods=["POST"]) @self.app.route("/api/lists/<list_name>/tasks", methods=["POST"])
async def post_task(list_name: str) -> typing.Any: async def post_task(list_name: str) -> typing.Any:
data = flask.request.get_json() data = flask.request.get_json()
logging.getLogger(self.__class__.__name__).info("%s", data) logging.getLogger(self.__class__.__name__).info("%s", data)
data["list_name"] = list_name data["list_name"] = list_name[:128]
parsed_data = Task.validate_create(data) parsed_data = Task.validate_create(data)
if parsed_data is None: if parsed_data is None:
flask.abort(400) flask.abort(400)
+1 -1
View File
@@ -16,7 +16,7 @@
<!-- card related --> <!-- card related -->
<meta property="og:title" content="{{ title }}"> <meta property="og:title" content="{{ title }}">
<meta property="og:description" content="{{ lang('home') }}"> <meta property="og:description" content="{{ lang('home') }}">
<meta property="og:image" content="{{ app_url }}/assets/favicon-96x96.jpg"> <meta property="og:image" content="{{ app_url }}/assets/preview.jpg">
<meta property="og:url" content="{{ app_url }}/{{ path }}"> <meta property="og:url" content="{{ app_url }}/{{ path }}">
<script <script
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "tout-doux", "name": "tout-doux",
"version": "1.0.0", "version": "1.2.0",
"private": true, "private": true,
"type": "module", "type": "module",
"engines": { "engines": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "tout-doux" name = "tout-doux"
version = "1.0.0" version = "1.2.0"
description = "" description = ""
requires-python = ">=3.14" requires-python = ">=3.14"
dependencies = [ dependencies = [
+35
View File
@@ -10,3 +10,38 @@ body {
font-style: normal; font-style: normal;
font-variation-settings: "wdth" 100; font-variation-settings: "wdth" 100;
} }
.bg-hero {
--size: 15vh;
--angle: 45deg;
background: repeating-linear-gradient(
var(--angle),
var(--color-base-200) 0%,
var(--color-base-200) 12.5%,
var(--color-secondary) 12.5%,
var(--color-secondary) 25%,
var(--color-base-200) 25%,
var(--color-base-200) 37.5%,
var(--color-accent) 37.5%,
var(--color-accent) 50%,
var(--color-base-200) 50%,
var(--color-base-200) 62.5%,
var(--color-secondary) 62.5%,
var(--color-secondary) 75%,
var(--color-base-200) 75%,
var(--color-base-200) 87.5%,
var(--color-accent) 87.5%,
var(--color-accent) 100%,
var(--color-base-200) 100%
);
background-repeat: repeat;
background-size: calc(var(--size) / sin(var(--angle)))
calc(var(--size) / sin(var(--angle)));
animation: BackgroundAnimate 10s linear infinite reverse;
}
@keyframes BackgroundAnimate {
0% {
background-position: calc(var(--size) / sin(var(--angle))) 0;
}
}
+7 -1
View File
@@ -78,5 +78,11 @@
"call_to_action": "Create your list below:", "call_to_action": "Create your list below:",
"home_button": "Let's go !", "home_button": "Let's go !",
"share_button": "Share my list", "share_button": "Share my list",
"share_text": "Check my list on Tout Doux!" "share_text": "Check my list on Tout Doux!",
"add_button": "Add task",
"cancel_button": "Cancel editing",
"save_button": "Save task",
"clone_button": "Clone task",
"delete_button": "Delete task",
"recent": "Recent lists"
} }
+7 -1
View File
@@ -78,5 +78,11 @@
"call_to_action": "Créez ta liste ci-dessous :", "call_to_action": "Créez ta liste ci-dessous :",
"home_button": "C'est parti !", "home_button": "C'est parti !",
"share_button": "Partager ma liste", "share_button": "Partager ma liste",
"share_text": "Regarde ma liste sur Tout Doux!" "share_text": "Regarde ma liste sur Tout Doux!",
"add_button": "Ajouter la tâche",
"cancel_button": "Annuler la modification",
"save_button": "Sauvegarder la tâche",
"clone_button": "Cloner la tâche",
"delete_button": "Supprimer la tâche",
"recent": "Listes récentes"
} }
+12 -6
View File
@@ -22,16 +22,22 @@ onMounted(() => {
:style="{ display: visible ? 'flex' : 'none' }" :style="{ display: visible ? 'flex' : 'none' }"
class="min-h-screen flex-col w-screen" class="min-h-screen flex-col w-screen"
> >
<div class="hero bg-base-200 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" class="max-w-md min-w-96 bg-base-100 rounded-box shadow-md p-4"
> >
<h1 <router-link
class="p-4 pb-2 text-4xl font-bold opacity-60 tracking-wide select-none" to="/"
class="text-4xl font-bold opacity-60 tracking-wide select-none"
> >
<list-todo-icon :stroke-width="3" :size="32" class="inline" /> Tout Doux <list-todo-icon
</h1> :stroke-width="3"
:size="32"
class="inline"
/>
Tout Doux
</router-link>
<router-view /> <router-view />
</div> </div>
</div> </div>
+2 -1
View File
@@ -2,7 +2,8 @@
import { ref, onBeforeMount, watch } from "vue"; import { ref, onBeforeMount, watch } from "vue";
import { getCron, parseCron, validCron } from "@/lib/cron"; import { getCron, parseCron, validCron } from "@/lib/cron";
import { CronType } from "@/enums"; import { CronType } from "@/enums";
import { DEFAULT_CRON } from "@/constants";
const DEFAULT_CRON = "0 0 * * *";
const cron = defineModel<string | null>({ required: true }); const cron = defineModel<string | null>({ required: true });
const rawCron = ref<string>(DEFAULT_CRON); const rawCron = ref<string>(DEFAULT_CRON);
+14
View File
@@ -0,0 +1,14 @@
<script setup lang="ts">
import { ArrowBigRightDashIcon } from "@lucide/vue";
defineProps<{ list: string }>();
</script>
<template>
<router-link
:to="`/${list}`"
class="w-full flex gap-2 mb-2 hover:underline"
>
<arrow-big-right-dash-icon :size="16" class="inline" /> {{ list }}
</router-link>
</template>
+69 -24
View File
@@ -1,5 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeMount, ref, watch, computed, defineAsyncComponent } from "vue"; import {
onBeforeMount,
ref,
watch,
computed,
defineAsyncComponent,
nextTick,
} 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";
@@ -11,7 +18,8 @@ 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";
const emit = defineEmits<(e: "clone" | "delete" | "updated", task: Task) => void>(); const emit =
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 }>();
@@ -20,6 +28,7 @@ const editMode = ref<boolean>(false);
const editName = ref<string>(""); const editName = ref<string>("");
const editCron = ref<string | null>(null); const editCron = ref<string | null>(null);
const refreshKey = ref<number>(0); const refreshKey = ref<number>(0);
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));
@@ -28,26 +37,36 @@ const i18n = useI18n();
const { alertSuccess, alertError } = useAlertStore(); const { alertSuccess, alertError } = useAlertStore();
async function onOpen() {
editMode.value = true;
await nextTick();
editNameInput.value?.focus();
}
function onClose() { function onClose() {
editName.value = task.value.name;
editCron.value = task.value.reset_cron;
editMode.value = false; editMode.value = false;
} }
function onSave() { function onSave() {
updateTask(task.value.id, { if (editName.value.trim()) {
name: editName.value, updateTask(task.value.id, {
reset_cron: editCron.value, name: editName.value.trim(),
}) reset_cron: editCron.value,
.then((newTask) => {
task.value = newTask;
emit("updated", newTask);
alertSuccess(i18n.t("alerts.task_updated"));
}) })
.catch(() => { .then((newTask) => {
alertError(i18n.t("alerts.task_update_error")); task.value = newTask;
}); emit("updated", newTask);
task.value.name = editName.value; alertSuccess(i18n.t("alerts.task_updated"));
task.value.reset_cron = editCron.value; })
editMode.value = false; .catch(() => {
alertError(i18n.t("alerts.task_update_error"));
});
task.value.name = editName.value;
task.value.reset_cron = editCron.value;
editMode.value = false;
}
} }
function onCheck() { function onCheck() {
@@ -105,7 +124,7 @@ watch(task, () => {
<template> <template>
<div class="list-row text-left"> <div class="list-row text-left">
<template v-if="!editMode"> <template v-if="!editMode">
<div class="content-center"> <div class="content-center">
<input <input
:id="refreshKey.toFixed(0)" :id="refreshKey.toFixed(0)"
@@ -117,7 +136,7 @@ watch(task, () => {
</div> </div>
<div <div
class="cursor-pointer text-lg select-none" class="cursor-pointer text-lg select-none"
@click.prevent="editMode = true" @click.prevent="onOpen"
> >
<div>{{ task.name }}</div> <div>{{ task.name }}</div>
<div <div
@@ -131,27 +150,53 @@ watch(task, () => {
v-if="showNextReset && checked && nextReset" v-if="showNextReset && checked && nextReset"
class="font-light text-xs italic" class="font-light text-xs italic"
> >
{{ $t("resets") }} {{ relativeTime(nextReset, $i18n.locale) }} {{ $t("resets") }}
{{ relativeTime(nextReset, $i18n.locale) }}
</div> </div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="list-col-grow flex flex-col gap-2"> <div class="list-col-grow flex flex-col gap-2">
<div class="flex justify-evenly"> <div class="flex justify-evenly">
<button class="btn btn-square me-1" @click="onClose"> <button
class="btn btn-square me-1"
:title="$t('cancel_button')"
@click="onClose"
>
<x-icon /> <x-icon />
</button> </button>
<button class="btn btn-square me-1" @click="onSave"> <button
class="btn btn-square me-1"
:class="
editName.trim().length === 0 ? 'btn-disabled' : ''
"
:title="$t('save_button')"
@click="onSave"
>
<save-icon /> <save-icon />
</button> </button>
<button class="btn btn-square me-1" @click="onClone"> <button
class="btn btn-square me-1"
:title="$t('clone_button')"
@click="onClone"
>
<copy-icon /> <copy-icon />
</button> </button>
<button class="btn btn-square" @click="onDelete"> <button
class="btn btn-square"
:title="$t('delete_button')"
@click="onDelete"
>
<trash-icon /> <trash-icon />
</button> </button>
</div> </div>
<input v-model="editName" type="text" class="input w-full" /> <input
ref="editNameInput"
v-model="editName"
type="text"
class="input w-full"
@keyup.enter="onSave"
/>
<cron-input v-model="editCron" :edit-mode="editMode" /> <cron-input v-model="editCron" :edit-mode="editMode" />
</div> </div>
</template> </template>
-1
View File
@@ -1 +0,0 @@
export const DEFAULT_CRON = "0 0 * * *";
+1 -1
View File
@@ -1,4 +1,4 @@
import { getCookie, setCookie } from "./cookies"; import { getCookie, setCookie } from "@/lib/cookies";
export function getLang() { export function getLang() {
const params = new URLSearchParams(document.location.search); const params = new URLSearchParams(document.location.search);
+25
View File
@@ -0,0 +1,25 @@
import { ref } from "vue";
import { defineStore } from "pinia";
import { getCookie, setCookie } from "@/lib/cookies";
const COOKIE_NAME = "recent-lists";
const MAX_RECENT_LISTS = 32;
export const useListStore = defineStore("lists", () => {
const lists = ref<string[]>([]);
const rawData = getCookie(COOKIE_NAME, "");
if (rawData) {
lists.value = rawData.split(",");
}
function addList(list: string) {
lists.value = [list]
.concat(lists.value)
.filter((v, i, a) => a.indexOf(v) === i)
.slice(0, MAX_RECENT_LISTS);
setCookie(COOKIE_NAME, lists.value.join(","));
}
return { lists, addList };
});
+49 -28
View File
@@ -1,11 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { ArrowBigRightDashIcon, DicesIcon } from "@lucide/vue"; import { useListStore } from "@/stores/lists";
import { ArrowBigRightDashIcon, DicesIcon, HistoryIcon } from "@lucide/vue";
import { generateSlug } from "random-word-slugs"; import { generateSlug } from "random-word-slugs";
import { onBeforeMount, ref } from "vue"; import { defineAsyncComponent, onBeforeMount, ref } from "vue";
import { onBeforeRouteUpdate } from "vue-router"; import { onBeforeRouteUpdate } from "vue-router";
const RecentItem = defineAsyncComponent(
() => import("@/components/RecentItem.vue"),
);
const listNameInput = ref<string>(generateSlug(4)); const listNameInput = ref<string>(generateSlug(4));
const { lists: recentLists } = useListStore();
function onRandom() { function onRandom() {
listNameInput.value = generateSlug(4); listNameInput.value = generateSlug(4);
} }
@@ -19,39 +25,54 @@ function onInput() {
} }
function updateTitle() { function updateTitle() {
document.title = 'Tout Doux'; document.title = "Tout Doux";
} }
onBeforeMount(updateTitle) onBeforeMount(updateTitle);
onBeforeRouteUpdate(updateTitle); onBeforeRouteUpdate(updateTitle);
</script> </script>
<template> <template>
<div class="p-4"> <div class="italic mt-4 text-xl font-extralight">
<div {{ $t("home") }}<br />{{ $t("call_to_action") }}
class="mb-4 italic text-xl font-extralight" </div>
>{{ $t('home') }}<br/>{{ $t('call_to_action') }}</div> <div class="flex gap-2 mt-4">
<div class="flex gap-2 mb-4"> <input
<input v-model="listNameInput"
v-model="listNameInput" type="text"
type="text" :placeholder="$t('new_task_hint')"
:placeholder="$t('new_task_hint')" class="input grow"
class="input grow" @input="onInput"
@input="onInput" />
/> <button class="btn btn-square" @click="onRandom">
<button class="btn btn-square" @click="onRandom"> <dices-icon />
<dices-icon /> </button>
</button> </div>
<div class="mt-4">
<router-link
class="btn btn-lg"
:class="listNameInput.trim().length === 0 ? 'btn-disabled' : ''"
:to="`/${listNameInput.trim()}`"
>
<arrow-big-right-dash-icon class="inline" />
{{ $t("home_button") }}
</router-link>
</div>
<div
v-if="recentLists.length"
class="mt-4 -mb-4 lh collapse collapse-arrow font-light text-sm"
>
<input id="recent-dropdown p-0" type="checkbox" />
<div class="collapse-title p-0 content-center">
<history-icon class="inline" :size="16" />
{{ $t("recent") }}
</div> </div>
<div class="w-full"> <div class="collapse-content">
<router-link <recent-item
class="btn btn-lg px-4" v-for="(list, i) in recentLists"
:class="listNameInput.trim().length === 0 ? 'btn-disabled' : ''" :key="`recent-${i}`"
:to="`/${listNameInput.trim()}`" :list="list"
> />
<arrow-big-right-dash-icon class="inline" />
{{ $t("home_button") }}
</router-link>
</div> </div>
</div> </div>
</template> </template>
+109 -81
View File
@@ -9,7 +9,7 @@ import {
CircleCheckBigIcon, CircleCheckBigIcon,
CheckCheckIcon, CheckCheckIcon,
SearchIcon, SearchIcon,
Share2Icon Share2Icon,
} from "@lucide/vue"; } from "@lucide/vue";
const TaskItem = defineAsyncComponent( const TaskItem = defineAsyncComponent(
() => import("@/components/TaskItem.vue"), () => import("@/components/TaskItem.vue"),
@@ -19,14 +19,17 @@ 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";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { onBeforeRouteUpdate, useRoute } from "vue-router"; import { onBeforeRouteLeave, onBeforeRouteUpdate, useRoute } from "vue-router";
import { shareLink } from "@/lib/share"; import { shareLink } from "@/lib/share";
import { useListStore } from "@/stores/lists";
const route = useRoute(); const route = useRoute();
const list = ref<string | null>(null); const list = ref<string | null>(null);
const loading = ref<boolean>(true);
const taskInput = ref<string>(""); const taskInput = ref<string>("");
const tasks = ref<Task[]>([]); const tasks = ref<Task[]>([]);
const refreshTimeout = ref<number>(0);
const sortType = enumCookieRef<SortType>("sSortType", SortType.CREATED_AT); const sortType = enumCookieRef<SortType>("sSortType", SortType.CREATED_AT);
const sortReverse = booleanCookieRef("sortReverse", false); const sortReverse = booleanCookieRef("sortReverse", false);
@@ -47,14 +50,21 @@ const allCompleted = computed<boolean>(
const i18n = useI18n(); const i18n = useI18n();
const { alertSuccess, alertError, alertWarning } = useAlertStore(); const { alertSuccess, alertError, alertWarning } = useAlertStore();
const { addList } = useListStore();
function fetchTasks() { function fetchTasks(requestedList: string) {
if (list.value) { const initialList = list.value;
if (list.value === requestedList) {
getTasks(list.value) getTasks(list.value)
.then((data: Task[]) => { .then((data: Task[]) => {
tasks.value = data; if (list.value === initialList) {
reSortTasks(); tasks.value = data;
setTimeout(fetchTasks, 10000); reSortTasks(true);
loading.value = false;
refreshTimeout.value = setTimeout(() => {
fetchTasks(list.value ?? "");
}, 10000);
}
}) })
.catch(() => { .catch(() => {
if (tasks.value.length !== 0) { if (tasks.value.length !== 0) {
@@ -66,20 +76,25 @@ function fetchTasks() {
} }
} }
function reSortTasks() { function reSortTasks(update = false) {
tasks.value = sortTasks(tasks.value, sortType.value, sortReverse.value); tasks.value = sortTasks(tasks.value, sortType.value, sortReverse.value);
updateTitle(); if (update) {
updateTitle();
if (tasks.value.length && list.value) {
addList(list.value);
}
}
} }
function onNewTask() { function onNewTask() {
if (taskInput.value.trim() && list.value) { if (taskInput.value.trim() && list.value && !loading.value) {
createTask(list.value, { createTask(list.value, {
name: taskInput.value.trim(), name: taskInput.value.trim(),
reset_cron: null, reset_cron: null,
}) })
.then((data: Task) => { .then((data: Task) => {
tasks.value.push(data); tasks.value.push(data);
reSortTasks(); reSortTasks(true);
alertSuccess(i18n.t("alerts.task_created")); alertSuccess(i18n.t("alerts.task_created"));
}) })
.catch(() => { .catch(() => {
@@ -91,6 +106,10 @@ function onNewTask() {
} }
} }
function onUpdateTask() {
reSortTasks(true);
}
function onCloneTask(task: Task) { function onCloneTask(task: Task) {
if (list.value) { if (list.value) {
createTask(list.value, { createTask(list.value, {
@@ -99,6 +118,7 @@ function onCloneTask(task: Task) {
}) })
.then((data: Task) => { .then((data: Task) => {
tasks.value.push(data); tasks.value.push(data);
reSortTasks(true);
alertSuccess(i18n.t("alerts.task_cloned")); alertSuccess(i18n.t("alerts.task_cloned"));
}) })
.catch(() => { .catch(() => {
@@ -110,6 +130,7 @@ function onCloneTask(task: Task) {
function onDeleteTask(task: Task) { function onDeleteTask(task: Task) {
deleteTask(task.id) deleteTask(task.id)
.then(() => { .then(() => {
reSortTasks(true);
alertSuccess(i18n.t("alerts.task_deleted")); alertSuccess(i18n.t("alerts.task_deleted"));
}) })
.catch(() => { .catch(() => {
@@ -128,105 +149,97 @@ function onChangeSortReverse() {
} }
function onShare() { function onShare() {
shareLink( if (!empty.value) {
`Tout Doux - ${list.value ?? ''}`, shareLink(
i18n.t('share_text'), `Tout Doux - ${list.value ?? ""}`,
`${document.location.href.split('?')[0] ?? ''}?lang=${i18n.locale.value}` i18n.t("share_text"),
) `${document.location.href.split("?")[0] ?? ""}?lang=${i18n.locale.value}`,
.then((viaShare) => { )
if (!viaShare) { .then((viaShare) => {
alertSuccess(i18n.t("alerts.share_clipboard")); if (!viaShare) {
} alertSuccess(i18n.t("alerts.share_clipboard"));
}) }
.catch(() => { })
alertError(i18n.t("alerts.share_error")) .catch(() => {
}); alertError(i18n.t("alerts.share_error"));
});
}
} }
function updateTitle() { function updateTitle() {
if (list.value !== null) { if (list.value !== null) {
document.title = `Tout Doux - ${list.value} (${completedCount.value.toFixed(0)}/${taskCount.value.toFixed(0)})` document.title = `Tout Doux - ${list.value} (${completedCount.value.toFixed(0)}/${taskCount.value.toFixed(0)})`;
} }
} }
onBeforeMount(() => { onBeforeMount(() => {
list.value = route.params.list as string; list.value = (route.params.list as string).slice(0, 128);
fetchTasks(); fetchTasks(list.value);
}); });
onBeforeRouteUpdate((to) => { onBeforeRouteUpdate((to) => {
list.value = to.params.list as string; list.value = (to.params.list as string).slice(0, 128);
fetchTasks(); fetchTasks(list.value);
});
onBeforeRouteLeave(() => {
clearTimeout(refreshTimeout.value);
}); });
</script> </script>
<template> <template>
<div class="list-row italic text-sm font-extralight self-center"> <div
class="list-row italic text-sm font-extralight self-center"
:class="!empty ? 'cursor-pointer hover:underline' : ''"
:title="!empty ? $t('share_button') : ''"
@click="onShare"
>
{{ list }} {{ list }}
<span v-if="taskCount">({{ completedCount }} / {{ taskCount }})</span> <span v-if="!empty"
>({{ completedCount }} / {{ taskCount }})&nbsp;<share-2-icon
class="inline"
:size="16"
:stroke-width="1"
/></span>
</div> </div>
<ul class="list"> <div
v-if="!loading && empty"
class="mt-4 mb-4 italic text-xl font-extralight"
>
<search-icon class="inline" />
<span v-html="$t('empty_hint')"></span>
</div>
<div
v-else-if="!loading && allCompleted && separateCompleted"
class="mt-4 mb-4 italic text-xl font-extralight"
>
<check-check-icon class="inline" />
<span v-html="$t('all_completed_hint')"></span>
</div>
<ul v-else class="list">
<template v-for="(task, i) in tasks" :key="task.id"> <template v-for="(task, i) in tasks" :key="task.id">
<li v-if="tasks[i] && (!separateCompleted || !taskCompleted(task))"> <li v-if="tasks[i] && (!separateCompleted || !taskCompleted(task))">
<task-item <task-item
v-model="tasks[i]" v-model="tasks[i]"
:show-last-checked="showLastChecked" :show-last-checked="showLastChecked"
:show-next-reset="showNextReset" :show-next-reset="showNextReset"
@updated="updateTitle" @updated="onUpdateTask"
@clone="onCloneTask" @clone="onCloneTask"
@delete="onDeleteTask" @delete="onDeleteTask"
/> />
</li> </li>
</template> </template>
<li
v-if="empty"
class="list-row italic text-xl font-extralight self-center"
>
<span
><search-icon class="inline" />
<span v-html="$t('empty_hint')"></span
></span>
</li>
<li
v-else-if="allCompleted && separateCompleted"
class="list-row italic text-xl font-extralight self-center"
>
<span
><check-check-icon class="inline" />
<span v-html="$t('all_completed_hint')"></span
></span>
</li>
<li class="list-row">
<div class="list-col-grow">
<input
v-model="taskInput"
type="text"
:placeholder="$t('new_task_hint')"
class="input w-full"
@keyup.enter="onNewTask"
/>
</div>
<div>
<button
class="btn btn-square"
:disabled="taskInput.trim().length === 0"
@click="onNewTask"
>
<circle-plus-icon />
</button>
</div>
</li>
</ul> </ul>
<div <div
v-if="separateCompleted && hasCompleted" v-if="separateCompleted && hasCompleted"
class="collapse collapse-arrow" class="collapse collapse-arrow mb-4"
> >
<input id="completed-dropdown" type="checkbox" /> <input id="completed-dropdown p-0" type="checkbox" />
<div class="collapse-title mb-0"> <div class="collapse-title p-0 content-center">
<circle-check-big-icon class="inline" :size="24" /> <circle-check-big-icon class="inline" :size="24" />
{{ $t("completed") }} ({{ completedCount }}) {{ $t("completed") }} ({{ completedCount }})
</div> </div>
<div class="collapse-content p-0"> <div class="collapse-content p-0 -mb-4">
<ul class="list"> <ul class="list">
<template <template
v-for="(task, i) in tasks" v-for="(task, i) in tasks"
@@ -245,14 +258,29 @@ onBeforeRouteUpdate((to) => {
</ul> </ul>
</div> </div>
</div> </div>
<div> <div class="flex gap-2">
<button class="btn btn-sm px-4" @click="onShare"> <input
<share-2-icon class="inline" :size="16" /> {{ $t('share_button') }} v-model="taskInput"
type="text"
:placeholder="$t('new_task_hint')"
class="input grow"
@keyup.enter="onNewTask"
/>
<button
class="btn btn-square"
:disabled="loading || taskInput.trim().length === 0"
:title="$t('add_button')"
@click="onNewTask"
>
<circle-plus-icon />
</button> </button>
</div> </div>
<div class="collapse collapse-arrow font-light text-sm"> <div
<input id="options-dropdown" type="checkbox" /> v-if="!empty"
<div class="collapse-title"> class="mt-4 -mb-4 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" /> <settings-2-icon class="inline" :size="16" />
{{ $t("options.title") }} {{ $t("options.title") }}
</div> </div>
+8 -6
View File
@@ -4,18 +4,20 @@ import { onBeforeMount } from "vue";
import { onBeforeRouteUpdate } from "vue-router"; import { onBeforeRouteUpdate } from "vue-router";
function updateTitle() { function updateTitle() {
document.title = 'Tout Doux - Not Found'; document.title = "Tout Doux - Not Found";
} }
onBeforeMount(updateTitle) onBeforeMount(updateTitle);
onBeforeRouteUpdate(updateTitle); onBeforeRouteUpdate(updateTitle);
</script> </script>
<template> <template>
<div class="italic text-xl font-extralight mb-4"> <div class="italic text-xl font-extralight mt-4">
<circle-question-mark-icon class="inline" /> {{ $t('not_found') }} <circle-question-mark-icon class="inline" /> {{ $t("not_found") }}
</div> </div>
<div class="w-full"> <div class="w-full mt-4">
<router-link to="/" class="btn mb-4 px-4">{{ $t('not_found_button') }}</router-link> <router-link to="/" class="btn">{{
$t("not_found_button")
}}</router-link>
</div> </div>
</template> </template>
Generated
+1 -1
View File
@@ -323,7 +323,7 @@ asyncpg = [
[[package]] [[package]]
name = "tout-doux" name = "tout-doux"
version = "1.0.0" version = "1.2.0"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "flask", extra = ["async"] }, { name = "flask", extra = ["async"] },