diff --git a/web/components/ui/Sidebar.vue b/web/components/ui/Sidebar.vue index 5e0445e..dd3a118 100644 --- a/web/components/ui/Sidebar.vue +++ b/web/components/ui/Sidebar.vue @@ -4,24 +4,27 @@ import ListItem from './ListItem.vue'; import Title1 from './Title1.vue'; import type { DropdownMenuItem } from '@nuxt/ui'; import { DateTime } from 'luxon'; +import type { USeparator } from '#components'; const colorMode = useColorMode(); + const currentTheme = ref<'dark' | 'system' | 'light'>(colorMode.preference as 'dark' | 'system' | 'light'); -const isLight = computed(() => currentTheme.value === 'light'); -const isDark = computed(() => currentTheme.value === 'dark'); -const isSystem = computed(() => currentTheme.value === 'system'); - -watch(currentTheme, () => { - console.log(currentTheme.value) - colorMode.preference = currentTheme.value; -}) +const date = defineModel('date', { required: true }) +const tasks = defineModel('tasks', { required: true }) const emits = defineEmits<{ (e: 'createTask', name: string): void (e: 'deleteTask', id: number): void + (e: 'editTask', task: Task): void }>() +const isLight = computed(() => currentTheme.value === 'light'); +const isDark = computed(() => currentTheme.value === 'dark'); +const isSystem = computed(() => currentTheme.value === 'system'); +const doneTasks = computed(() => tasks.value.filter(task => task.done)) +const todoTasks = computed(() => tasks.value.filter(task => !task.done)) + const dropDownItems = computed(() => [ [ { label: "Profile", icon: "i-lucide-user" }, @@ -60,7 +63,6 @@ const dropDownItems = computed(() => [ ] ]) -const date = defineModel('date', { required: true }) const selectedDate = computed({ get() { @@ -79,31 +81,26 @@ type Task = { userid: string title: string description: string - done: number + done: boolean estimated_time: string due_date: string created_at: string updated_at: string } -defineProps<{ - todos: Task[] -}>() - -function addTodo() { +function addTask() { const name = prompt("Todo name:") console.log(name) if (name !== null) { emits('createTask', name) } } -function deleteTodo(todo: Task) { - console.log(todo.id) +function deleteTask(todo: Task) { emits('deleteTask', todo.id) } -function editTodo() { - +function editTask(task: Task) { + emits('editTask', task) } @@ -119,42 +116,39 @@ function editTodo() {
Todos
- +
- - {{ todo.title }} + + {{ task.title }}
- - - - - - - - - - - - - - - - + + +
+
+
+ + +
+ + {{ task.title }} + +
+ +
- + +
@@ -174,6 +168,4 @@ function editTodo() { - + diff --git a/web/pages/index.vue b/web/pages/index.vue index 47e8371..2719488 100644 --- a/web/pages/index.vue +++ b/web/pages/index.vue @@ -23,7 +23,7 @@ type Task = { userid: string title: string description: string - done: number + done: boolean estimated_time: string due_date: string created_at: string @@ -68,7 +68,7 @@ async function deleteTask(id: number) {