Skip to content

Commit

Permalink
Remove Todo route and integrate Todo component into Home view as a mo…
Browse files Browse the repository at this point in the history
…dal.
  • Loading branch information
swuecho committed Sep 21, 2024
1 parent c466f45 commit 3f43769
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 deletions.
16 changes: 1 addition & 15 deletions web/src/views/Todo.vue → web/src/components/Todo.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
<template>
<div class="content">
<nav-bar :date="date" :today="today" :loading="loading" />
<todo-editor :content="content" :extensions="extensions" @init="onInit" />
</div>
</template>

<script setup>
import { ref, computed, watch } from 'vue';
import moment from 'moment';
import NavBar from '@/components/NavBar';
import TodoEditor from '@/components/TodoEditor';
import { createExtensions } from '@/editorExt.js';
import { useQuery } from '@tanstack/vue-query';
import axios from '@/axiosConfig.js';
const props = defineProps({
date: {
type: String,
required: true,
},
});
const now = ref(moment());
const loading = ref(true);
const content = ref(null);
const content = ref("");
const extensions = createExtensions();
const today = computed(() => {
return now.value.format('YYYYMMDD');
});
const onInit = ({ editor }) => {
fetchTodoContent(editor);
};
Expand Down
5 changes: 0 additions & 5 deletions web/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,5 @@ export default new Router({
// which is lazy-loaded when the route is visited.
component: () => import( /* webpackChunkName: "about" */ './views/Diary.vue')
},
{
path: '/todo',
name: 'todo',
component: () => import( /* webpackChunkName: "about" */ './views/Todo.vue')
}
]
})
14 changes: 13 additions & 1 deletion web/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<Icon icon="fluent:arrow-next-16-regular" width="1.2rem" />
</div>
</div>
<a href="/todo">Todo</a>
<button @click="openModal">Todo</button>
<el-dialog :visible="dialogVisible" title="Todos" @close="closeModal">
<Todo></Todo>
</el-dialog>
<a href="content">
<Icon :icon="tableOfContents" />
</a>
Expand All @@ -31,10 +34,12 @@ import moment from 'moment';
import { Icon } from '@iconify/vue2';
import tableOfContents from '@iconify/icons-mdi/table-of-contents';
import DiaryEditor from "@/components/DiaryEditor";
import Todo from '@/components/Todo.vue';
const now = ref(moment());
const date = ref(moment().format('YYYYMMDD'))
const dialogVisible = ref(false)
onMounted(() => {
// eslint-disable-next-line no-unused-vars
Expand Down Expand Up @@ -71,6 +76,13 @@ function navigateDateToToday() {
date.value = today.value
}
function openModal() {
dialogVisible.value = true
}
function closeModal() {
dialogVisible.value = false
}
</script>

<style scoped>
Expand Down

0 comments on commit 3f43769

Please sign in to comment.