diff --git a/README.org b/README.org index 08318e1..d673b91 100644 --- a/README.org +++ b/README.org @@ -65,12 +65,16 @@ $ bun install -g @vue/language-server $ bun install -g @vue/typescript-plugin # Pinia -$ bun install pinia +$ bun install @pinia/nuxt # also add it to nuxt.config modules! +$ bun install pinia-plugin-persistedstate # same as above # PrimeVue -$ bun install primevue primeicons @primevue/themes +$ bun install primevue primeicons @primevue/themes @primevue/forms $ bun install --dev @primevue/nuxt-module # Zod $ bun install zod + +# UUID +$ bun install uuid #+END_SRC diff --git a/nuxt.config.ts b/nuxt.config.ts index c5cbb11..ceed4cf 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -4,13 +4,30 @@ import Aura from "@primevue/themes/aura"; export default defineNuxtConfig({ compatibilityDate: "2024-11-01", css: [ - "primeicons/primeicons.css" + "primeicons/primeicons.css", + "~/assets/css/style.css" ], devtools: { enabled: true }, + dir: { + public: "../public" + }, modules: [ "@nuxt/eslint", - "@primevue/nuxt-module" + "@pinia/nuxt", + "@primevue/nuxt-module", + "pinia-plugin-persistedstate/nuxt", ], + pinia: { + storesDirs: ["src/stores/**"] // also auto-import nested directories + }, + piniaPluginPersistedstate: { + debug: process.env.NODE_ENV === "development", // log error to console + storage: "cookies", + cookieOptions: { + sameSite: "lax", // prevent CSRF + secure: process.env.NODE_ENV !== "development" // only send over HTTPS + } + }, primevue: { options: { theme: { @@ -18,9 +35,6 @@ export default defineNuxtConfig({ } } }, - dir: { - public: "../public" - }, srcDir: "src/", ssr: false }) diff --git a/package.json b/package.json index da7ae93..8d0fd64 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,14 @@ "postinstall": "nuxt prepare" }, "dependencies": { + "@pinia/nuxt": "^0.7.0", + "@primevue/forms": "^4.2.3", "@primevue/themes": "^4.2.3", "nuxt": "^3.14.1592", - "pinia": "^2.2.6", + "pinia-plugin-persistedstate": "^4.1.3", "primeicons": "^7.0.0", "primevue": "^4.2.3", + "uuid": "^11.0.3", "vue": "latest", "vue-router": "latest", "zod": "^3.23.8" diff --git a/src/app.vue b/src/app.vue index a43864c..6b42d39 100644 --- a/src/app.vue +++ b/src/app.vue @@ -2,4 +2,5 @@ + diff --git a/src/assets/css/style.css b/src/assets/css/style.css new file mode 100644 index 0000000..2de1978 --- /dev/null +++ b/src/assets/css/style.css @@ -0,0 +1,7 @@ +/*----------------------------------------*/ +/* General */ + +body { + font-family: "Segoe UI", "DejaVu Sans", sans-serif; + scroll-behavior: smooth; +} diff --git a/src/components/shared/Footer.vue b/src/components/Shared/Footer.vue similarity index 100% rename from src/components/shared/Footer.vue rename to src/components/Shared/Footer.vue diff --git a/src/components/shared/Header.vue b/src/components/Shared/Header.vue similarity index 100% rename from src/components/shared/Header.vue rename to src/components/Shared/Header.vue diff --git a/src/components/shared/NavMenu.vue b/src/components/Shared/NavMenu.vue similarity index 100% rename from src/components/shared/NavMenu.vue rename to src/components/Shared/NavMenu.vue diff --git a/src/components/Table/SortingColumn.vue b/src/components/Table/SortingColumn.vue new file mode 100644 index 0000000..70cb81c --- /dev/null +++ b/src/components/Table/SortingColumn.vue @@ -0,0 +1,18 @@ + + adasda + + + Title + + + + + + + diff --git a/src/components/Todo/Add.vue b/src/components/Todo/Add.vue new file mode 100644 index 0000000..338f3cb --- /dev/null +++ b/src/components/Todo/Add.vue @@ -0,0 +1,59 @@ + + + + + + + {{ $form.title.error?.message }} + + + + + + + + + diff --git a/src/components/Todo/Browse.vue b/src/components/Todo/Browse.vue new file mode 100644 index 0000000..d8ef4c4 --- /dev/null +++ b/src/components/Todo/Browse.vue @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/pages/todos.vue b/src/pages/todos.vue index 141bdbb..8421dde 100644 --- a/src/pages/todos.vue +++ b/src/pages/todos.vue @@ -1,24 +1,18 @@ - - - - - - - - + + + + + Toast diff --git a/src/schemas/todo.ts b/src/schemas/todo.ts new file mode 100644 index 0000000..98c51ee --- /dev/null +++ b/src/schemas/todo.ts @@ -0,0 +1,8 @@ +import { z } from "zod"; + +export const todoSchema = z.object({ + id: z.optional(z.string().uuid()), + title: z.string().min(1, "Title can't be empty"), +}); + +export type Todo = z.infer; diff --git a/src/stores/todoStore.ts b/src/stores/todoStore.ts new file mode 100644 index 0000000..9c68fc8 --- /dev/null +++ b/src/stores/todoStore.ts @@ -0,0 +1,15 @@ +import { defineStore } from "pinia" +import type { Todo } from "@/schemas/todo" + +export const useTodoStore = defineStore("todo", () => { + + const todos = ref([ + { id: "d8681644-74d0-4a30-90db-06baa277d0a0", title: "laundry" }, + { id: "03c5bf55-f528-43a2-89a1-1a1afb0fa4f6", title: "feed pet" }, + { id: "356cd252-bef8-4a1c-ba81-5a68d89df56e", title: "run" } + ]); + + return { todos } +}, { + persist: process.env.NODE_ENV === 'development' ? true : false, +})