From aba56bb034d5d976d2f6434db10c92b1c69ba5af Mon Sep 17 00:00:00 2001 From: Peaceultime Date: Tue, 6 Aug 2024 15:16:48 +0200 Subject: [PATCH] Project list and starting editing --- app.vue | 27 +- assets/common.css | 84 +- assets/global.css | 2 +- components/BoldContent.vue | 2 - components/LeftComponent.vue | 19 +- components/Markdown.vue | 102 +- components/SearchView.client.vue | 20 +- components/content/prose/ProseA.vue | 18 +- components/explorer/NavigationLink.vue | 2 +- components/explorer/TocLink.vue | 2 +- composables/useProject.ts | 31 +- db.sqlite | Bin 450560 -> 454656 bytes pages/editing.vue | 18 + pages/explorer/[projectId]/[...slug].vue | 4 + pages/explorer/[projectId]/tags/[...slug].vue | 2 +- pages/explorer/index.vue | 24 + pages/user/login.vue | 2 +- pages/user/register.vue | 2 +- server/api/import.get.ts | 859 +++++++++++++++++ server/api/project.get.ts | 878 +----------------- server/api/project/[projectId].get.ts | 4 +- server/api/search.get.ts | 6 +- types/api.ts | 24 +- types/cookies.ts | 0 24 files changed, 1189 insertions(+), 943 deletions(-) create mode 100644 pages/editing.vue create mode 100644 pages/explorer/index.vue create mode 100644 server/api/import.get.ts create mode 100644 types/cookies.ts diff --git a/app.vue b/app.vue index cd2edad..2ed14e6 100644 --- a/app.vue +++ b/app.vue @@ -9,6 +9,15 @@ function hideLeftPanel(_: Event): void { \ No newline at end of file diff --git a/components/LeftComponent.vue b/components/LeftComponent.vue index 222bff8..79a58e0 100644 --- a/components/LeftComponent.vue +++ b/components/LeftComponent.vue @@ -5,14 +5,27 @@ function hideLeftPanel(_: Event) } const route = useRoute(); +const showing = ref(false); -const project = parseInt(Array.isArray(route.params.projectId) ? '' : route.params.projectId); +const project = computed(() => parseInt(Array.isArray(route.params.projectId) ? '0' : route.params.projectId)); -const { data: navigation } = await useFetch(() => isNaN(project) ? '' : `/api/project/${project}/navigation`); +const { data: navigation, execute, status, error } = await useFetch(() => `/api/project/${project.value}/navigation`, { + immediate: false, +}); + +if(route.params.projectId && project.value !== 0) +{ + showing.value = true; + execute(); +} +else +{ + showing.value = false; +} @@ -74,22 +74,30 @@ if (parseURL(props.href).protocol !== undefined) let id = ref(props.project); if(id.value === undefined) { - id = useProject().id; + id.value = useProject().id.value; } const { data: page, status, error, execute } = await useLazyFetch(`/api/project/${id.value}/file`, { query: { search: "%" + parseURL(props.href).pathname, - } + }, + immediate: false, + dedupe: 'defer', }); -if(external.value) +if(!external.value) { - execute(); + await execute(); +} + +if(status.value === 'error') +{ + console.error(error.value); } if (page.value && page.value[0]) { path.value = `/explorer/${id.value}${page.value[0].path}`; + console.log(path.value); } \ No newline at end of file diff --git a/components/explorer/NavigationLink.vue b/components/explorer/NavigationLink.vue index 80fb1eb..1f2abde 100644 --- a/components/explorer/NavigationLink.vue +++ b/components/explorer/NavigationLink.vue @@ -51,7 +51,7 @@ function hideLeftPanel(_: Event) -
{{ link.title }}
diff --git a/components/explorer/TocLink.vue b/components/explorer/TocLink.vue index 38b0ec7..a7399c1 100644 --- a/components/explorer/TocLink.vue +++ b/components/explorer/TocLink.vue @@ -19,7 +19,7 @@ const hasChildren = computed(() => {