diff --git a/README.md b/README.md
index ceef665..843019f 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,10 @@
- [x] change lang
- [x] toasts
- [x] handle errors
-- [ ] list per URL
-- [ ] home screen
+- [x] list per URL
+- [x] home screen
+- [ ] share link
+- [ ] fill new list with "fill todo" item
- [x] lang in cookies
- [ ] simple view
- [ ] Dockerfile
diff --git a/bun.lock b/bun.lock
index f4923d0..286cb1b 100644
--- a/bun.lock
+++ b/bun.lock
@@ -9,6 +9,7 @@
"cron-parser": "^5.6.2",
"date-fns": "^4.4.0",
"pinia": "^3.0.4",
+ "random-word-slugs": "^0.1.7",
"vue": "^3.5.39",
"vue-i18n": "^11.4.6",
"vue-router": "^5.1.0",
@@ -715,6 +716,8 @@
"queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
+ "random-word-slugs": ["random-word-slugs@0.1.7", "", {}, "sha512-8cyzxOIDeLFvwSPTgCItMXHGT5ZPkjhuFKUTww06Xg1dNMXuGxIKlARvS7upk6JXIm41ZKXmtlKR1iCRWklKmg=="],
+
"read-package-json-fast": ["read-package-json-fast@4.0.0", "", { "dependencies": { "json-parse-even-better-errors": "^4.0.0", "npm-normalize-package-bin": "^4.0.0" } }, "sha512-qpt8EwugBWDw2cgE2W+/3oxC+KTez2uSVR8JU9Q36TXPAGCaozfQUs59v4j4GFpWTaw0i6hAZSvOmu1J0uOEUg=="],
"readdirp": ["readdirp@5.0.0", "", {}, "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ=="],
diff --git a/package.json b/package.json
index 256f41a..6ed0df6 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"cron-parser": "^5.6.2",
"date-fns": "^4.4.0",
"pinia": "^3.0.4",
+ "random-word-slugs": "^0.1.7",
"vue": "^3.5.39",
"vue-i18n": "^11.4.6",
"vue-router": "^5.1.0"
diff --git a/resources/lang/en.json b/resources/lang/en.json
index da4a635..9df9aa5 100644
--- a/resources/lang/en.json
+++ b/resources/lang/en.json
@@ -71,5 +71,7 @@
"task_delete_error": "Could not delete task"
},
"not_found": "Looks like there's nothing here...",
- "not_found_button": "Go back to familiar territory"
+ "not_found_button": "Go back to familiar territory",
+ "home": "A shareable task list with auto resetting items.
Create your list below.",
+ "home_button": "Let's go !"
}
diff --git a/resources/lang/fr.json b/resources/lang/fr.json
index 6cd1162..f6321f1 100644
--- a/resources/lang/fr.json
+++ b/resources/lang/fr.json
@@ -71,5 +71,7 @@
"task_delete_error": "Impossible de supprimer la tâche"
},
"not_found": "On dirait qu'il n'y a rien ici...",
- "not_found_button": "Retour en terrain connu"
+ "not_found_button": "Retour en terrain connu",
+ "home": "Une liste de tâches avec réinitialisation automatique des éléments.
Créez ta liste ci-dessous.",
+ "home_button": "C'est parti !"
}
diff --git a/resources/ts/router.ts b/resources/ts/router.ts
index 501753b..b2b2977 100644
--- a/resources/ts/router.ts
+++ b/resources/ts/router.ts
@@ -7,7 +7,7 @@ const router = createRouter({
history: createWebHistory(),
routes: [
{ path: "/", component: HomeView },
- { path: "/:pathMatch([\\w-]+)", component: ListView },
+ { path: "/:list", component: ListView },
{ path: "/:pathMatch(.*)", component: NotFoundView },
],
});
diff --git a/resources/ts/views/HomeView.vue b/resources/ts/views/HomeView.vue
index 839b09f..7689543 100644
--- a/resources/ts/views/HomeView.vue
+++ b/resources/ts/views/HomeView.vue
@@ -1,3 +1,37 @@
+
+
- TODO
+
+
+
+
+
+
+
+
+ {{ $t('home_button') }}
+
+
+
diff --git a/resources/ts/views/ListView.vue b/resources/ts/views/ListView.vue
index 0675dda..89f3a0a 100644
--- a/resources/ts/views/ListView.vue
+++ b/resources/ts/views/ListView.vue
@@ -11,10 +11,13 @@ import { SortType } from "@/enums";
import { booleanCookieRef, enumCookieRef } from "@/lib/cookies";
import { useAlertStore } from "@/stores/alerts";
import { useI18n } from "vue-i18n";
+import { onBeforeRouteUpdate, useRoute } from 'vue-router'
+const route = useRoute();
+
+const list = ref(null);
const taskInput = ref("");
const tasks = ref([]);
-const list = ref("test");
const sortType = enumCookieRef(
"toutDouxSortType",
@@ -34,19 +37,21 @@ const i18n = useI18n();
const { alertSuccess, alertError, alertWarning } = useAlertStore();
function fetchTasks() {
- getTasks(list.value)
- .then((data: Task[]) => {
- tasks.value = data;
- reSortTasks();
- setTimeout(fetchTasks, 10000);
- })
- .catch(() => {
- if (tasks.value.length !== 0) {
- alertWarning(i18n.t("alerts.task_refresh_error"));
- } else {
- alertError(i18n.t("alerts.task_fetch_error"));
- }
- });
+ if (list.value) {
+ getTasks(list.value)
+ .then((data: Task[]) => {
+ tasks.value = data;
+ reSortTasks();
+ setTimeout(fetchTasks, 10000);
+ })
+ .catch(() => {
+ if (tasks.value.length !== 0) {
+ alertWarning(i18n.t("alerts.task_refresh_error"));
+ } else {
+ alertError(i18n.t("alerts.task_fetch_error"));
+ }
+ });
+ }
}
function reSortTasks() {
@@ -54,7 +59,7 @@ function reSortTasks() {
}
function onNewTask() {
- if (taskInput.value.trim()) {
+ if (taskInput.value.trim() && list.value) {
createTask(list.value, {
name: taskInput.value.trim(),
reset_cron: null,
@@ -74,17 +79,19 @@ function onNewTask() {
}
function onCloneTask(task: Task) {
- createTask(list.value, {
- name: task.name,
- reset_cron: task.reset_cron,
- })
- .then((data: Task) => {
- tasks.value.push(data);
- alertSuccess(i18n.t("alerts.task_cloned"));
+ if (list.value) {
+ createTask(list.value, {
+ name: task.name,
+ reset_cron: task.reset_cron,
})
- .catch(() => {
- alertError(i18n.t("alerts.task_create_error"));
- });
+ .then((data: Task) => {
+ tasks.value.push(data);
+ alertSuccess(i18n.t("alerts.task_cloned"));
+ })
+ .catch(() => {
+ alertError(i18n.t("alerts.task_create_error"));
+ });
+ }
}
function onDeleteTask(task: Task) {
@@ -107,7 +114,15 @@ function onChangeSortReverse() {
reSortTasks();
}
-onBeforeMount(fetchTasks);
+onBeforeMount(() => {
+ list.value = route.params.list as string;
+ fetchTasks();
+});
+
+onBeforeRouteUpdate((to) => {
+ list.value = to.params.list as string;
+ fetchTasks();
+})
diff --git a/resources/ts/views/NotFoundView.vue b/resources/ts/views/NotFoundView.vue
index e988dcf..c348417 100644
--- a/resources/ts/views/NotFoundView.vue
+++ b/resources/ts/views/NotFoundView.vue
@@ -3,8 +3,10 @@ import { CircleQuestionMarkIcon } from "@lucide/vue";
-