Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fusion of dashboard and frontend

Smaug6739ec2ecc603ce1
diff --git a/dashboard/.env.development b/dashboard/.env.development
deleted file mode 100644
index 3f3c70c6..00000000
--- a/dashboard/.env.development
+++ /dev/null
@@ -1 +0,0 @@
-VITE_BASE_API="http://192.168.0.25:3001"
\ No newline at end of file
diff --git a/dashboard/.env.production b/dashboard/.env.production
deleted file mode 100644
index a0628664..00000000
--- a/dashboard/.env.production
+++ /dev/null
@@ -1 +0,0 @@
-VITE_BASE_API="https://api.alexandrie-hub.fr"
\ No newline at end of file
diff --git a/dashboard/.gitignore b/dashboard/.gitignore
deleted file mode 100644
index 48fcd8fa..00000000
--- a/dashboard/.gitignore
+++ /dev/null
@@ -1,19 +0,0 @@
-# Nuxt dev/build outputs
-.output
-.data
-.nuxt
-.nitro
-.cache
-dist
-
-# Node dependencies
-node_modules
-
-# Logs
-logs
-*.log
-
-# Misc
-.DS_Store
-.fleet
-.idea
diff --git a/dashboard/App.vue b/dashboard/App.vue
deleted file mode 100644
index 1a9eb751..00000000
--- a/dashboard/App.vue
+++ /dev/null
@@ -1,34 +0,0 @@
-<template>
- <div id="app">
- <Navbar style="height: 60px" />
- <NuxtPage style="overflow:auto;padding-top: 20px;" id="app-scroll" />
- <div id="backdrop"></div>
- <Notification />
- <ClientOnly>
- <BackToTop />
- </ClientOnly>
- </div>
-</template>
-
-<script setup lang="ts">
-import { useDocumentsStore, useCategoriesStore } from './store';
-
-// @ts-ignore
-useDocumentsStore().fetch();
-useCategoriesStore().fetch();
-
-</script>
-<style scoped lang="scss">
-#app {
- height: 100vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
-}
-
-@media print {
- #app {
- height: auto;
- }
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/README.md b/dashboard/README.md
deleted file mode 100644
index f5db2a2d..00000000
--- a/dashboard/README.md
+++ /dev/null
@@ -1,75 +0,0 @@
-# Nuxt 3 Minimal Starter
-
-Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
-
-## Setup
-
-Make sure to install the dependencies:
-
-```bash
-# npm
-npm install
-
-# pnpm
-pnpm install
-
-# yarn
-yarn install
-
-# bun
-bun install
-```
-
-## Development Server
-
-Start the development server on `http://localhost:3000`:
-
-```bash
-# npm
-npm run dev
-
-# pnpm
-pnpm run dev
-
-# yarn
-yarn dev
-
-# bun
-bun run dev
-```
-
-## Production
-
-Build the application for production:
-
-```bash
-# npm
-npm run build
-
-# pnpm
-pnpm run build
-
-# yarn
-yarn build
-
-# bun
-bun run build
-```
-
-Locally preview production build:
-
-```bash
-# npm
-npm run preview
-
-# pnpm
-pnpm run preview
-
-# yarn
-yarn preview
-
-# bun
-bun run preview
-```
-
-Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
diff --git a/dashboard/bun.lockb b/dashboard/bun.lockb
deleted file mode 100755
index 60cd2135..00000000
Binary files a/dashboard/bun.lockb and /dev/null differ
diff --git a/dashboard/components/BackToTop.vue b/dashboard/components/BackToTop.vue
deleted file mode 100644
index 31bfe72c..00000000
--- a/dashboard/components/BackToTop.vue
+++ /dev/null
@@ -1,62 +0,0 @@
-<template>
- <div class="back-to-top" @click="scrollToTop" v-if="show">
- </div>
-</template>
-
-<script setup lang="ts">
-const scrollTop = ref(0);
-const scroll_element = document.getElementById('app-scroll')!;
-const getScrollTop = () => scroll_element.scrollTop || 0;
-const scrollToTop = () => scroll_element.scrollTo({ top: 0, behavior: 'smooth' });
-const show = computed(() => scrollTop.value > 300);
-const onScroll = () => scrollTop.value = getScrollTop()
-
-onMounted(() => {
- scrollTop.value = getScrollTop();
- scroll_element.addEventListener('scroll', onScroll);
-});
-onUnmounted(() => {
- scroll_element.removeEventListener('scroll', onScroll);
-});
-</script>
-
-<style scoped lang="scss">
-.back-to-top {
- cursor: pointer;
- position: fixed;
- bottom: 2rem;
- right: 2.5rem;
- width: 2rem;
- height: 1.2rem;
- background-color: $primary-400;
- -webkit-mask: url('/svg/back-to-top.svg') no-repeat;
- mask: url('/svg/back-to-top.svg') no-repeat;
- z-index: 100;
-}
-
-.back-to-top:hover {
- background-color: $primary-500;
-}
-
-@media (max-width: 959px) {
- .back-to-top {
- display: none;
- }
-}
-
-.back-to-top-enter-active,
-.back-to-top-leave-active {
- transition: opacity $transition-duration;
-}
-
-.back-to-top-enter-from,
-.back-to-top-leave-to {
- opacity: 0;
-}
-
-@media print {
- .back-to-top {
- display: none;
- }
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/components/Logo.vue b/dashboard/components/Logo.vue
deleted file mode 100644
index 9a0c6659..00000000
--- a/dashboard/components/Logo.vue
+++ /dev/null
@@ -1,10 +0,0 @@
-<script setup lang="ts">
-const colorMode = useColorMode()
-</script>
-
-<template>
- <div style="display:flex;align-items: center;column-gap: 0.5rem;">
- <img style="width:50px" :src="`/Alexandrie-${colorMode.value}.svg`" alt="Alexandrie">
- <p style="font-weight: 600;font-family: Poppins;">Alexandrie</p>
- </div>
-</template>
\ No newline at end of file
diff --git a/dashboard/components/Navbar.vue b/dashboard/components/Navbar.vue
deleted file mode 100644
index 670e3f33..00000000
--- a/dashboard/components/Navbar.vue
+++ /dev/null
@@ -1,38 +0,0 @@
-<template>
- <header>
- <span>
- <svg v-if="hasSidebar" @click="toggleSidebar" class="open-sidebar" xmlns="http://www.w3.org/2000/svg" height="24"
- viewBox="0 -960 960 960" width="24">
- <path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z" />
- </svg>
- </span>
- <ThemeToggle />
- </header>
-</template>
-
-<style lang="scss" scoped>
-header {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: space-between;
- padding: 15px;
-}
-
-.open-sidebar {
- width: 30px;
- height: 30px;
- fill: var(--font-color);
- cursor: pointer;
-}
-
-// Mobile styles
-@media screen and (max-width: 719px) {
- .no-mobile {
- display: none;
- }
-}
-</style>
-<script lang="ts" setup>
-const { toggleSidebar, hasSidebar } = useSidebar();
-</script>
\ No newline at end of file
diff --git a/dashboard/components/ThemeToggle.vue b/dashboard/components/ThemeToggle.vue
deleted file mode 100644
index a31146cb..00000000
--- a/dashboard/components/ThemeToggle.vue
+++ /dev/null
@@ -1,44 +0,0 @@
-<template>
- <button @click="toggleColorMode">
- <svg v-if="colorMode.value === 'light'" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
- <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
- <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
- <g id="SVGRepo_iconCarrier">
- <path
- d="M12 3V4M12 20V21M4 12H3M6.31412 6.31412L5.5 5.5M17.6859 6.31412L18.5 5.5M6.31412 17.69L5.5 18.5001M17.6859 17.69L18.5 18.5001M21 12H20M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12Z"
- stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
- </g>
- </svg>
- <svg v-else-if="colorMode.value === 'dark'" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"
- stroke="#fff">
- <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
- <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
- <g id="SVGRepo_iconCarrier">
- <path
- d="M3.32031 11.6835C3.32031 16.6541 7.34975 20.6835 12.3203 20.6835C16.1075 20.6835 19.3483 18.3443 20.6768 15.032C19.6402 15.4486 18.5059 15.6834 17.3203 15.6834C12.3497 15.6834 8.32031 11.654 8.32031 6.68342C8.32031 5.50338 8.55165 4.36259 8.96453 3.32996C5.65605 4.66028 3.32031 7.89912 3.32031 11.6835Z"
- stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
- </g>
- </svg>
-
- </button>
-</template>
-
-<script setup lang="ts">
-const colorMode = useColorMode();
-const toggleColorMode = () => colorMode.value === 'light' ? colorMode.preference = 'dark' : colorMode.preference = 'light';
-</script>
-
-<style scoped lang="scss">
-svg {
- width: 25px;
- height: 25px;
-}
-
-button {
- background: none;
- border: none;
- cursor: pointer;
- padding: 0;
- margin: 0;
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/components/sidebar/Sidebar.vue b/dashboard/components/sidebar/Sidebar.vue
deleted file mode 100644
index aa40c9e2..00000000
--- a/dashboard/components/sidebar/Sidebar.vue
+++ /dev/null
@@ -1,103 +0,0 @@
-<template>
- <Resizable>
- <div class="sidebar-content">
- <section class="header">
- <IconApp />
- <NuxtLink style="font-size: 19px;font-weight: 600;" to="/">Dashboard</NuxtLink>
- <IconClose class="btn" />
- </section>
- <CollapseItem v-for="(item, index) in items " :key="index" :item="item" :root="true" />
- </div>
- </Resizable>
-</template>
-
-<script setup lang="ts">
-import CollapseItem from './CollapseItem.vue';
-import Resizable from './Resizable.vue';
-import IconClose from './IconClose.vue';
-import IconApp from './IconApp.vue';
-import { useCategoriesStore, useDocumentsStore, type Category } from '~/store';
-import { ItemsManager, type Item } from './tree_builder';
-import { navigationItems } from "./helpers";
-
-const { isOpened, hasSidebar } = useSidebar();
-const categoriesStore = useCategoriesStore();
-const documentsStore = useDocumentsStore();
-
-const isMobile = () => process.client ? window.innerWidth <= 768 : false;
-
-const items = computed((): Item[] => {
- const navigation: Item[] = navigationItems.map((item) => ({ id: item.id, parent_id: '', title: item.title, route: item.route, icon: item.icon, type: 'navigation', data: item }))
- const categories: Item[] = categoriesStore.categories.map((category: Category) => ({
- id: category.id,
- parent_id: category.parent_id || '',
- title: category.name,
- route: category.parent_id ? `/dashboard/category/${category.id}` : '',
- icon: category.icon,
- data: category,
- }));
- const documents: Item[] = documentsStore.documents.map((document) => ({
- id: document.id,
- parent_id: document.parent_id || document.category || '',
- title: document.name,
- route: `/dashboard/doc/${document.id}`,
- data: document
- }))
-
- return new ItemsManager([...navigation, ...documents, ...categories]).generateTree()
-});
-
-
-const handleClickOutside = (e: MouseEvent) => {
- if (isOpened.value && e.target && (!(e.target as Element).closest('.sidebar') && !(e.target as Element).closest('.open-sidebar'))) isOpened.value = false;
-};
-
-onMounted(() => {
- hasSidebar.value = true;
- if (isMobile()) return window.addEventListener('click', handleClickOutside);
- isOpened.value = true;
-});
-onBeforeUnmount(() => {
- hasSidebar.value = false;
- window.removeEventListener('click', handleClickOutside);
-});
-
-// Watch isOpened
-if (isMobile()) {
- watch(isOpened, (val) => {
- if (val) document.getElementById('backdrop')?.classList.add('backdrop');
- else document.getElementById('backdrop')?.classList.remove('backdrop');
- });
-}
-
-</script>
-
-<style scoped lang="scss">
-.sidebar-content {
- margin: 0 0 0 10px;
- background: var(--bg-color);
- display: flex;
- flex-direction: column;
- height: 100%;
- overflow-y: scroll;
-}
-
-.header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 50px;
- margin: 10px 0 15px 0;
-
- .btn {
- fill: var(--font-color);
- width: 30px;
- cursor: pointer;
- }
-
- .name {
- font-size: 1.2rem;
- font-weight: 500;
- }
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/components/sidebar/helpers.ts b/dashboard/components/sidebar/helpers.ts
deleted file mode 100644
index ac616308..00000000
--- a/dashboard/components/sidebar/helpers.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-export interface DefaultItem {
- id: string;
- type: 'default';
- title: string;
- icon?: string;
- route: string;
- childrens: DefaultItem[];
-}
-
-export const navigationItems: DefaultItem[] = [
- {
- id: 'manage-categories',
- type: 'default',
- title: 'Manage categories',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-320h480v-480h-80v280l-100-60-100 60v-280H320v480Zm0 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm360-720h200-200Zm-200 0h480-480Z"/></svg>',
- route: '/dashboard/categories',
- childrens: [],
- },
- {
- id: 'cdn',
- type: 'default',
- title: 'CDN',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M485-440h163q26 0 44-18t18-44q0-26-18-44.5T648-565h-2q-5-32-29-53.5T560-640q-26 0-47 13.5T481-590q-30 2-50.5 23.5T410-515q0 30 21.5 52.5T485-440ZM120-120q-33 0-56.5-23.5T40-200v-520h80v520h680v80H120Zm160-160q-33 0-56.5-23.5T200-360v-440q0-33 23.5-56.5T280-880h200l80 80h280q33 0 56.5 23.5T920-720v360q0 33-23.5 56.5T840-280H280Zm0-80h560v-360H527l-80-80H280v440Zm0 0v-440 440Z"/></svg>',
- route: '/dashboard/cdn',
- childrens: [],
- },
- {
- id: 'backup',
- type: 'default',
- title: 'Backup',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M260-160q-91 0-155.5-63T40-377q0-78 47-139t123-78q17-72 85-137t145-65q33 0 56.5 23.5T520-716v242l64-62 56 56-160 160-160-160 56-56 64 62v-242q-76 14-118 73.5T280-520h-20q-58 0-99 41t-41 99q0 58 41 99t99 41h480q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-48-22-89.5T600-680v-93q74 35 117 103.5T760-520q69 8 114.5 59.5T920-340q0 75-52.5 127.5T740-160H260Zm220-358Z"/></svg>',
- route: '/dashboard/backup',
- childrens: [],
- },
- {
- id: 'new-page',
- type: 'default',
- title: 'New page',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-160h160v-80H520v-160h-80v160H280v80h160v160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>',
- route: '/dashboard/new',
- childrens: [],
- },
-];
-export const icons = {
- draft:
- '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--turquoise)" d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',
- folder:
- '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--yellow);" d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>',
- file: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--pink);" d="M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',
- file_parent:
- '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--green);" d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h240v-560H200v560Zm320 0h240v-280H520v280Zm0-360h240v-200H520v200Z"/></svg>',
- archive:
- '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--grey)" d="M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z"/></svg>',
-};
diff --git a/dashboard/components/table-of-content/NodeTree.vue b/dashboard/components/table-of-content/NodeTree.vue
deleted file mode 100644
index 49a37c70..00000000
--- a/dashboard/components/table-of-content/NodeTree.vue
+++ /dev/null
@@ -1,35 +0,0 @@
-<template>
- <li>
- <a :href="node.link">{{ node.title }}</a>
- <ul v-if="node.childrens && node.childrens.length">
- <NodeTree v-for="child in node.childrens" :node="child"></NodeTree>
- </ul>
- </li>
-</template>
-
-<script lang="ts" setup>
-interface Node {
- title: string;
- link: string;
- childrens?: Node[];
-}
-
-defineProps<{ node: Node; }>();
-</script>
-
-<style scoped>
-a {
- opacity: 0.85;
-}
-
-li {
- list-style: none;
- padding: 0;
- margin: 3px 0 0 0;
-}
-
-ul {
- padding: 0 0 0 15px;
- margin: 0;
-}
-</style>
diff --git a/dashboard/components/table-of-content/TableOfContents.vue b/dashboard/components/table-of-content/TableOfContents.vue
deleted file mode 100644
index f141aa0d..00000000
--- a/dashboard/components/table-of-content/TableOfContents.vue
+++ /dev/null
@@ -1,100 +0,0 @@
-<template>
- <aside>
- <ul ref="list" class="toc">
- <h4>Table des matières</h4>
- <NodeTree v-if="headers.length" v-for="header of headers_tree" :node="header" :key="header.link" />
- <p v-else>Aucun élément à afficher</p>
- </ul>
- </aside>
-</template>
-
-<script lang="ts" setup>
-import NodeTree from './NodeTree.vue';
-
-const props = defineProps<{ element?: HTMLElement }>();
-const list = ref<HTMLElement>();
-
-interface GroupedHeaders {
- title: string;
- link: string;
- childrens: GroupedHeaders[];
-}
-
-const getHeaders = (): HTMLElement[] => {
- if (!props.element) return [];
- const headers = props.element.querySelectorAll('h1, h2, h3, h4, h5, h6') as NodeListOf<HTMLElement>;
- return Array.from(headers);
-};
-
-function buildTree(headers: HTMLElement[]): GroupedHeaders[] {
- const tree: GroupedHeaders[] = [];
- let currentLevel = -1;
- let currentElement = tree;
- for (const header of headers) {
- const level = parseInt(header.tagName[1]);
- const title = header.textContent?.replace(/#/g, '') || '';
- const link = `#${header.id}`;
- const node: GroupedHeaders = { title, link, childrens: [] };
- if (currentLevel === -1) currentLevel = level;
- if (level === currentLevel) {
- currentElement.push(node);
- } else if (level > currentLevel) {
- currentElement[currentElement.length - 1].childrens = [node];
- currentElement = currentElement[currentElement.length - 1].childrens;
- currentLevel = level;
- } else {
- currentElement = tree;
- currentElement.push(node);
- currentLevel = level;
- }
- }
- return tree;
-}
-
-const headers = computed(() => getHeaders());
-const headers_tree = computed(() => buildTree(headers.value));
-
-const observerCallback = (e: IntersectionObserverEntry[]) => {
- e.forEach((entry) => {
- const activeLink = list.value?.querySelector<HTMLAnchorElement>(`[href="#${entry.target.id}"]`)
- if (activeLink && entry.isIntersecting && entry.intersectionRatio === 1) {
- activeLink.classList.add('active')
- } else if (activeLink) {
- activeLink.classList.remove('active')
- }
- })
-};
-
-
-const observer: IntersectionObserver = new IntersectionObserver(observerCallback, { root: null, threshold: 1 });
-watchEffect(() => {
- headers.value.forEach((header) => observer.observe(header));
-});
-onBeforeUnmount(() => observer.disconnect())
-</script>
-
-<style lang="scss" scoped>
-@media (min-width: 1280px) {
- .toc {
- position: sticky;
- top: 20px;
- padding-left: 15px;
- margin-left: 10px;
- font-size: 0.75rem;
- max-width: 100%;
- font-weight: 500;
- }
-
- ul {
- border-left: 1px solid var(--border-color);
- padding: 0;
- margin: 0;
-
- li:deep(a) {
- &.active {
- color: $primary-400 !important;
- }
- }
- }
-}
-</style>
diff --git a/dashboard/components/table-of-content/types.ts b/dashboard/components/table-of-content/types.ts
deleted file mode 100644
index b719e15e..00000000
--- a/dashboard/components/table-of-content/types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export interface GroupedHeaders {
- title: string;
- link: string;
- childrens?: GroupedHeaders[];
-}
diff --git a/dashboard/nuxt.config.ts b/dashboard/nuxt.config.ts
deleted file mode 100644
index dd89e8e8..00000000
--- a/dashboard/nuxt.config.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { resolve } from 'path';
-// favicon: 'https://alexandrie.fr/logo.svg',
-export default defineNuxtConfig({
- devtools: { enabled: true },
- vite: {
- css: {
- preprocessorOptions: {
- scss: {
- additionalData: '@use "../@alexandrie/styles/src/_variables.scss" as *;',
- },
- },
- },
- },
- ssr: false,
- css: [
- resolve(__dirname, '../@alexandrie/styles/src/main.scss'),
- '~/styles/main.scss',
- resolve(__dirname, '../@alexandrie/styles/src/katex/katex.min.css'),
- ],
- modules: ['@pinia/nuxt', '@nuxtjs/color-mode'],
- colorMode: {
- preference: 'light', // default value of $colorMode.preference
- fallback: 'light', // fallback value if not system preference found
- hid: 'nuxt-color-mode-script',
- globalName: '__NUXT_COLOR_MODE__',
- componentName: 'ColorScheme',
- classPrefix: '',
- classSuffix: '-mode',
- storageKey: 'nuxt-color-mode',
- },
- experimental: {
- viewTransition: true,
- },
-
- app: {
- head: {
- title: 'Alexandrie dashboard',
- viewport: 'width=device-width, initial-scale=1',
- charset: 'utf-8',
- htmlAttrs: {
- lang: 'fr',
- },
- link: [
- {
- rel: 'manifest',
- crossorigin: 'use-credentials',
- href: '/manifest.json',
- },
- {
- rel: 'icon',
- type: 'image/svg+xml',
- href: '/favicon.svg',
- },
- ],
- },
- },
-});
diff --git a/dashboard/package.json b/dashboard/package.json
deleted file mode 100644
index 7ed25a69..00000000
--- a/dashboard/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "nuxt-app",
- "devDependencies": {
- "@nuxt/devtools": "latest",
- "@nuxtjs/color-mode": "^3.3.3",
- "@pinia/nuxt": "^0.5.0",
- "@types/katex": "^0.16.5",
- "@types/markdown-it": "^13.0.4",
- "@types/markdown-it-container": "^2.0.8",
- "@types/node": "^20.8.5",
- "katex": "^0.16.10",
- "markdown-it": "^14.1.0",
- "markdown-it-anchor": "^8.6.7",
- "markdown-it-container": "^4.0.0",
- "markdown-it-mark": "^4.0.0",
- "markdown-it-underline": "^1.0.1",
- "nuxt": "^3.8.0",
- "pinia": "^2.1.6",
- "punycode": "^2.3.0",
- "sass": "^1.69.3",
- "vue": "^3.3.4",
- "vue-router": "^4.2.5"
- },
- "private": true,
- "scripts": {
- "build": "nuxt build",
- "dev": "nuxt dev",
- "dev:host": "nuxt dev --host",
- "generate": "nuxt generate",
- "preview": "nuxt preview",
- "postinstall": "nuxt prepare"
- },
- "type": "module"
-}
diff --git a/dashboard/pages/index.vue b/dashboard/pages/index.vue
deleted file mode 100644
index 9c66814b..00000000
--- a/dashboard/pages/index.vue
+++ /dev/null
@@ -1,136 +0,0 @@
-<template>
- <div class="container">
- <main>
- <div class="content-wrapper">
- <div class="intro">
- <div class="intro-text">
- <h1>Your Ideas, Documents & Plans. Unified. Welcome to <span>Alexandrie</span></h1>
- <h3>Alexandrie is the connected workspace where <br /> better, faster work happens</h3>
- </div>
- <div class="get-started">
- <NuxtLink to="/dashboard">Get started</NuxtLink>
- </div>
- </div>
- <div class="images">
- <div class="img-container none">
- <img :src="`/documents-${colorMode.value}.png`" alt="Documents Image" />
- </div>
- <div class="img-container">
- <img :src="`/reading-${colorMode.value}.png`" alt="Reading Image" />
- </div>
- </div>
- </div>
-
- </main>
- <footer>
- <Logo />
- <div class="footer-links none">
- </div>
- </footer>
- </div>
-</template>
-
-<script setup lang="ts">
-const colorMode = useColorMode();
-</script>
-
-<style scoped lang="scss">
-.container {
- height: 100%;
- display: flex;
- flex-direction: column;
-}
-
-main {
- flex-grow: 1;
- padding-top: 1.5rem;
-}
-
-.content-wrapper {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- text-align: center;
- flex: 1;
-}
-
-.intro {
- max-width: 48rem;
- gap: 1rem;
-}
-
-.intro h1 {
- font-size: 2.7rem;
- font-weight: 700;
-}
-
-.intro h3 {
- font-size: 1.7rem;
- font-weight: 500;
- text-decoration: none;
-}
-
-.get-started {
- margin: 2rem 0;
-
- a {
- padding: 0.5rem 1rem;
- border-radius: 0.5rem;
- background-color: var(--font-color);
- color: var(--bg-color);
- font-weight: 500;
- font-size: 1.2rem;
-
-
- }
-
- &:hover {
- transform: scale(1.03)
- }
-}
-
-.none {
- display: none;
-}
-
-.images {
- display: flex;
- align-items: center;
- justify-content: center;
- max-width: 80rem;
-}
-
-.img-container {
- width: 300px;
- height: 300px;
-}
-
-@media (min-width: 768px) {
- .none {
- display: block;
- }
-}
-
-@media (min-width: 1024px) {
- .img-container {
- width: 350px;
- height: 350px;
- }
-}
-
-footer {
- display: flex;
- align-items: center;
- width: 100%;
- padding: 1rem;
- justify-content: space-between;
-}
-
-.footer-links {
- margin-left: auto;
- justify-content: space-between;
- align-items: center;
- gap: 0.5rem;
-}
-</style>
diff --git a/dashboard/public/Alexandrie-dark.svg b/dashboard/public/Alexandrie-dark.svg
deleted file mode 100644
index 736f33d3..00000000
--- a/dashboard/public/Alexandrie-dark.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
- "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
-<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
- width="85.000000pt" height="84.000000pt" viewBox="0 0 85.000000 84.000000"
- preserveAspectRatio="xMidYMid meet">
-
-<g transform="translate(0.000000,84.000000) scale(0.100000,-0.100000)"
-fill="#fff" stroke="none">
-<path d="M393 702 c-11 -7 -163 -413 -163 -434 0 -5 21 -8 46 -8 44 0 46 1 61
-40 l16 41 80 -3 80 -3 12 -35 c11 -33 14 -35 63 -38 l51 -3 -15 43 c-9 24 -41
-113 -71 198 -30 85 -59 167 -65 183 -8 23 -16 27 -46 27 -21 0 -43 -4 -49 -8z
-m82 -273 c-5 -8 -84 -7 -87 1 -1 6 32 110 40 124 3 5 15 -20 28 -54 13 -35 21
--67 19 -71z"/>
-<path d="M16 522 c-3 -5 -6 -75 -7 -157 l-3 -150 209 -106 210 -107 210 107
-c183 92 210 109 209 129 -1 12 -2 81 -3 152 -1 108 -3 130 -16 130 -13 0 -15
--21 -15 -132 0 -73 -4 -138 -8 -144 -4 -6 -90 -53 -192 -104 l-184 -92 -188
-93 c-118 59 -188 99 -189 109 0 8 0 72 1 141 1 104 -2 128 -14 132 -9 4 -17 3
--20 -1z"/>
-</g>
-</svg>
diff --git a/dashboard/public/Alexandrie-light.svg b/dashboard/public/Alexandrie-light.svg
deleted file mode 100644
index 555dcd60..00000000
--- a/dashboard/public/Alexandrie-light.svg
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
- "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
-<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
- width="85.000000pt" height="84.000000pt" viewBox="0 0 85.000000 84.000000"
- preserveAspectRatio="xMidYMid meet">
-
-<g transform="translate(0.000000,84.000000) scale(0.100000,-0.100000)"
-fill="#000000" stroke="none">
-<path d="M393 702 c-11 -7 -163 -413 -163 -434 0 -5 21 -8 46 -8 44 0 46 1 61
-40 l16 41 80 -3 80 -3 12 -35 c11 -33 14 -35 63 -38 l51 -3 -15 43 c-9 24 -41
-113 -71 198 -30 85 -59 167 -65 183 -8 23 -16 27 -46 27 -21 0 -43 -4 -49 -8z
-m82 -273 c-5 -8 -84 -7 -87 1 -1 6 32 110 40 124 3 5 15 -20 28 -54 13 -35 21
--67 19 -71z"/>
-<path d="M16 522 c-3 -5 -6 -75 -7 -157 l-3 -150 209 -106 210 -107 210 107
-c183 92 210 109 209 129 -1 12 -2 81 -3 152 -1 108 -3 130 -16 130 -13 0 -15
--21 -15 -132 0 -73 -4 -138 -8 -144 -4 -6 -90 -53 -192 -104 l-184 -92 -188
-93 c-118 59 -188 99 -189 109 0 8 0 72 1 141 1 104 -2 128 -14 132 -9 4 -17 3
--20 -1z"/>
-</g>
-</svg>
diff --git a/dashboard/public/android-chrome-192x192.png b/dashboard/public/android-chrome-192x192.png
deleted file mode 100644
index ea62c18f..00000000
Binary files a/dashboard/public/android-chrome-192x192.png and /dev/null differ
diff --git a/dashboard/public/android-chrome-512x512.png b/dashboard/public/android-chrome-512x512.png
deleted file mode 100644
index 63e8d8a9..00000000
Binary files a/dashboard/public/android-chrome-512x512.png and /dev/null differ
diff --git a/dashboard/public/apple-touch-icon.png b/dashboard/public/apple-touch-icon.png
deleted file mode 100644
index e17e3773..00000000
Binary files a/dashboard/public/apple-touch-icon.png and /dev/null differ
diff --git a/dashboard/public/documents-dark.png b/dashboard/public/documents-dark.png
deleted file mode 100644
index db6193c0..00000000
Binary files a/dashboard/public/documents-dark.png and /dev/null differ
diff --git a/dashboard/public/documents-light.png b/dashboard/public/documents-light.png
deleted file mode 100644
index 4e4518e1..00000000
Binary files a/dashboard/public/documents-light.png and /dev/null differ
diff --git a/dashboard/public/favicon-16x16.png b/dashboard/public/favicon-16x16.png
deleted file mode 100644
index 07c5fb70..00000000
Binary files a/dashboard/public/favicon-16x16.png and /dev/null differ
diff --git a/dashboard/public/favicon-32x32.png b/dashboard/public/favicon-32x32.png
deleted file mode 100644
index 3d24d79b..00000000
Binary files a/dashboard/public/favicon-32x32.png and /dev/null differ
diff --git a/dashboard/public/manifest.json b/dashboard/public/manifest.json
deleted file mode 100644
index 1a11a6e3..00000000
--- a/dashboard/public/manifest.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "Alexandrie dashboard",
- "short_name": "Alexandrie dashboard",
- "description": "Alexandrie dashboard application.",
- "start_url": "/",
- "display": "standalone",
- "background_color": "#2f3641",
- "theme_color": "#009df7",
- "icons": [
- { "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
- { "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
- ]
-}
diff --git a/dashboard/public/reading-dark.png b/dashboard/public/reading-dark.png
deleted file mode 100644
index c3871589..00000000
Binary files a/dashboard/public/reading-dark.png and /dev/null differ
diff --git a/dashboard/public/reading-light.png b/dashboard/public/reading-light.png
deleted file mode 100644
index 826b7e9a..00000000
Binary files a/dashboard/public/reading-light.png and /dev/null differ
diff --git a/dashboard/public/svg/back-to-top.svg b/dashboard/public/svg/back-to-top.svg
deleted file mode 100644
index 83236781..00000000
--- a/dashboard/public/svg/back-to-top.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 49.484 28.284"><g transform="translate(-229 -126.358)" fill="currentColor"><rect width="35" height="5" rx="2" transform="rotate(-45 296.902 -200.874)"/><rect width="35" height="5" rx="2" transform="rotate(-135 169.502 20.377)"/></g></svg>
\ No newline at end of file
diff --git a/dashboard/store/categories.store.ts b/dashboard/store/categories.store.ts
deleted file mode 100644
index f5e641e9..00000000
--- a/dashboard/store/categories.store.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { defineStore } from 'pinia';
-import { makeRequest, type FetchOptions } from './utils';
-
-import type { Category } from './db_strustures';
-
-export const useCategoriesStore = defineStore('categories', {
- state: () => ({
- categories: [] as Category[],
- }),
- getters: {
- getAll: state => state.categories,
- getById: state => (id: string) => state.categories.find((c: Category) => c.id == id),
- getParents: state => state.categories.filter(c => !c.parent_id),
- getChilds: state => (id: string) => state.categories.filter(c => c.parent_id == id),
- },
- actions: {
- fetch: async function (opts?: FetchOptions<Array<keyof Category>>) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`categories/${opts?.id || ''}`, 'GET', {});
- if (request.status == 'success') {
- if (opts?.id) {
- // replace the document with the new one
- const index = this.categories.findIndex(d => d.id == opts?.id);
- if (index == -1) this.categories.push(request.result as Category);
- else this.categories[index] = { ...(request.result as Category), type: 'category' };
- } else this.categories = (request.result as Category[]).map((d: Category) => ({ ...d, type: 'category' }));
- resolve(this.categories);
- } else reject(request.message);
- });
- },
- post(category: Category) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`categories`, 'POST', category);
- if (request.status == 'success') resolve(this.categories.push(request.result as Category));
- else reject(request.message);
- });
- },
- update(category: Category) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`categories/${category.id}`, 'PATCH', category);
- if (request.status == 'success') {
- this.categories = this.categories.map(c => {
- if (c.id == category.id) return category;
- return c;
- });
- resolve(category);
- } else reject(request.message);
- });
- },
-
- delete(id: string) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`categories/${id}`, 'DELETE', {});
- if (request.status == 'success') resolve((this.categories = this.categories.filter(c => c.id != id)));
- else reject(request.message);
- });
- },
- },
-});
diff --git a/dashboard/store/db_strustures.d.ts b/dashboard/store/db_strustures.d.ts
deleted file mode 100644
index c189e1b1..00000000
--- a/dashboard/store/db_strustures.d.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-export interface Document {
- id: string;
- name: string;
- description?: string;
- tags?: string;
- category?: string;
- parent_id?: string | null;
- accessibility: number; // 0: No; 1: Yes;
- content_markdown?: string;
- content_html?: string;
- author_id: string;
- created_timestamp: string;
- updated_timestamp: string;
-
- // not in the database
- partial?: boolean;
- type: 'document';
-}
-
-export interface Category {
- id: string;
- name: string;
- icon?: string;
- order?: number;
- parent_id?: string;
-
- // not in the database
- type: 'category';
-}
-
-export interface User {
- id: string;
- username: string;
- firstname?: string;
- lastname?: string;
- avatar?: string;
- email: string;
- password: string;
- created_timestamp: string;
-}
diff --git a/dashboard/store/documents.store.ts b/dashboard/store/documents.store.ts
deleted file mode 100644
index 7321f7f6..00000000
--- a/dashboard/store/documents.store.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { defineStore } from 'pinia';
-import { ref } from 'vue';
-import { makeRequest, type FetchOptions } from './utils';
-import type { Document } from './db_strustures';
-
-export const useDocumentsStore = defineStore('documents', {
- state: () => ({
- documents: ref<Document[]>([]),
- }),
- getters: {
- getAll: state => state.documents,
- getById: state => (id: string) => state.documents.find((d: Document) => d.id == id),
- getByCategories: state => (category: string) => state.documents.filter(d => d.category == category),
-
- getNext: state => (doc?: Document) => {
- const cdocs = state.documents.filter(d => d.category == doc?.category);
- const index = cdocs.findIndex(d => d.id == doc?.id);
- if (index == -1) return;
- return cdocs[index + 1];
- },
-
- getPrevious: state => (doc?: Document) => {
- const cdocs = state.documents.filter(d => d.category == doc?.category);
- const index = cdocs.findIndex(d => d.id == doc?.id);
- if (index == -1) return;
- return cdocs[index - 1];
- },
- getAllChildrensIds: state => (id: string) => {
- const childrens: string[] = [id];
- const getChildrens = (parent: Document) => {
- state.documents.forEach(doc => {
- if (doc.parent_id == parent.id) {
- childrens.push(doc.id);
- getChildrens(doc);
- }
- });
- };
- const parent = state.documents.find(d => d.id == id);
- if (parent) getChildrens(parent);
- return childrens;
- },
- },
- actions: {
- fetch: async function <T extends FetchOptions<Array<keyof Document>>>(opts?: T): Promise<'id' extends keyof T ? Document : Document[]> {
- console.log(`[store/documents] Fetching documents with options: ${JSON.stringify(opts)}`);
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`documents/${opts?.id || ''}?all=true`, 'GET', {});
- if (request.status == 'success') {
- if (opts?.id) {
- const index = this.documents.findIndex(d => d.id == opts?.id);
- const updatedDocument: Document = { ...(request.result as Document), partial: false, type: 'document' };
- if (index == -1) this.documents.push(updatedDocument);
- else this.documents[index] = updatedDocument;
- resolve(updatedDocument as 'id' extends keyof T ? Document : Document[]);
- } else {
- this.documents = (request.result as Document[]).map((d: Document) => ({ ...d, partial: true, type: 'document' }));
- resolve(this.documents as 'id' extends keyof T ? Document : Document[]);
- }
- } else reject(request.message);
- });
- },
- post(doc: Document) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest('documents', 'POST', doc);
- if (request.status == 'success') resolve(this.documents.push(request.result as Document));
- else reject(request.message);
- });
- },
- update(doc: Document) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`documents/${doc.id}`, 'PATCH', doc);
- if (request.status == 'success') resolve((this.documents = this.documents.map(d => (d.id == doc.id ? doc : d))));
- else reject(request.message);
- });
- },
- delete(id: string) {
- return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`documents/${id}`, 'DELETE', {});
- if (request.status == 'success') resolve((this.documents = this.documents.filter(d => d.id != id)));
- else reject(request.message);
- });
- },
- },
-});
diff --git a/dashboard/store/index.ts b/dashboard/store/index.ts
deleted file mode 100644
index cd043801..00000000
--- a/dashboard/store/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export * from './documents.store';
-export * from './categories.store';
-export * from './notifications.store';
-export type * from './utils';
-export type * from './db_strustures';
diff --git a/dashboard/store/utils.ts b/dashboard/store/utils.ts
deleted file mode 100644
index 6538a102..00000000
--- a/dashboard/store/utils.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { Document, Category } from './db_strustures';
-
-export interface APIResult<Data> {
- status: 'success' | 'error';
- message?: string;
- result?: Data;
-}
-
-export interface FetchOptions<K> {
- id: string; // id of the ressource
-}
-
-export const baseUrl = import.meta.env.VITE_BASE_API?.toString() || '';
-export async function makeRequest(route: string, method: string, body: Object): Promise<APIResult<Document | Category | Document[] | Category[]>> {
- try {
- const responce = await fetch(`${baseUrl}/api/v1/${route}`, {
- method: method,
- body: method == 'GET' || method == 'DELETE' ? null : JSON.stringify(body),
- headers: { 'Content-type': 'application/json; charset=UTF-8' },
- credentials: 'include',
- });
- const decoded = await responce.json();
- return decoded;
- } catch (e) {
- return { status: 'error', message: (e as Error).message };
- }
-}
diff --git a/dashboard/styles/main.scss b/dashboard/styles/main.scss
deleted file mode 100644
index 54c5c2d0..00000000
--- a/dashboard/styles/main.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-:root {
- --padding: calc((100vw - 1700px) / 2);
-}
\ No newline at end of file
diff --git a/dashboard/tsconfig.json b/dashboard/tsconfig.json
deleted file mode 100644
index a746f2a7..00000000
--- a/dashboard/tsconfig.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- // https://nuxt.com/docs/guide/concepts/typescript
- "extends": "./.nuxt/tsconfig.json"
-}
diff --git a/frontend/.env.development b/frontend/.env.development
index cfab0e21..3f3c70c6 100644
--- a/frontend/.env.development
+++ b/frontend/.env.development
@@ -1 +1 @@
-VITE_BASE_API="http://localhost:3001"
\ No newline at end of file
+VITE_BASE_API="http://192.168.0.25:3001"
\ No newline at end of file
diff --git a/frontend/.gitignore b/frontend/.gitignore
index d52c2347..48fcd8fa 100644
--- a/frontend/.gitignore
+++ b/frontend/.gitignore
@@ -1,9 +1,19 @@
-node_modules
-*.log*
+# Nuxt dev/build outputs
+.output
+.data
.nuxt
.nitro
.cache
-.output
-.env
-.vite
dist
+
+# Node dependencies
+node_modules
+
+# Logs
+logs
+*.log
+
+# Misc
+.DS_Store
+.fleet
+.idea
diff --git a/dashboard/.npmrc b/frontend/.npmrc
similarity index 100%
rename from dashboard/.npmrc
rename to frontend/.npmrc
diff --git a/dashboard/.prettierrc b/frontend/.prettierrc
similarity index 100%
rename from dashboard/.prettierrc
rename to frontend/.prettierrc
diff --git a/frontend/App.vue b/frontend/App.vue
index 0c4a392e..1a9eb751 100644
--- a/frontend/App.vue
+++ b/frontend/App.vue
@@ -1,24 +1,34 @@
<template>
<div id="app">
+ <Navbar style="height: 60px" />
+ <NuxtPage style="overflow:auto;padding-top: 20px;" id="app-scroll" />
<div id="backdrop"></div>
- <Navbar />
- <BackToTop />
- <NuxtPage />
+ <Notification />
+ <ClientOnly>
+ <BackToTop />
+ </ClientOnly>
</div>
</template>
<script setup lang="ts">
import { useDocumentsStore, useCategoriesStore } from './store';
+
// @ts-ignore
-useDocumentsStore().fetch({ fields: ['id', 'name', 'description', 'category', 'created_timestamp'] });
+useDocumentsStore().fetch();
useCategoriesStore().fetch();
+
</script>
-<style scoped>
+<style scoped lang="scss">
#app {
+ height: 100vh;
+ overflow: hidden;
display: flex;
flex-direction: column;
- height: 100vh;
- width: 100%;
- max-width: 100% !important;
}
-</style>
+
+@media print {
+ #app {
+ height: auto;
+ }
+}
+</style>
\ No newline at end of file
diff --git a/frontend/README.md b/frontend/README.md
index d90610e0..f5db2a2d 100644
--- a/frontend/README.md
+++ b/frontend/README.md
@@ -1,28 +1,41 @@
# Nuxt 3 Minimal Starter
-Look at the [nuxt 3 documentation](https://v3.nuxtjs.org) to learn more.
+Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install the dependencies:
```bash
-# yarn
-yarn install
-
# npm
npm install
# pnpm
-pnpm install --shamefully-hoist
+pnpm install
+
+# yarn
+yarn install
+
+# bun
+bun install
```
## Development Server
-Start the development server on http://localhost:3000
+Start the development server on `http://localhost:3000`:
```bash
+# npm
npm run dev
+
+# pnpm
+pnpm run dev
+
+# yarn
+yarn dev
+
+# bun
+bun run dev
```
## Production
@@ -30,13 +43,33 @@ npm run dev
Build the application for production:
```bash
+# npm
npm run build
+
+# pnpm
+pnpm run build
+
+# yarn
+yarn build
+
+# bun
+bun run build
```
Locally preview production build:
```bash
+# npm
npm run preview
+
+# pnpm
+pnpm run preview
+
+# yarn
+yarn preview
+
+# bun
+bun run preview
```
-Checkout the [deployment documentation](https://v3.nuxtjs.org/guide/deploy/presets) for more information.
+Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
diff --git a/frontend/bun.lockb b/frontend/bun.lockb
index bd125a28..60cd2135 100755
Binary files a/frontend/bun.lockb and b/frontend/bun.lockb differ
diff --git a/frontend/components/AppButton.vue b/frontend/components/AppButton.vue
deleted file mode 100644
index 3b4664cd..00000000
--- a/frontend/components/AppButton.vue
+++ /dev/null
@@ -1,45 +0,0 @@
-<template>
- <button :class="`button button--${style}`">
- <slot></slot>
- </button>
-</template>
-
-<script setup lang="ts">
-import { computed } from 'vue';
-
-const props = defineProps<{ type: string }>()
-const style = computed(() => props.type)
-
-</script>
-
-<style lang="scss" scoped>
-button {
- padding: 10px 20px;
- border-radius: 5px;
- border: none;
- color: white;
- cursor: pointer;
- font-size: 16px;
- transition: 0.3s;
-}
-
-.button--opposite {
- background-color: var(--font-color);
- color: var(--bg-color);
-
- &:hover {
- background-color: var(--font-color);
- }
-
-
-}
-
-.button--ghost {
- background-color: transparent;
- color: var(--font-color-dimmed);
-
- &:hover {
- background-color: var(--bg-color-secondary);
- }
-}
-</style>
diff --git a/frontend/components/Arrow.vue b/frontend/components/Arrow.vue
deleted file mode 100644
index 10195258..00000000
--- a/frontend/components/Arrow.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <svg :fill="colorMode.preference == 'light' ? '#fff' : '#000'" height="20px" width="20px" version="1.1" id="Layer_1"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 330 330"
- xml:space="preserve" stroke="#fff">
- <g id="SVGRepo_bgCarrier" stroke-width="0"></g>
- <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
- <g id="SVGRepo_iconCarrier">
- <path id="XMLID_27_"
- d="M15,180h263.787l-49.394,49.394c-5.858,5.857-5.858,15.355,0,21.213C232.322,253.535,236.161,255,240,255 s7.678-1.465,10.606-4.394l75-75c5.858-5.857,5.858-15.355,0-21.213l-75-75c-5.857-5.857-15.355-5.857-21.213,0 c-5.858,5.857-5.858,15.355,0,21.213L278.787,150H15c-8.284,0-15,6.716-15,15S6.716,180,15,180z">
- </path>
- </g>
- </svg>
-</template>
-
-
-<style scoped>
-svg {
- display: inline-block;
-}
-</style>
-<script setup lang="ts">
-const colorMode = useColorMode()
-</script>
\ No newline at end of file
diff --git a/frontend/components/BackToTop.vue b/frontend/components/BackToTop.vue
index 589e5f91..31bfe72c 100644
--- a/frontend/components/BackToTop.vue
+++ b/frontend/components/BackToTop.vue
@@ -4,23 +4,20 @@
</template>
<script setup lang="ts">
-
const scrollTop = ref(0);
-
-const getScrollTop = () => document.documentElement.scrollTop || document.body.scrollTop || 0;
-const scrollToTop = () => window.scrollTo({ top: 0, behavior: 'smooth' });
-
+const scroll_element = document.getElementById('app-scroll')!;
+const getScrollTop = () => scroll_element.scrollTop || 0;
+const scrollToTop = () => scroll_element.scrollTo({ top: 0, behavior: 'smooth' });
const show = computed(() => scrollTop.value > 300);
-
-const onScroll = () => {
- scrollTop.value = getScrollTop();
-};
+const onScroll = () => scrollTop.value = getScrollTop()
onMounted(() => {
scrollTop.value = getScrollTop();
- window.addEventListener('scroll', onScroll);
+ scroll_element.addEventListener('scroll', onScroll);
+});
+onUnmounted(() => {
+ scroll_element.removeEventListener('scroll', onScroll);
});
-
</script>
<style scoped lang="scss">
diff --git a/dashboard/components/DocumentCardFooter.vue b/frontend/components/DocumentCardFooter.vue
similarity index 100%
rename from dashboard/components/DocumentCardFooter.vue
rename to frontend/components/DocumentCardFooter.vue
diff --git a/dashboard/components/DocumentCardHeader.vue b/frontend/components/DocumentCardHeader.vue
similarity index 100%
rename from dashboard/components/DocumentCardHeader.vue
rename to frontend/components/DocumentCardHeader.vue
diff --git a/dashboard/components/DocumentCardHeaderActionRow.vue b/frontend/components/DocumentCardHeaderActionRow.vue
similarity index 100%
rename from dashboard/components/DocumentCardHeaderActionRow.vue
rename to frontend/components/DocumentCardHeaderActionRow.vue
diff --git a/frontend/components/DocumentFooter.vue b/frontend/components/DocumentFooter.vue
deleted file mode 100644
index 47712092..00000000
--- a/frontend/components/DocumentFooter.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-<template>
- <footer>
- <p class="update">Dernière mise à jour le {{ new Date(parseInt(document.updated_timestamp)).toLocaleDateString() }}
- </p>
- <div class="items">
- <div v-if="previous" class="item left">
- <NuxtLink :to="`/docs/${previous.category}/${previous.id}`">
- <b class="min">Page précédente</b>
- {{ previous.name }}
- </NuxtLink>
- </div>
- <div v-if="next" class="item right">
- <NuxtLink :to="`/docs/${next.category}/${next.id}`">
- <b class="min">Page suivante</b>
- {{ next.name }}
- </NuxtLink>
- </div>
- </div>
- </footer>
-</template>
-
-<script lang="ts" setup>
-import type { Document } from "@/store";
-
-defineProps<{
- document: Document;
- next?: Document;
- previous?: Document;
-}>();
-</script>
-
-<style scoped lang="scss">
-footer {
- margin: 50px 0 40px;
-}
-
-@media screen and (min-width: 768px) {
- .items {
- display: flex;
- justify-content: space-between;
- }
-
- .item {
- max-width: 400px;
- }
-}
-
-.item {
- width: 100%;
- border-radius: 7px;
- border: 1px solid var(--border-color);
- padding: 10px;
- margin: 5px 0;
- font-weight: 600;
- font-size: 15px;
- transition: border .25s;
-
- b {
- display: block;
- }
-
- &:hover {
- border: 1px solid $primary-400;
- }
-}
-
-
-.right {
- margin-left: auto;
- text-align: right;
-}
-
-.left {
- margin-right: auto;
- text-align: left;
-}
-
-.min {
- font-size: small;
-}
-
-.update {
- border-bottom: 1px solid lighten($grey, 20%);
-}
-</style>
\ No newline at end of file
diff --git a/frontend/components/Icon.vue b/frontend/components/Icon.vue
deleted file mode 100644
index 9799eb8b..00000000
--- a/frontend/components/Icon.vue
+++ /dev/null
@@ -1,28 +0,0 @@
-<template>
- <i :class="name" v-html="svg"></i>
-</template>
-
-<script lang="ts" setup>
-defineProps<{ name?: string; big?: boolean, svg?: string }>();
-
-</script>
-
-<style lang="scss" scoped>
-i {
- width: 50px;
- height: 50px;
- display: flex;
- justify-content: center; // Centrage horizontal
- align-items: center; // Centrage vertical
-
- &:deep(svg) {
- fill: $primary-400;
- width: 20px;
- height: 20px;
-
- path {
- fill: $primary-400;
- }
- }
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
similarity index 100%
rename from dashboard/components/MarkdownEditor/LazyMarkdownEditor.vue
rename to frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
diff --git a/dashboard/components/MarkdownEditor/LazyToolbar.vue b/frontend/components/MarkdownEditor/LazyToolbar.vue
similarity index 100%
rename from dashboard/components/MarkdownEditor/LazyToolbar.vue
rename to frontend/components/MarkdownEditor/LazyToolbar.vue
diff --git a/dashboard/components/MarkdownEditor/utils.ts b/frontend/components/MarkdownEditor/utils.ts
similarity index 100%
rename from dashboard/components/MarkdownEditor/utils.ts
rename to frontend/components/MarkdownEditor/utils.ts
diff --git a/dashboard/components/MediumView.vue b/frontend/components/MediumView.vue
similarity index 100%
rename from dashboard/components/MediumView.vue
rename to frontend/components/MediumView.vue
diff --git a/dashboard/components/Modal.vue b/frontend/components/Modal.vue
similarity index 100%
rename from dashboard/components/Modal.vue
rename to frontend/components/Modal.vue
diff --git a/frontend/components/Navbar.vue b/frontend/components/Navbar.vue
index c0698b04..670e3f33 100644
--- a/frontend/components/Navbar.vue
+++ b/frontend/components/Navbar.vue
@@ -1,68 +1,31 @@
<template>
<header>
<span>
- <svg v-if="hasSidebar" @click="isOpened = !isOpened" class="open-sidebar" xmlns="http://www.w3.org/2000/svg"
- height="24" viewBox="0 -960 960 960" width="24">
+ <svg v-if="hasSidebar" @click="toggleSidebar" class="open-sidebar" xmlns="http://www.w3.org/2000/svg" height="24"
+ viewBox="0 -960 960 960" width="24">
<path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z" />
</svg>
</span>
- <ul>
- <li>
- <NuxtLink class="no-mobile" to="/">Home</NuxtLink>
- </li>
- <li class="no-mobile">
- <NuxtLink to="https://dashboard.alexandrie-hub.fr" target="_blank">Dashboard</NuxtLink>
- </li>
- <li>
- <Search />
- </li>
- <li>
- <NuxtLink to="https://github.com/Smaug6739" target="_blank">
- <Icon
- svg='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>' />
- </NuxtLink>
- </li>
- <li>
- <ThemeToggle />
- </li>
- </ul>
+ <ThemeToggle />
</header>
</template>
<style lang="scss" scoped>
header {
width: 100%;
- height: 60px;
+ height: 100%;
display: flex;
justify-content: space-between;
+ padding: 15px;
}
.open-sidebar {
width: 30px;
height: 30px;
fill: var(--font-color);
- margin: 15px;
cursor: pointer;
}
-
-.dropdown-item {
- display: block;
- padding: 4px;
- font-size: calc(100% - 1px);
-}
-
-ul {
- list-style: none;
- padding: 0;
- display: flex;
- align-items: center;
-
- li {
- margin-right: 15px;
- }
-}
-
// Mobile styles
@media screen and (max-width: 719px) {
.no-mobile {
@@ -71,9 +34,5 @@ ul {
}
</style>
<script lang="ts" setup>
-import Search from "./Search.vue";
-import Icon from "./Icon.vue";
-
-import { hasSidebar, isOpened } from "@/components/sidebar/helpers";
-
+const { toggleSidebar, hasSidebar } = useSidebar();
</script>
\ No newline at end of file
diff --git a/dashboard/components/Notification/Notification.vue b/frontend/components/Notification/Notification.vue
similarity index 100%
rename from dashboard/components/Notification/Notification.vue
rename to frontend/components/Notification/Notification.vue
diff --git a/frontend/components/Search.vue b/frontend/components/Search.vue
deleted file mode 100644
index 846cce90..00000000
--- a/frontend/components/Search.vue
+++ /dev/null
@@ -1,115 +0,0 @@
-<template>
- <div class="search-box">
- <input v-model="inputText" type="text" placeholder="Search..." @focus="isActive = true" @blur="isActive = false"
- ref="inputElement" />
- <ul v-if="isActive && inputText.length > 0" class="suggestions">
- <li v-if="results.length" v-for="result in results" :key="result.id" class="suggestion"
- @mousedown="(e) => e.preventDefault()">
- <NuxtLink :to="result.path" @click="leave()"> {{ result.name }} </NuxtLink>
- </li>
- <li v-else>Aucun résultat...</li>
- </ul>
- </div>
-</template>
-
-<style scoped lang="scss">
-input {
- width: 200px;
- height: 2.1rem;
- border-radius: .5rem;
- border: none;
- padding: 0 0.5rem 0 2rem;
- transition: all ease $transition-duration;
- background: var(--bg-contrast) url('/svg/search.svg') 0.6rem 0.55rem no-repeat;
- outline: none;
-}
-
-input:focus {
- width: 260px;
-}
-
-ul {
- margin: 0;
- padding: 0;
- list-style: none;
-}
-
-
-.search-box {
- display: inline-block;
- position: relative;
-}
-
-.suggestions {
- background: var(--bg-color);
- width: 20rem;
- position: absolute;
- top: 2.5rem;
- right: 0;
- border: 1px solid var(--border-color);
- border-radius: 6px;
- padding: 0.3rem;
- list-style-type: none;
- z-index: 2;
-}
-
-.suggestion {
- line-height: 1.4;
- border-radius: 4px;
- cursor: pointer;
- margin: 0;
- padding: 0.4em;
- font-size: calc(100% - 2px);
-
- &:hover {
- background: var(--bg-contrast);
- }
-
- a {
- display: block;
- }
-
-}
-
-
-@media (max-width: 768px) {
- input:focus {
- width: 12.5rem;
- }
-}
-
-@media (max-width: 719px) {
- input {
- width: 10rem;
- }
-}
-</style>
-
-<script setup lang="ts">
-import { useCategoriesStore, useDocumentsStore } from "@/store";
-
-const inputText = ref("");
-const inputElement = ref<HTMLInputElement>();
-const isActive = ref(false);
-
-const categories = useCategoriesStore();
-const documents = useDocumentsStore();
-
-// Return max 5 results
-const results = computed(() => {
- if (!inputText.value) return [];
- const results = [];
- const categoryResults = categories.search(inputText.value).map(c => ({ id: c.id, name: c.name, path: `/docs/${c.id}` }));
- const articleResults = documents.search(inputText.value).map(a => ({ id: a.id, name: a.name, path: `/docs/${a.category}/${a.id}` }));
-
- results.push(...categoryResults);
- results.push(...articleResults);
-
- return results.slice(0, 5);
-});
-const leave = () => {
- isActive.value = false;
- inputText.value = "";
- inputElement.value?.blur();
-};
-</script>
\ No newline at end of file
diff --git a/frontend/components/ThemeToggle.vue b/frontend/components/ThemeToggle.vue
index e1299445..a31146cb 100644
--- a/frontend/components/ThemeToggle.vue
+++ b/frontend/components/ThemeToggle.vue
@@ -1,5 +1,5 @@
<template>
- <button @click="toggleColorMode" class="theme-toggle-button">
+ <button @click="toggleColorMode">
<svg v-if="colorMode.value === 'light'" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
@@ -25,13 +25,7 @@
<script setup lang="ts">
const colorMode = useColorMode();
-function toggleColorMode() {
- if (colorMode.value === 'light') {
- colorMode.preference = 'dark';
- } else {
- colorMode.preference = 'light';
- }
-}
+const toggleColorMode = () => colorMode.value === 'light' ? colorMode.preference = 'dark' : colorMode.preference = 'light';
</script>
<style scoped lang="scss">
@@ -46,6 +40,5 @@ button {
cursor: pointer;
padding: 0;
margin: 0;
- height: 50px;
}
</style>
\ No newline at end of file
diff --git a/dashboard/components/sidebar/Collapse.vue b/frontend/components/sidebar/Collapse.vue
similarity index 100%
rename from dashboard/components/sidebar/Collapse.vue
rename to frontend/components/sidebar/Collapse.vue
diff --git a/dashboard/components/sidebar/CollapseItem.vue b/frontend/components/sidebar/CollapseItem.vue
similarity index 100%
rename from dashboard/components/sidebar/CollapseItem.vue
rename to frontend/components/sidebar/CollapseItem.vue
diff --git a/dashboard/components/sidebar/IconApp.vue b/frontend/components/sidebar/IconApp.vue
similarity index 100%
rename from dashboard/components/sidebar/IconApp.vue
rename to frontend/components/sidebar/IconApp.vue
diff --git a/dashboard/components/sidebar/IconClose.vue b/frontend/components/sidebar/IconClose.vue
similarity index 100%
rename from dashboard/components/sidebar/IconClose.vue
rename to frontend/components/sidebar/IconClose.vue
diff --git a/dashboard/components/sidebar/Resizable.vue b/frontend/components/sidebar/Resizable.vue
similarity index 100%
rename from dashboard/components/sidebar/Resizable.vue
rename to frontend/components/sidebar/Resizable.vue
diff --git a/frontend/components/sidebar/Sidebar.vue b/frontend/components/sidebar/Sidebar.vue
index a3f25e32..aa40c9e2 100644
--- a/frontend/components/sidebar/Sidebar.vue
+++ b/frontend/components/sidebar/Sidebar.vue
@@ -1,160 +1,103 @@
<template>
- <aside class="sidebar" :class="isOpened ? 'open' : ''">
- <section class="header">
- <NuxtLink to="/" class="name" @click="isOpened = false">
- <Icon
- svg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M600-40q-33 0-56.5-23.5T520-120q0-23 11-41t29-29v-221q-18-11-29-28.5T520-480q0-33 23.5-56.5T600-560q33 0 56.5 23.5T680-480q0 23-11 40.5T640-411v115l160-53v-62q-18-11-29-28.5T760-480q0-33 23.5-56.5T840-560q33 0 56.5 23.5T920-480q0 23-11 40.5T880-411v119l-240 80v22q18 11 29 29t11 41q0 33-23.5 56.5T600-40ZM160-160v-560 560Zm0 0q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480h280v80H160Z"/></svg>' />
- Alexandrie
- </NuxtLink>
- <Icon
- svg='<svg class="btn" @click="isOpened = !isOpened" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd"d="M4 5C3.44772 5 3 5.44772 3 6C3 6.55228 3.44772 7 4 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5H4ZM7 12C7 11.4477 7.44772 11 8 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H8C7.44772 13 7 12.5523 7 12ZM13 18C13 17.4477 13.4477 17 14 17H20C20.5523 17 21 17.4477 21 18C21 18.5523 20.5523 19 20 19H14C13.4477 19 13 18.5523 13 18Z" /></svg>'
- id="btn" @click="isOpened = !isOpened" />
- </section>
-
- <section class="body">
- <SidebarSearch :isOpened="isOpened" :isSearch="true" searchPlaceholder="Search..."
- @search="(val: string) => searchInput = val" @open="isOpened = true" />
- <SidebarGroup v-for="(menuItem, index) of menuItems" :key="index" :menuItem="menuItem" :isOpened="isOpened"
- @closeMobile="isMobile() ? isOpened = false : null" />
- </section>
- </aside>
+ <Resizable>
+ <div class="sidebar-content">
+ <section class="header">
+ <IconApp />
+ <NuxtLink style="font-size: 19px;font-weight: 600;" to="/">Dashboard</NuxtLink>
+ <IconClose class="btn" />
+ </section>
+ <CollapseItem v-for="(item, index) in items " :key="index" :item="item" :root="true" />
+ </div>
+ </Resizable>
</template>
<script setup lang="ts">
-import SidebarGroup from './SidebarGroup.vue';
-import SidebarSearch from './SidebarSearch.vue';
-import Icon from "@/components/Icon.vue";
-
-import { hasSidebar, isOpened } from "./helpers"
-import { useDocumentsStore, useCategoriesStore } from '@/store';
-
-import type { MenuItem } from './types'
-
-const route = useRoute();
-const documentsStore = useDocumentsStore();
+import CollapseItem from './CollapseItem.vue';
+import Resizable from './Resizable.vue';
+import IconClose from './IconClose.vue';
+import IconApp from './IconApp.vue';
+import { useCategoriesStore, useDocumentsStore, type Category } from '~/store';
+import { ItemsManager, type Item } from './tree_builder';
+import { navigationItems } from "./helpers";
+
+const { isOpened, hasSidebar } = useSidebar();
const categoriesStore = useCategoriesStore();
-
-const searchInput = ref('');
+const documentsStore = useDocumentsStore();
const isMobile = () => process.client ? window.innerWidth <= 768 : false;
-// Handle click outside
+const items = computed((): Item[] => {
+ const navigation: Item[] = navigationItems.map((item) => ({ id: item.id, parent_id: '', title: item.title, route: item.route, icon: item.icon, type: 'navigation', data: item }))
+ const categories: Item[] = categoriesStore.categories.map((category: Category) => ({
+ id: category.id,
+ parent_id: category.parent_id || '',
+ title: category.name,
+ route: category.parent_id ? `/dashboard/category/${category.id}` : '',
+ icon: category.icon,
+ data: category,
+ }));
+ const documents: Item[] = documentsStore.documents.map((document) => ({
+ id: document.id,
+ parent_id: document.parent_id || document.category || '',
+ title: document.name,
+ route: `/dashboard/doc/${document.id}`,
+ data: document
+ }))
+
+ return new ItemsManager([...navigation, ...documents, ...categories]).generateTree()
+});
+
+
const handleClickOutside = (e: MouseEvent) => {
- if (isOpened.value && e.target && (!(e.target as Element).closest('.sidebar') && !(e.target as Element).closest('.open-sidebar')) && isMobile()) isOpened.value = false;
+ if (isOpened.value && e.target && (!(e.target as Element).closest('.sidebar') && !(e.target as Element).closest('.open-sidebar'))) isOpened.value = false;
};
onMounted(() => {
- hasSidebar.value = true;
- if (!process.client) return;
- isMobile() ? isOpened.value = false : isOpened.value = true;
- window.addEventListener('click', handleClickOutside);
+ hasSidebar.value = true;
+ if (isMobile()) return window.addEventListener('click', handleClickOutside);
+ isOpened.value = true;
});
onBeforeUnmount(() => {
- hasSidebar.value = false;
- if (!process.client) return;
- window.removeEventListener('click', handleClickOutside);
+ hasSidebar.value = false;
+ window.removeEventListener('click', handleClickOutside);
});
-
// Watch isOpened
-watch(isOpened, (val: boolean) => {
- if (process.client && val && isMobile()) document.getElementById('backdrop')?.classList.add('backdrop');
- if (process.client && !val && isMobile()) document.getElementById('backdrop')?.classList.remove('backdrop');
-});
-
-const menuItems = computed((): MenuItem[] => {
- const items: MenuItem[] = [];
- const category = categoriesStore.getById(route.params.category as string);
- if (!category) return items;
- const subCategories = categoriesStore.getChilds(category?.parent_id || category?.id)
- if (!subCategories) return items;
- for (const category of subCategories) {
- items.push({
- id: category.id,
- name: category.name,
- icon: category.icon,
- childrens: documentsStore.getByCategories(category.id).map(doc => ({
- id: doc.id,
- name: doc.name,
- link: `/docs/${category.parent_id}/${doc.id}`,
- }))
- });
- }
- // Handle search input
- if (searchInput.value) {
- const copy = items;
- copy.forEach(item => {
- item.childrens = item.childrens.filter(child => child.name.toLowerCase().includes(searchInput.value.toLowerCase()));
- });
- return copy.filter(item => item.childrens.length > 0);
- }
- return items;
-})
+if (isMobile()) {
+ watch(isOpened, (val) => {
+ if (val) document.getElementById('backdrop')?.classList.add('backdrop');
+ else document.getElementById('backdrop')?.classList.remove('backdrop');
+ });
+}
</script>
-<style lang="scss" scoped>
-.sidebar {
- display: flex;
- flex-direction: column;
- position: fixed;
- left: 0; // comment to fix sidebar with content
- top: 0;
- min-height: min-content;
- z-index: 100;
- transition: all $transition-duration ease;
- background: var(--bg-color);
- height: 100%;
- width: 300px;
- // No visible with transition
- transform: translateX(-300px);
- background-color: var(--bg-contrast);
- &.open {
- transform: translateX(0);
- }
+<style scoped lang="scss">
+.sidebar-content {
+ margin: 0 0 0 10px;
+ background: var(--bg-color);
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ overflow-y: scroll;
}
.header {
- height: 60px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin: 6px 14px 0 14px;
-
- #btn {
- display: block;
- text-align: right;
- font-size: 27px;
- cursor: pointer;
- transition: all $transition-duration ease;
- }
-
- .name {
- font-size: 19px;
- font-weight: 600;
- display: flex;
- align-items: center;
- }
-}
-
-.body {
- overflow-y: auto;
- height: 100%;
- overflow-x: hidden;
- display: flex;
- flex-direction: column;
- flex-grow: 1;
- height: calc(100% - 60px);
- margin: 0 7px;
-
- &::-webkit-scrollbar {
- width: 5px;
- }
-}
-
-@media screen and (min-width: 768px) {
- #btn {
- display: none !important;
- }
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ height: 50px;
+ margin: 10px 0 15px 0;
+
+ .btn {
+ fill: var(--font-color);
+ width: 30px;
+ cursor: pointer;
+ }
+
+ .name {
+ font-size: 1.2rem;
+ font-weight: 500;
+ }
}
-</style>
+</style>
\ No newline at end of file
diff --git a/frontend/components/sidebar/SidebarGroup.vue b/frontend/components/sidebar/SidebarGroup.vue
deleted file mode 100644
index 5fe3181c..00000000
--- a/frontend/components/sidebar/SidebarGroup.vue
+++ /dev/null
@@ -1,76 +0,0 @@
-<template>
- <div class="sidebar-group">
- <NuxtLink class="parent" @click="emit('closeMobile')" :to="`/docs/${menuItem.id}`">
- <Icon :svg="menuItem.icon" />
- <span class="parent_name">{{ menuItem.name }}</span>
- </NuxtLink>
- <ul>
- <li v-for="(children, index) of menuItem.childrens" :key="index" class="children" @click="emit('closeMobile')">
- <NuxtLink :to="children.link" class="sub_link">{{ children.name }}</NuxtLink>
- </li>
- </ul>
- </div>
-</template>
-
-<script lang="ts" setup>
-import Icon from "@/components/Icon.vue";
-import type { MenuItem } from './types';
-
-defineProps<{ menuItem: MenuItem }>();
-const emit = defineEmits(['closeMobile']);
-</script>
-
-<style lang="scss" scoped>
-.sidebar-group {
- margin-top: 5px;
- width: 97%;
-}
-
-.parent {
- display: flex;
- border-radius: 12px;
- align-items: center;
- transition: all 0.8s ease;
-
- .parent_name {
- opacity: 1;
- pointer-events: auto;
- }
-
- &:hover {
- transition: all $transition-duration ease;
- background: var(--bg-contrast-2);
-
- .parent_name {
- color: $primary-400;
- }
- }
-}
-
-.children {
- padding: 5px;
- text-align: left;
- font-size: 0.95rem;
- line-height: 1rem;
- list-style: none;
-}
-
-.parent_name {
- font: normal 700 15px arial;
- opacity: 0;
- transition: $transition-duration;
-}
-
-.sub_link {
- margin-left: 30px;
-}
-
-ul {
- padding: 0;
- margin: 0;
-
- li {
- margin: 10px 0;
- }
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/components/sidebar/SidebarItem.vue b/frontend/components/sidebar/SidebarItem.vue
similarity index 100%
rename from dashboard/components/sidebar/SidebarItem.vue
rename to frontend/components/sidebar/SidebarItem.vue
diff --git a/frontend/components/sidebar/SidebarSearch.vue b/frontend/components/sidebar/SidebarSearch.vue
deleted file mode 100644
index d9212a29..00000000
--- a/frontend/components/sidebar/SidebarSearch.vue
+++ /dev/null
@@ -1,42 +0,0 @@
-<template>
- <span>
- <Icon
- svg='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" width="24"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>'
- class="icon" />
- <input type="text" :placeholder="searchPlaceholder"
- @input="(v) => emit('search', (v.target as HTMLInputElement).value)" />
- </span>
-</template>
-
-<script lang="ts" setup>
-import Icon from "@/components/Icon.vue";
-
-defineProps<{ searchPlaceholder: string }>();
-const emit = defineEmits(['search']);
-</script>
-
-<style lang="scss" scoped>
-input {
- outline: none;
- height: 50px;
- border: none;
- border-radius: 12px;
- transition: all $transition-duration ease;
- background: var(--bg-contrast-2);
- font-size: 15px;
- color: var(--font-color);
- padding: 0 20px 0 50px;
- width: 97%;
-}
-
-span {
- margin-top: 25px;
- position: relative;
-}
-
-.icon {
- position: absolute;
- top: 0;
- left: 0;
-}
-</style>
\ No newline at end of file
diff --git a/frontend/components/sidebar/helpers.ts b/frontend/components/sidebar/helpers.ts
index b4be9007..ac616308 100644
--- a/frontend/components/sidebar/helpers.ts
+++ b/frontend/components/sidebar/helpers.ts
@@ -1,5 +1,54 @@
-import { ref } from 'vue';
+export interface DefaultItem {
+ id: string;
+ type: 'default';
+ title: string;
+ icon?: string;
+ route: string;
+ childrens: DefaultItem[];
+}
-export const hasSidebar = ref(false);
-
-export const isOpened = ref(false);
+export const navigationItems: DefaultItem[] = [
+ {
+ id: 'manage-categories',
+ type: 'default',
+ title: 'Manage categories',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-320h480v-480h-80v280l-100-60-100 60v-280H320v480Zm0 80q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm360-720h200-200Zm-200 0h480-480Z"/></svg>',
+ route: '/dashboard/categories',
+ childrens: [],
+ },
+ {
+ id: 'cdn',
+ type: 'default',
+ title: 'CDN',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M485-440h163q26 0 44-18t18-44q0-26-18-44.5T648-565h-2q-5-32-29-53.5T560-640q-26 0-47 13.5T481-590q-30 2-50.5 23.5T410-515q0 30 21.5 52.5T485-440ZM120-120q-33 0-56.5-23.5T40-200v-520h80v520h680v80H120Zm160-160q-33 0-56.5-23.5T200-360v-440q0-33 23.5-56.5T280-880h200l80 80h280q33 0 56.5 23.5T920-720v360q0 33-23.5 56.5T840-280H280Zm0-80h560v-360H527l-80-80H280v440Zm0 0v-440 440Z"/></svg>',
+ route: '/dashboard/cdn',
+ childrens: [],
+ },
+ {
+ id: 'backup',
+ type: 'default',
+ title: 'Backup',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M260-160q-91 0-155.5-63T40-377q0-78 47-139t123-78q17-72 85-137t145-65q33 0 56.5 23.5T520-716v242l64-62 56 56-160 160-160-160 56-56 64 62v-242q-76 14-118 73.5T280-520h-20q-58 0-99 41t-41 99q0 58 41 99t99 41h480q42 0 71-29t29-71q0-42-29-71t-71-29h-60v-80q0-48-22-89.5T600-680v-93q74 35 117 103.5T760-520q69 8 114.5 59.5T920-340q0 75-52.5 127.5T740-160H260Zm220-358Z"/></svg>',
+ route: '/dashboard/backup',
+ childrens: [],
+ },
+ {
+ id: 'new-page',
+ type: 'default',
+ title: 'New page',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-160h160v-80H520v-160h-80v160H280v80h160v160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>',
+ route: '/dashboard/new',
+ childrens: [],
+ },
+];
+export const icons = {
+ draft:
+ '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--turquoise)" d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',
+ folder:
+ '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--yellow);" d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>',
+ file: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--pink);" d="M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',
+ file_parent:
+ '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--green);" d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h240v-560H200v560Zm320 0h240v-280H520v280Zm0-360h240v-200H520v200Z"/></svg>',
+ archive:
+ '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path style="fill:var(--grey)" d="M200-120v-640q0-33 23.5-56.5T280-840h400q33 0 56.5 23.5T760-760v640L480-240 200-120Zm80-122 200-86 200 86v-518H280v518Zm0-518h400-400Z"/></svg>',
+};
diff --git a/dashboard/components/sidebar/tree_builder.ts b/frontend/components/sidebar/tree_builder.ts
similarity index 100%
rename from dashboard/components/sidebar/tree_builder.ts
rename to frontend/components/sidebar/tree_builder.ts
diff --git a/frontend/components/sidebar/types.ts b/frontend/components/sidebar/types.ts
deleted file mode 100644
index 5779cbcb..00000000
--- a/frontend/components/sidebar/types.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export interface MenuItem {
- id: string;
- name: string;
- icon?: string;
- childrens: Children[];
-}
-interface Children {
- name: string;
- link: string;
-}
diff --git a/frontend/components/table-of-content/TableOfContents.vue b/frontend/components/table-of-content/TableOfContents.vue
index df79b994..f141aa0d 100644
--- a/frontend/components/table-of-content/TableOfContents.vue
+++ b/frontend/components/table-of-content/TableOfContents.vue
@@ -1,59 +1,59 @@
+<template>
+ <aside>
+ <ul ref="list" class="toc">
+ <h4>Table des matières</h4>
+ <NodeTree v-if="headers.length" v-for="header of headers_tree" :node="header" :key="header.link" />
+ <p v-else>Aucun élément à afficher</p>
+ </ul>
+ </aside>
+</template>
<script lang="ts" setup>
-
-import { ref, onBeforeUnmount, watch, computed } from "vue";
import NodeTree from './NodeTree.vue';
-import type { GroupedHeaders } from "./types"
-
-const props = defineProps<{ element: HTMLElement; }>();
-const headers = computed(() => groupHeadersByLevels(props.element));
+const props = defineProps<{ element?: HTMLElement }>();
const list = ref<HTMLElement>();
-function getAllHeadersElements(element: HTMLElement): HTMLElement[] {
- if (!element) return [];
- const updatedHeaders: HTMLElement[] = [];
- element
- .querySelectorAll<HTMLHeadingElement>('h2, h3')
- .forEach((el) => {
- if (el.textContent && el.id) {
- updatedHeaders.push(el);
- }
- })
- return updatedHeaders;
+interface GroupedHeaders {
+ title: string;
+ link: string;
+ childrens: GroupedHeaders[];
}
+const getHeaders = (): HTMLElement[] => {
+ if (!props.element) return [];
+ const headers = props.element.querySelectorAll('h1, h2, h3, h4, h5, h6') as NodeListOf<HTMLElement>;
+ return Array.from(headers);
+};
-function groupHeadersByLevels(element: HTMLElement): GroupedHeaders[] {
- const elements = getAllHeadersElements(element);
- const groupedHeaders: GroupedHeaders[] = [];
- elements.forEach((el) => {
- if (el.tagName === 'H2') {
- groupedHeaders.push({
- title: el.innerText.split(' ').slice(1).join(' '),
- link: `#${el.id}`,
- })
+function buildTree(headers: HTMLElement[]): GroupedHeaders[] {
+ const tree: GroupedHeaders[] = [];
+ let currentLevel = -1;
+ let currentElement = tree;
+ for (const header of headers) {
+ const level = parseInt(header.tagName[1]);
+ const title = header.textContent?.replace(/#/g, '') || '';
+ const link = `#${header.id}`;
+ const node: GroupedHeaders = { title, link, childrens: [] };
+ if (currentLevel === -1) currentLevel = level;
+ if (level === currentLevel) {
+ currentElement.push(node);
+ } else if (level > currentLevel) {
+ currentElement[currentElement.length - 1].childrens = [node];
+ currentElement = currentElement[currentElement.length - 1].childrens;
+ currentLevel = level;
} else {
- const parent = groupedHeaders[groupedHeaders.length - 1];
- if (parent) {
- if (!parent.childrens) {
- parent.childrens = [];
- }
- parent.childrens.push({
- title: el.innerText.split(' ').slice(1).join(' '),
- link: `#${el.id}`,
- })
- }
+ currentElement = tree;
+ currentElement.push(node);
+ currentLevel = level;
}
- })
- return groupedHeaders
+ }
+ return tree;
}
+const headers = computed(() => getHeaders());
+const headers_tree = computed(() => buildTree(headers.value));
-const options = {
- root: null,
- threshold: 1,
-}
const observerCallback = (e: IntersectionObserverEntry[]) => {
e.forEach((entry) => {
const activeLink = list.value?.querySelector<HTMLAnchorElement>(`[href="#${entry.target.id}"]`)
@@ -64,40 +64,16 @@ const observerCallback = (e: IntersectionObserverEntry[]) => {
}
})
};
-if (process.client) {
- const observer = new IntersectionObserver(observerCallback, options)
- // Watch props.element for changes (= when article is loaded)
- watch(props, () => {
- observer.disconnect();
- const headings = getAllHeadersElements(props.element);
- // Track all headings
- headings.forEach((section) => observer.observe(section))
- });
-
- onBeforeUnmount(() => {
- observer.disconnect();
- })
-}
+const observer: IntersectionObserver = new IntersectionObserver(observerCallback, { root: null, threshold: 1 });
+watchEffect(() => {
+ headers.value.forEach((header) => observer.observe(header));
+});
+onBeforeUnmount(() => observer.disconnect())
</script>
-<template>
- <aside>
- <ul ref="list" class="toc">
- <h4>Table des matières</h4>
- <!--Recursive lists -->
- <NodeTree v-if="headers.length" v-for="header of headers" :node="header" />
- <p v-else>Aucun élément à afficher</p>
- </ul>
- </aside>
-</template>
-
<style lang="scss" scoped>
-aside {
- width: 100%;
-}
-
@media (min-width: 1280px) {
.toc {
position: sticky;
@@ -120,7 +96,5 @@ aside {
}
}
}
-
-
}
-</style>
\ No newline at end of file
+</style>
diff --git a/dashboard/composables/Sidebar.ts b/frontend/composables/Sidebar.ts
similarity index 100%
rename from dashboard/composables/Sidebar.ts
rename to frontend/composables/Sidebar.ts
diff --git a/dashboard/composables/utils.ts b/frontend/composables/utils.ts
similarity index 100%
rename from dashboard/composables/utils.ts
rename to frontend/composables/utils.ts
diff --git a/frontend/error.vue b/frontend/error.vue
deleted file mode 100644
index 8b74869a..00000000
--- a/frontend/error.vue
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--404 error page (not found )-->
-<template>
- <div>
- <div id="app-loader"></div>
- <div class="view-medium">
- <div class="error-template">
- <h1>
- Oops!</h1>
- <h2>
- 404 Not Found</h2>
- <div class="error-details">
- Sorry, an error has occured, Requested page not found! <br />
- <NuxtLink to="/">Take Me Home </NuxtLink>
- </div>
- </div>
- </div>
- </div>
-</template>
-<style scoped>
-h1,
-h2 {
- border: none;
-}
-
-.view-medium {
- margin-top: 200px;
- padding: 0 20px;
-}
-</style>
\ No newline at end of file
diff --git a/dashboard/helpers/markdown/anchor.ts b/frontend/helpers/markdown/anchor.ts
similarity index 100%
rename from dashboard/helpers/markdown/anchor.ts
rename to frontend/helpers/markdown/anchor.ts
diff --git a/dashboard/helpers/markdown/constants.ts b/frontend/helpers/markdown/constants.ts
similarity index 100%
rename from dashboard/helpers/markdown/constants.ts
rename to frontend/helpers/markdown/constants.ts
diff --git a/dashboard/helpers/markdown/container.ts b/frontend/helpers/markdown/container.ts
similarity index 100%
rename from dashboard/helpers/markdown/container.ts
rename to frontend/helpers/markdown/container.ts
diff --git a/dashboard/helpers/markdown/containers-svg.ts b/frontend/helpers/markdown/containers-svg.ts
similarity index 100%
rename from dashboard/helpers/markdown/containers-svg.ts
rename to frontend/helpers/markdown/containers-svg.ts
diff --git a/dashboard/helpers/markdown/index.ts b/frontend/helpers/markdown/index.ts
similarity index 100%
rename from dashboard/helpers/markdown/index.ts
rename to frontend/helpers/markdown/index.ts
diff --git a/dashboard/middleware/authentification.global.ts b/frontend/middleware/authentification.global.ts
similarity index 100%
rename from dashboard/middleware/authentification.global.ts
rename to frontend/middleware/authentification.global.ts
diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts
index 46e0080e..dd89e8e8 100644
--- a/frontend/nuxt.config.ts
+++ b/frontend/nuxt.config.ts
@@ -1,85 +1,55 @@
-import { resolve } from "path";
+import { resolve } from 'path';
+// favicon: 'https://alexandrie.fr/logo.svg',
export default defineNuxtConfig({
+ devtools: { enabled: true },
vite: {
css: {
preprocessorOptions: {
scss: {
- additionalData:
- '@use "../@alexandrie/styles/src/_variables.scss" as *;',
+ additionalData: '@use "../@alexandrie/styles/src/_variables.scss" as *;',
},
},
},
},
- routeRules: {
- // Enable Incremental Static Generation (ISG)
- //'/**': { swr: 300 },
- },
ssr: false,
css: [
- resolve(__dirname, "../@alexandrie/styles/src/main.scss"),
- "~/styles/main.scss",
- resolve(__dirname, "../@alexandrie/styles/src/katex/katex.min.css"),
- ],
- modules: [
- // ...
- "@pinia/nuxt",
- "@nuxtjs/color-mode",
+ resolve(__dirname, '../@alexandrie/styles/src/main.scss'),
+ '~/styles/main.scss',
+ resolve(__dirname, '../@alexandrie/styles/src/katex/katex.min.css'),
],
+ modules: ['@pinia/nuxt', '@nuxtjs/color-mode'],
+ colorMode: {
+ preference: 'light', // default value of $colorMode.preference
+ fallback: 'light', // fallback value if not system preference found
+ hid: 'nuxt-color-mode-script',
+ globalName: '__NUXT_COLOR_MODE__',
+ componentName: 'ColorScheme',
+ classPrefix: '',
+ classSuffix: '-mode',
+ storageKey: 'nuxt-color-mode',
+ },
experimental: {
viewTransition: true,
},
- colorMode: {
- preference: "light", // default value of $colorMode.preference
- fallback: "light", // fallback value if not system preference found
- hid: "nuxt-color-mode-script",
- globalName: "__NUXT_COLOR_MODE__",
- componentName: "ColorScheme",
- classPrefix: "",
- classSuffix: "-mode",
- storageKey: "nuxt-color-mode",
- },
+
app: {
head: {
- title: "Alexandrie",
- viewport: "width=device-width, initial-scale=1",
- charset: "utf-8",
+ title: 'Alexandrie dashboard',
+ viewport: 'width=device-width, initial-scale=1',
+ charset: 'utf-8',
htmlAttrs: {
- lang: "en",
+ lang: 'fr',
},
link: [
{
- rel: "manifest",
- crossorigin: "use-credentials",
- href: "/manifest.json",
+ rel: 'manifest',
+ crossorigin: 'use-credentials',
+ href: '/manifest.json',
},
- ],
- meta: [
- { name: "robots", content: "follow, index" },
- {
- name: "description",
- content:
- "Site web qui regroupe des notes/cours dans les domaines scientifiques.",
- },
-
- // Open Graph / Facebook
- { property: "og:type", content: "website" },
- { property: "og:title", content: "Alexandrie" },
- {
- property: "og:description",
- content:
- "Site web qui regroupe des notes/cours dans les domaines scientifiques.",
- },
- { property: "og:url", content: `https://alexandrie-hub.fr` },
- { property: "og:keywords", content: "Cours, notes" },
-
- // Twitter
- { name: "twitter:title", content: `Alexandrie` },
- { name: "twitter:creator", content: `@Smaug6739` },
- { name: "twitter:site", content: `Alexandrie` },
- { name: "twitter:url", content: `https://alexandrie-hub.fr` },
{
- name: "twitter:description",
- content: `Site web qui regroupe des notes/cours dans les domaines scientifiques.`,
+ rel: 'icon',
+ type: 'image/svg+xml',
+ href: '/favicon.svg',
},
],
},
diff --git a/frontend/package.json b/frontend/package.json
index d6330cad..7ed25a69 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,18 +1,34 @@
{
+ "name": "nuxt-app",
+ "devDependencies": {
+ "@nuxt/devtools": "latest",
+ "@nuxtjs/color-mode": "^3.3.3",
+ "@pinia/nuxt": "^0.5.0",
+ "@types/katex": "^0.16.5",
+ "@types/markdown-it": "^13.0.4",
+ "@types/markdown-it-container": "^2.0.8",
+ "@types/node": "^20.8.5",
+ "katex": "^0.16.10",
+ "markdown-it": "^14.1.0",
+ "markdown-it-anchor": "^8.6.7",
+ "markdown-it-container": "^4.0.0",
+ "markdown-it-mark": "^4.0.0",
+ "markdown-it-underline": "^1.0.1",
+ "nuxt": "^3.8.0",
+ "pinia": "^2.1.6",
+ "punycode": "^2.3.0",
+ "sass": "^1.69.3",
+ "vue": "^3.3.4",
+ "vue-router": "^4.2.5"
+ },
"private": true,
"scripts": {
"build": "nuxt build",
- "dev": "nuxt dev --host",
+ "dev": "nuxt dev",
+ "dev:host": "nuxt dev --host",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
- "devDependencies": {
- "@nuxtjs/color-mode": "^3.3.3",
- "@pinia/nuxt": "^0.5.1",
- "@types/node": "^20.8.9",
- "nuxt": "^3.8.0",
- "pinia": "^2.1.7",
- "sass": "^1.69.5"
- }
+ "type": "module"
}
diff --git a/dashboard/pages/dashboard.vue b/frontend/pages/dashboard.vue
similarity index 100%
rename from dashboard/pages/dashboard.vue
rename to frontend/pages/dashboard.vue
diff --git a/dashboard/pages/dashboard/backup.vue b/frontend/pages/dashboard/backup.vue
similarity index 100%
rename from dashboard/pages/dashboard/backup.vue
rename to frontend/pages/dashboard/backup.vue
diff --git a/dashboard/pages/dashboard/categories/edit.vue b/frontend/pages/dashboard/categories/edit.vue
similarity index 100%
rename from dashboard/pages/dashboard/categories/edit.vue
rename to frontend/pages/dashboard/categories/edit.vue
diff --git a/dashboard/pages/dashboard/categories/index.vue b/frontend/pages/dashboard/categories/index.vue
similarity index 100%
rename from dashboard/pages/dashboard/categories/index.vue
rename to frontend/pages/dashboard/categories/index.vue
diff --git a/dashboard/pages/dashboard/categories/new.vue b/frontend/pages/dashboard/categories/new.vue
similarity index 100%
rename from dashboard/pages/dashboard/categories/new.vue
rename to frontend/pages/dashboard/categories/new.vue
diff --git a/dashboard/pages/dashboard/category/[id].vue b/frontend/pages/dashboard/category/[id].vue
similarity index 100%
rename from dashboard/pages/dashboard/category/[id].vue
rename to frontend/pages/dashboard/category/[id].vue
diff --git a/dashboard/pages/dashboard/cdn.vue b/frontend/pages/dashboard/cdn.vue
similarity index 100%
rename from dashboard/pages/dashboard/cdn.vue
rename to frontend/pages/dashboard/cdn.vue
diff --git a/dashboard/pages/dashboard/doc/[id].vue b/frontend/pages/dashboard/doc/[id].vue
similarity index 100%
rename from dashboard/pages/dashboard/doc/[id].vue
rename to frontend/pages/dashboard/doc/[id].vue
diff --git a/dashboard/pages/dashboard/doc/edit/[id].vue b/frontend/pages/dashboard/doc/edit/[id].vue
similarity index 100%
rename from dashboard/pages/dashboard/doc/edit/[id].vue
rename to frontend/pages/dashboard/doc/edit/[id].vue
diff --git a/dashboard/pages/dashboard/edit.vue b/frontend/pages/dashboard/edit.vue
similarity index 100%
rename from dashboard/pages/dashboard/edit.vue
rename to frontend/pages/dashboard/edit.vue
diff --git a/dashboard/pages/dashboard/index.vue b/frontend/pages/dashboard/index.vue
similarity index 100%
rename from dashboard/pages/dashboard/index.vue
rename to frontend/pages/dashboard/index.vue
diff --git a/dashboard/pages/dashboard/new.vue b/frontend/pages/dashboard/new.vue
similarity index 100%
rename from dashboard/pages/dashboard/new.vue
rename to frontend/pages/dashboard/new.vue
diff --git a/frontend/pages/docs.vue b/frontend/pages/docs.vue
deleted file mode 100644
index 069f2576..00000000
--- a/frontend/pages/docs.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-<template>
- <main>
- <Sidebar />
- <NuxtPage />
- </main>
-</template>
-
-<style scoped>
-@media (min-width: 1700px) {
- main {
- padding-left: var(--padding);
- padding-right: var(--padding);
- }
-}
-</style>
\ No newline at end of file
diff --git a/frontend/pages/docs/[category]/[id].vue b/frontend/pages/docs/[category]/[id].vue
deleted file mode 100644
index 548a94da..00000000
--- a/frontend/pages/docs/[category]/[id].vue
+++ /dev/null
@@ -1,53 +0,0 @@
-<template>
- <Transition name="fade" mode="out-in">
- <div class="view-medium" v-if="article?.id" style="display:flex;">
- <div style="width:100%;">
- <article class="document-theme" style="max-width: 100%;overflow: auto;" ref="element"
- v-html="article.content_html"></article>
- <DocumentFooter :document="article" :next="next" :previous="previous" />
- </div>
- <TableOfContent :element="element" class="toc" />
- </div>
- </Transition>
-</template>
-<script lang="ts" setup>
-import { useRoute } from "vue-router";
-import { useDocumentsStore, type Document } from '@/store';
-import TableOfContent from "@/components/table-of-content/TableOfContents.vue";
-
-const route = useRoute();
-const doc_store = useDocumentsStore();
-const element = ref<HTMLElement>() as any;
-const document_id = route.params.id as string;
-const article = ref<Document>();
-
-watchEffect(async () => {
- const docFromStore = doc_store.getById(document_id);
- if (docFromStore?.partial) {
- try {
- article.value = await doc_store.fetch({ id: document_id });
- } catch (error) {
- console.error("Error fetching document:", error);
- }
- } else article.value = docFromStore;
-});
-
-const next = computed(() => doc_store.getNext(article.value));
-const previous = computed(() => doc_store.getPrevious(article.value));
-
-</script>
-
-
-<style scoped>
-.toc {
- display: none;
-}
-
-@media (min-width: 1280px) {
- .toc {
- display: block;
- margin-top: 40px;
- width: 400px;
- }
-}
-</style>
\ No newline at end of file
diff --git a/frontend/pages/docs/[category]/index.vue b/frontend/pages/docs/[category]/index.vue
deleted file mode 100644
index 374a4525..00000000
--- a/frontend/pages/docs/[category]/index.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-<template>
- <div class="view-medium">
- <h1>Documents de la catégorie {{ category?.name }}</h1>
- <div class="article-list">
- <div v-for="document in allDocuments" :key="document.id" class="article">
- <NuxtLink :to="`/docs/${document.category}/${document.id}`">{{ document.name }}</NuxtLink>
- <p class="excerpt">{{ document.description }}</p>
- </div>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { useCategoriesStore, useDocumentsStore } from '~/store';
-
-const route = useRoute();
-const categoriesStore = useCategoriesStore();
-const documentsStore = useDocumentsStore();
-
-const category = computed(() => categoriesStore.getById(route.params.category as string));
-
-const allDocuments = computed(() => {
- const documents = documentsStore.getByCategories(category.value?.id || '');
- const childCategories = categoriesStore.getChilds(category.value?.id || '');
- for (const childCategory of childCategories) {
- const childDocuments = documentsStore.getByCategories(childCategory.id);
- documents.push(...childDocuments);
- }
- return documents;
-});
-</script>
-
-
-<style scoped lang="scss">
-.article-list {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
- gap: 20px;
-}
-
-.article {
- background-color: var(--bg-contrast);
- padding: 15px;
- border-radius: 8px;
- position: relative;
- transition: box-shadow $transition-duration;
- margin-bottom: 10px;
-}
-
-h1 {
- font-size: 28px;
- margin-bottom: 20px;
-}
-
-a {
- font-size: 24px;
- font-weight: 600;
- margin: 0;
-}
-
-.excerpt {
- font-size: 16px;
- margin: 10px 0;
-}
-</style>
diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue
index 1d76e3e9..9c66814b 100644
--- a/frontend/pages/index.vue
+++ b/frontend/pages/index.vue
@@ -1,15 +1,14 @@
<template>
<div class="container">
- <main class="main-content">
+ <main>
<div class="content-wrapper">
<div class="intro">
<div class="intro-text">
<h1>Your Ideas, Documents & Plans. Unified. Welcome to <span>Alexandrie</span></h1>
<h3>Alexandrie is the connected workspace where <br /> better, faster work happens</h3>
</div>
- <div class="category-links">
- <NuxtLink v-for="category in categories" :key="category.id" :to="`/docs/${category.id}`"
- class="category-link">{{ category.name }}</NuxtLink>
+ <div class="get-started">
+ <NuxtLink to="/dashboard">Get started</NuxtLink>
</div>
</div>
<div class="images">
@@ -26,18 +25,12 @@
<footer>
<Logo />
<div class="footer-links none">
- <AppButton type="ghost">Privacy Policy</AppButton>
- <AppButton type="ghost">Terms of Service</AppButton>
</div>
</footer>
</div>
</template>
<script setup lang="ts">
-import { useCategoriesStore } from '~/store';
-import { computed } from 'vue';
-
-const categories = computed(() => useCategoriesStore().getParents);
const colorMode = useColorMode();
</script>
@@ -48,7 +41,7 @@ const colorMode = useColorMode();
flex-direction: column;
}
-.main-content {
+main {
flex-grow: 1;
padding-top: 1.5rem;
}
@@ -78,42 +71,27 @@ const colorMode = useColorMode();
text-decoration: none;
}
-.category-links {
- display: flex;
- justify-content: center;
- gap: 1rem;
- flex-wrap: wrap;
-}
-
-.none {
- display: none;
-}
+.get-started {
+ margin: 2rem 0;
-.category-link {
- background-color: var(--bg-contrast);
- border-radius: 8px;
- padding: 1rem;
- text-decoration: none;
- transition: background-color 0.3s ease, transform 0.3s ease;
+ a {
+ padding: 0.5rem 1rem;
+ border-radius: 0.5rem;
+ background-color: var(--font-color);
+ color: var(--bg-color);
+ font-weight: 500;
+ font-size: 1.2rem;
- &:hover {
- background-color: var(--bg-contrast-2);
- transform: translateY(-3px);
- }
- @media (min-width: 768px) {
- width: calc(33.33% - 1rem);
}
- @media (min-width: 1024px) {
- width: calc(25% - 1rem);
+ &:hover {
+ transform: scale(1.03)
}
}
-.button-text {
- display: flex;
- align-items: center;
- margin: 0;
+.none {
+ display: none;
}
.images {
diff --git a/dashboard/pages/login.vue b/frontend/pages/login.vue
similarity index 100%
rename from dashboard/pages/login.vue
rename to frontend/pages/login.vue
diff --git a/frontend/public/android-chrome-192x192.png b/frontend/public/android-chrome-192x192.png
index bdc6f7a8..ea62c18f 100644
Binary files a/frontend/public/android-chrome-192x192.png and b/frontend/public/android-chrome-192x192.png differ
diff --git a/frontend/public/android-chrome-512x512.png b/frontend/public/android-chrome-512x512.png
index 7767b757..63e8d8a9 100644
Binary files a/frontend/public/android-chrome-512x512.png and b/frontend/public/android-chrome-512x512.png differ
diff --git a/frontend/public/apple-touch-icon.png b/frontend/public/apple-touch-icon.png
index d0dc8bae..e17e3773 100644
Binary files a/frontend/public/apple-touch-icon.png and b/frontend/public/apple-touch-icon.png differ
diff --git a/dashboard/public/empty-dark.png b/frontend/public/empty-dark.png
similarity index 100%
rename from dashboard/public/empty-dark.png
rename to frontend/public/empty-dark.png
diff --git a/dashboard/public/empty-light.png b/frontend/public/empty-light.png
similarity index 100%
rename from dashboard/public/empty-light.png
rename to frontend/public/empty-light.png
diff --git a/frontend/public/favicon-16x16.png b/frontend/public/favicon-16x16.png
index 86e99f13..07c5fb70 100644
Binary files a/frontend/public/favicon-16x16.png and b/frontend/public/favicon-16x16.png differ
diff --git a/frontend/public/favicon-32x32.png b/frontend/public/favicon-32x32.png
index 8fd73ecb..3d24d79b 100644
Binary files a/frontend/public/favicon-32x32.png and b/frontend/public/favicon-32x32.png differ
diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico
deleted file mode 100644
index fe03aaa5..00000000
Binary files a/frontend/public/favicon.ico and /dev/null differ
diff --git a/dashboard/public/favicon.svg b/frontend/public/favicon.svg
similarity index 100%
rename from dashboard/public/favicon.svg
rename to frontend/public/favicon.svg
diff --git a/dashboard/public/katex/README.md b/frontend/public/katex/README.md
similarity index 100%
rename from dashboard/public/katex/README.md
rename to frontend/public/katex/README.md
diff --git a/dashboard/public/katex/contrib/auto-render.js b/frontend/public/katex/contrib/auto-render.js
similarity index 100%
rename from dashboard/public/katex/contrib/auto-render.js
rename to frontend/public/katex/contrib/auto-render.js
diff --git a/dashboard/public/katex/contrib/auto-render.min.js b/frontend/public/katex/contrib/auto-render.min.js
similarity index 100%
rename from dashboard/public/katex/contrib/auto-render.min.js
rename to frontend/public/katex/contrib/auto-render.min.js
diff --git a/dashboard/public/katex/contrib/auto-render.mjs b/frontend/public/katex/contrib/auto-render.mjs
similarity index 100%
rename from dashboard/public/katex/contrib/auto-render.mjs
rename to frontend/public/katex/contrib/auto-render.mjs
diff --git a/dashboard/public/katex/contrib/copy-tex.js b/frontend/public/katex/contrib/copy-tex.js
similarity index 100%
rename from dashboard/public/katex/contrib/copy-tex.js
rename to frontend/public/katex/contrib/copy-tex.js
diff --git a/dashboard/public/katex/contrib/copy-tex.min.js b/frontend/public/katex/contrib/copy-tex.min.js
similarity index 100%
rename from dashboard/public/katex/contrib/copy-tex.min.js
rename to frontend/public/katex/contrib/copy-tex.min.js
diff --git a/dashboard/public/katex/contrib/copy-tex.mjs b/frontend/public/katex/contrib/copy-tex.mjs
similarity index 100%
rename from dashboard/public/katex/contrib/copy-tex.mjs
rename to frontend/public/katex/contrib/copy-tex.mjs
diff --git a/dashboard/public/katex/contrib/mathtex-script-type.js b/frontend/public/katex/contrib/mathtex-script-type.js
similarity index 100%
rename from dashboard/public/katex/contrib/mathtex-script-type.js
rename to frontend/public/katex/contrib/mathtex-script-type.js
diff --git a/dashboard/public/katex/contrib/mathtex-script-type.min.js b/frontend/public/katex/contrib/mathtex-script-type.min.js
similarity index 100%
rename from dashboard/public/katex/contrib/mathtex-script-type.min.js
rename to frontend/public/katex/contrib/mathtex-script-type.min.js
diff --git a/dashboard/public/katex/contrib/mathtex-script-type.mjs b/frontend/public/katex/contrib/mathtex-script-type.mjs
similarity index 100%
rename from dashboard/public/katex/contrib/mathtex-script-type.mjs
rename to frontend/public/katex/contrib/mathtex-script-type.mjs
diff --git a/dashboard/public/katex/contrib/mhchem.js b/frontend/public/katex/contrib/mhchem.js
similarity index 100%
rename from dashboard/public/katex/contrib/mhchem.js
rename to frontend/public/katex/contrib/mhchem.js
diff --git a/dashboard/public/katex/contrib/mhchem.min.js b/frontend/public/katex/contrib/mhchem.min.js
similarity index 100%
rename from dashboard/public/katex/contrib/mhchem.min.js
rename to frontend/public/katex/contrib/mhchem.min.js
diff --git a/dashboard/public/katex/contrib/mhchem.mjs b/frontend/public/katex/contrib/mhchem.mjs
similarity index 100%
rename from dashboard/public/katex/contrib/mhchem.mjs
rename to frontend/public/katex/contrib/mhchem.mjs
diff --git a/dashboard/public/katex/contrib/render-a11y-string.js b/frontend/public/katex/contrib/render-a11y-string.js
similarity index 100%
rename from dashboard/public/katex/contrib/render-a11y-string.js
rename to frontend/public/katex/contrib/render-a11y-string.js
diff --git a/dashboard/public/katex/contrib/render-a11y-string.min.js b/frontend/public/katex/contrib/render-a11y-string.min.js
similarity index 100%
rename from dashboard/public/katex/contrib/render-a11y-string.min.js
rename to frontend/public/katex/contrib/render-a11y-string.min.js
diff --git a/dashboard/public/katex/contrib/render-a11y-string.mjs b/frontend/public/katex/contrib/render-a11y-string.mjs
similarity index 100%
rename from dashboard/public/katex/contrib/render-a11y-string.mjs
rename to frontend/public/katex/contrib/render-a11y-string.mjs
diff --git a/dashboard/public/katex/fonts/KaTeX_AMS-Regular.ttf b/frontend/public/katex/fonts/KaTeX_AMS-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_AMS-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_AMS-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_AMS-Regular.woff b/frontend/public/katex/fonts/KaTeX_AMS-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_AMS-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_AMS-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_AMS-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_AMS-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_AMS-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_AMS-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Caligraphic-Bold.ttf b/frontend/public/katex/fonts/KaTeX_Caligraphic-Bold.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Caligraphic-Bold.ttf
rename to frontend/public/katex/fonts/KaTeX_Caligraphic-Bold.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Caligraphic-Bold.woff b/frontend/public/katex/fonts/KaTeX_Caligraphic-Bold.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Caligraphic-Bold.woff
rename to frontend/public/katex/fonts/KaTeX_Caligraphic-Bold.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Caligraphic-Bold.woff2 b/frontend/public/katex/fonts/KaTeX_Caligraphic-Bold.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Caligraphic-Bold.woff2
rename to frontend/public/katex/fonts/KaTeX_Caligraphic-Bold.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Caligraphic-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Caligraphic-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Caligraphic-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Caligraphic-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Caligraphic-Regular.woff b/frontend/public/katex/fonts/KaTeX_Caligraphic-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Caligraphic-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Caligraphic-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Caligraphic-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Caligraphic-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Caligraphic-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Caligraphic-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Fraktur-Bold.ttf b/frontend/public/katex/fonts/KaTeX_Fraktur-Bold.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Fraktur-Bold.ttf
rename to frontend/public/katex/fonts/KaTeX_Fraktur-Bold.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Fraktur-Bold.woff b/frontend/public/katex/fonts/KaTeX_Fraktur-Bold.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Fraktur-Bold.woff
rename to frontend/public/katex/fonts/KaTeX_Fraktur-Bold.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Fraktur-Bold.woff2 b/frontend/public/katex/fonts/KaTeX_Fraktur-Bold.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Fraktur-Bold.woff2
rename to frontend/public/katex/fonts/KaTeX_Fraktur-Bold.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Fraktur-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Fraktur-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Fraktur-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Fraktur-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Fraktur-Regular.woff b/frontend/public/katex/fonts/KaTeX_Fraktur-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Fraktur-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Fraktur-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Fraktur-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Fraktur-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Fraktur-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Fraktur-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Bold.ttf b/frontend/public/katex/fonts/KaTeX_Main-Bold.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Bold.ttf
rename to frontend/public/katex/fonts/KaTeX_Main-Bold.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Bold.woff b/frontend/public/katex/fonts/KaTeX_Main-Bold.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Bold.woff
rename to frontend/public/katex/fonts/KaTeX_Main-Bold.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Bold.woff2 b/frontend/public/katex/fonts/KaTeX_Main-Bold.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Bold.woff2
rename to frontend/public/katex/fonts/KaTeX_Main-Bold.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-BoldItalic.ttf b/frontend/public/katex/fonts/KaTeX_Main-BoldItalic.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-BoldItalic.ttf
rename to frontend/public/katex/fonts/KaTeX_Main-BoldItalic.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-BoldItalic.woff b/frontend/public/katex/fonts/KaTeX_Main-BoldItalic.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-BoldItalic.woff
rename to frontend/public/katex/fonts/KaTeX_Main-BoldItalic.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-BoldItalic.woff2 b/frontend/public/katex/fonts/KaTeX_Main-BoldItalic.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-BoldItalic.woff2
rename to frontend/public/katex/fonts/KaTeX_Main-BoldItalic.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Italic.ttf b/frontend/public/katex/fonts/KaTeX_Main-Italic.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Italic.ttf
rename to frontend/public/katex/fonts/KaTeX_Main-Italic.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Italic.woff b/frontend/public/katex/fonts/KaTeX_Main-Italic.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Italic.woff
rename to frontend/public/katex/fonts/KaTeX_Main-Italic.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Italic.woff2 b/frontend/public/katex/fonts/KaTeX_Main-Italic.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Italic.woff2
rename to frontend/public/katex/fonts/KaTeX_Main-Italic.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Main-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Main-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Regular.woff b/frontend/public/katex/fonts/KaTeX_Main-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Main-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Main-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Main-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Main-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Main-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Math-BoldItalic.ttf b/frontend/public/katex/fonts/KaTeX_Math-BoldItalic.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Math-BoldItalic.ttf
rename to frontend/public/katex/fonts/KaTeX_Math-BoldItalic.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Math-BoldItalic.woff b/frontend/public/katex/fonts/KaTeX_Math-BoldItalic.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Math-BoldItalic.woff
rename to frontend/public/katex/fonts/KaTeX_Math-BoldItalic.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Math-BoldItalic.woff2 b/frontend/public/katex/fonts/KaTeX_Math-BoldItalic.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Math-BoldItalic.woff2
rename to frontend/public/katex/fonts/KaTeX_Math-BoldItalic.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Math-Italic.ttf b/frontend/public/katex/fonts/KaTeX_Math-Italic.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Math-Italic.ttf
rename to frontend/public/katex/fonts/KaTeX_Math-Italic.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Math-Italic.woff b/frontend/public/katex/fonts/KaTeX_Math-Italic.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Math-Italic.woff
rename to frontend/public/katex/fonts/KaTeX_Math-Italic.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Math-Italic.woff2 b/frontend/public/katex/fonts/KaTeX_Math-Italic.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Math-Italic.woff2
rename to frontend/public/katex/fonts/KaTeX_Math-Italic.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Bold.ttf b/frontend/public/katex/fonts/KaTeX_SansSerif-Bold.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Bold.ttf
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Bold.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Bold.woff b/frontend/public/katex/fonts/KaTeX_SansSerif-Bold.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Bold.woff
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Bold.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Bold.woff2 b/frontend/public/katex/fonts/KaTeX_SansSerif-Bold.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Bold.woff2
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Bold.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Italic.ttf b/frontend/public/katex/fonts/KaTeX_SansSerif-Italic.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Italic.ttf
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Italic.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Italic.woff b/frontend/public/katex/fonts/KaTeX_SansSerif-Italic.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Italic.woff
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Italic.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Italic.woff2 b/frontend/public/katex/fonts/KaTeX_SansSerif-Italic.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Italic.woff2
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Italic.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Regular.ttf b/frontend/public/katex/fonts/KaTeX_SansSerif-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Regular.woff b/frontend/public/katex/fonts/KaTeX_SansSerif-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_SansSerif-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_SansSerif-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_SansSerif-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_SansSerif-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Script-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Script-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Script-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Script-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Script-Regular.woff b/frontend/public/katex/fonts/KaTeX_Script-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Script-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Script-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Script-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Script-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Script-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Script-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Size1-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Size1-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size1-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Size1-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Size1-Regular.woff b/frontend/public/katex/fonts/KaTeX_Size1-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size1-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Size1-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Size1-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Size1-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size1-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Size1-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Size2-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Size2-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size2-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Size2-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Size2-Regular.woff b/frontend/public/katex/fonts/KaTeX_Size2-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size2-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Size2-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Size2-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Size2-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size2-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Size2-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Size3-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Size3-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size3-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Size3-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Size3-Regular.woff b/frontend/public/katex/fonts/KaTeX_Size3-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size3-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Size3-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Size3-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Size3-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size3-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Size3-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Size4-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Size4-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size4-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Size4-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Size4-Regular.woff b/frontend/public/katex/fonts/KaTeX_Size4-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size4-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Size4-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Size4-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Size4-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Size4-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Size4-Regular.woff2
diff --git a/dashboard/public/katex/fonts/KaTeX_Typewriter-Regular.ttf b/frontend/public/katex/fonts/KaTeX_Typewriter-Regular.ttf
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Typewriter-Regular.ttf
rename to frontend/public/katex/fonts/KaTeX_Typewriter-Regular.ttf
diff --git a/dashboard/public/katex/fonts/KaTeX_Typewriter-Regular.woff b/frontend/public/katex/fonts/KaTeX_Typewriter-Regular.woff
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Typewriter-Regular.woff
rename to frontend/public/katex/fonts/KaTeX_Typewriter-Regular.woff
diff --git a/dashboard/public/katex/fonts/KaTeX_Typewriter-Regular.woff2 b/frontend/public/katex/fonts/KaTeX_Typewriter-Regular.woff2
similarity index 100%
rename from dashboard/public/katex/fonts/KaTeX_Typewriter-Regular.woff2
rename to frontend/public/katex/fonts/KaTeX_Typewriter-Regular.woff2
diff --git a/dashboard/public/katex/katex.css b/frontend/public/katex/katex.css
similarity index 100%
rename from dashboard/public/katex/katex.css
rename to frontend/public/katex/katex.css
diff --git a/dashboard/public/katex/katex.js b/frontend/public/katex/katex.js
similarity index 100%
rename from dashboard/public/katex/katex.js
rename to frontend/public/katex/katex.js
diff --git a/dashboard/public/katex/katex.min.css b/frontend/public/katex/katex.min.css
similarity index 100%
rename from dashboard/public/katex/katex.min.css
rename to frontend/public/katex/katex.min.css
diff --git a/dashboard/public/katex/katex.min.js b/frontend/public/katex/katex.min.js
similarity index 100%
rename from dashboard/public/katex/katex.min.js
rename to frontend/public/katex/katex.min.js
diff --git a/dashboard/public/katex/katex.mjs b/frontend/public/katex/katex.mjs
similarity index 100%
rename from dashboard/public/katex/katex.mjs
rename to frontend/public/katex/katex.mjs
diff --git a/frontend/public/manifest.json b/frontend/public/manifest.json
index e9a1dbef..1a11a6e3 100644
--- a/frontend/public/manifest.json
+++ b/frontend/public/manifest.json
@@ -1,21 +1,13 @@
{
- "name": "Alexandrie",
- "short_name": "Alexandrie",
- "description": "Alexandrie application.",
+ "name": "Alexandrie dashboard",
+ "short_name": "Alexandrie dashboard",
+ "description": "Alexandrie dashboard application.",
"start_url": "/",
"display": "standalone",
"background_color": "#2f3641",
"theme_color": "#009df7",
"icons": [
- {
- "src": "/android-chrome-192x192.png",
- "sizes": "192x192",
- "type": "image/png"
- },
- {
- "src": "/android-chrome-512x512.png",
- "sizes": "512x512",
- "type": "image/png"
- }
+ { "src": "/android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
+ { "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
]
}
diff --git a/frontend/public/robots.txt b/frontend/public/robots.txt
deleted file mode 100644
index 26b4d70f..00000000
--- a/frontend/public/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-Agent: *
-Allow: /
\ No newline at end of file
diff --git a/frontend/public/service-worker.js b/frontend/public/service-worker.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/dashboard/public/svg/folder.svg b/frontend/public/svg/folder.svg
similarity index 100%
rename from dashboard/public/svg/folder.svg
rename to frontend/public/svg/folder.svg
diff --git a/dashboard/public/svg/menu.svg b/frontend/public/svg/menu.svg
similarity index 100%
rename from dashboard/public/svg/menu.svg
rename to frontend/public/svg/menu.svg
diff --git a/dashboard/public/svg/menu_open.svg b/frontend/public/svg/menu_open.svg
similarity index 100%
rename from dashboard/public/svg/menu_open.svg
rename to frontend/public/svg/menu_open.svg
diff --git a/frontend/public/svg/search.svg b/frontend/public/svg/search.svg
deleted file mode 100644
index ca021ac0..00000000
--- a/frontend/public/svg/search.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="12" height="13"><g stroke-width="2" stroke="#aaa" fill="none"><path d="M11.29 11.71l-4-4"/><circle cx="5" cy="5" r="4"/></g></svg>
\ No newline at end of file
diff --git a/dashboard/public/svg/tag.svg b/frontend/public/svg/tag.svg
similarity index 100%
rename from dashboard/public/svg/tag.svg
rename to frontend/public/svg/tag.svg
diff --git a/dashboard/public/svg/trash.svg b/frontend/public/svg/trash.svg
similarity index 100%
rename from dashboard/public/svg/trash.svg
rename to frontend/public/svg/trash.svg
diff --git a/frontend/store/categories.store.ts b/frontend/store/categories.store.ts
index 6d4a0057..f5e641e9 100644
--- a/frontend/store/categories.store.ts
+++ b/frontend/store/categories.store.ts
@@ -12,19 +12,18 @@ export const useCategoriesStore = defineStore('categories', {
getById: state => (id: string) => state.categories.find((c: Category) => c.id == id),
getParents: state => state.categories.filter(c => !c.parent_id),
getChilds: state => (id: string) => state.categories.filter(c => c.parent_id == id),
- search: state => (query: string) => state.categories.filter(c => c.name.toLowerCase().includes(query.toLowerCase())),
},
actions: {
fetch: async function (opts?: FetchOptions<Array<keyof Category>>) {
return new Promise(async (resolve, reject) => {
- const request = await makeRequest(`categories/${opts?.id || ''}?fields=${opts?.fields?.join(',')}`, 'GET', {});
+ const request = await makeRequest(`categories/${opts?.id || ''}`, 'GET', {});
if (request.status == 'success') {
if (opts?.id) {
// replace the document with the new one
const index = this.categories.findIndex(d => d.id == opts?.id);
- if (index == -1) this.categories.push(request.result);
- else this.categories[index] = request.result;
- } else this.categories = request.result;
+ if (index == -1) this.categories.push(request.result as Category);
+ else this.categories[index] = { ...(request.result as Category), type: 'category' };
+ } else this.categories = (request.result as Category[]).map((d: Category) => ({ ...d, type: 'category' }));
resolve(this.categories);
} else reject(request.message);
});
@@ -32,7 +31,7 @@ export const useCategoriesStore = defineStore('categories', {
post(category: Category) {
return new Promise(async (resolve, reject) => {
const request = await makeRequest(`categories`, 'POST', category);
- if (request.status == 'success') resolve(this.categories.push(request.result));
+ if (request.status == 'success') resolve(this.categories.push(request.result as Category));
else reject(request.message);
});
},
diff --git a/frontend/store/db_strustures.d.ts b/frontend/store/db_strustures.d.ts
index 3cff3244..c189e1b1 100644
--- a/frontend/store/db_strustures.d.ts
+++ b/frontend/store/db_strustures.d.ts
@@ -4,6 +4,7 @@ export interface Document {
description?: string;
tags?: string;
category?: string;
+ parent_id?: string | null;
accessibility: number; // 0: No; 1: Yes;
content_markdown?: string;
content_html?: string;
@@ -13,6 +14,7 @@ export interface Document {
// not in the database
partial?: boolean;
+ type: 'document';
}
export interface Category {
@@ -21,6 +23,9 @@ export interface Category {
icon?: string;
order?: number;
parent_id?: string;
+
+ // not in the database
+ type: 'category';
}
export interface User {
diff --git a/frontend/store/documents.store.ts b/frontend/store/documents.store.ts
index 32efc429..7321f7f6 100644
--- a/frontend/store/documents.store.ts
+++ b/frontend/store/documents.store.ts
@@ -11,8 +11,7 @@ export const useDocumentsStore = defineStore('documents', {
getAll: state => state.documents,
getById: state => (id: string) => state.documents.find((d: Document) => d.id == id),
getByCategories: state => (category: string) => state.documents.filter(d => d.category == category),
- search: state => (query: string) => state.documents.filter(d => d.name.toLowerCase().includes(query.toLowerCase())),
- getRecents: state => (limit: number) => state.documents.slice(0, limit).reverse(),
+
getNext: state => (doc?: Document) => {
const cdocs = state.documents.filter(d => d.category == doc?.category);
const index = cdocs.findIndex(d => d.id == doc?.id);
@@ -26,28 +25,35 @@ export const useDocumentsStore = defineStore('documents', {
if (index == -1) return;
return cdocs[index - 1];
},
+ getAllChildrensIds: state => (id: string) => {
+ const childrens: string[] = [id];
+ const getChildrens = (parent: Document) => {
+ state.documents.forEach(doc => {
+ if (doc.parent_id == parent.id) {
+ childrens.push(doc.id);
+ getChildrens(doc);
+ }
+ });
+ };
+ const parent = state.documents.find(d => d.id == id);
+ if (parent) getChildrens(parent);
+ return childrens;
+ },
},
actions: {
- fetch: async function <T extends FetchOptions<Array<keyof Document>>>(
- opts?: T,
- ): Promise<'id' extends keyof T ? Document : Document[]> {
+ fetch: async function <T extends FetchOptions<Array<keyof Document>>>(opts?: T): Promise<'id' extends keyof T ? Document : Document[]> {
console.log(`[store/documents] Fetching documents with options: ${JSON.stringify(opts)}`);
-
return new Promise(async (resolve, reject) => {
- const request = await makeRequest(
- `documents/${opts?.id || ''}${opts?.fields?.length ? '?fields=' + opts?.fields?.join(',') : ''}`,
- 'GET',
- {},
- );
+ const request = await makeRequest(`documents/${opts?.id || ''}?all=true`, 'GET', {});
if (request.status == 'success') {
if (opts?.id) {
const index = this.documents.findIndex(d => d.id == opts?.id);
- const updatedDocument: Document = { ...request.result, partial: false };
+ const updatedDocument: Document = { ...(request.result as Document), partial: false, type: 'document' };
if (index == -1) this.documents.push(updatedDocument);
else this.documents[index] = updatedDocument;
resolve(updatedDocument as 'id' extends keyof T ? Document : Document[]);
} else {
- this.documents = request.result.map((d: Document) => ({ ...d, partial: true }));
+ this.documents = (request.result as Document[]).map((d: Document) => ({ ...d, partial: true, type: 'document' }));
resolve(this.documents as 'id' extends keyof T ? Document : Document[]);
}
} else reject(request.message);
@@ -56,7 +62,7 @@ export const useDocumentsStore = defineStore('documents', {
post(doc: Document) {
return new Promise(async (resolve, reject) => {
const request = await makeRequest('documents', 'POST', doc);
- if (request.status == 'success') resolve(this.documents.push(request.result));
+ if (request.status == 'success') resolve(this.documents.push(request.result as Document));
else reject(request.message);
});
},
diff --git a/frontend/store/index.ts b/frontend/store/index.ts
index 8e657341..cd043801 100644
--- a/frontend/store/index.ts
+++ b/frontend/store/index.ts
@@ -1,4 +1,5 @@
export * from './documents.store';
export * from './categories.store';
+export * from './notifications.store';
export type * from './utils';
export type * from './db_strustures';
diff --git a/dashboard/store/notifications.store.ts b/frontend/store/notifications.store.ts
similarity index 100%
rename from dashboard/store/notifications.store.ts
rename to frontend/store/notifications.store.ts
diff --git a/frontend/store/utils.ts b/frontend/store/utils.ts
index 78687eed..6538a102 100644
--- a/frontend/store/utils.ts
+++ b/frontend/store/utils.ts
@@ -1,3 +1,5 @@
+import type { Document, Category } from './db_strustures';
+
export interface APIResult<Data> {
status: 'success' | 'error';
message?: string;
@@ -6,11 +8,10 @@ export interface APIResult<Data> {
export interface FetchOptions<K> {
id: string; // id of the ressource
- fields?: K; // fields to include in the responce
}
export const baseUrl = import.meta.env.VITE_BASE_API?.toString() || '';
-export async function makeRequest(route: string, method: string, body: Object): Promise<APIResult<any>> {
+export async function makeRequest(route: string, method: string, body: Object): Promise<APIResult<Document | Category | Document[] | Category[]>> {
try {
const responce = await fetch(`${baseUrl}/api/v1/${route}`, {
method: method,
diff --git a/frontend/styles/main.scss b/frontend/styles/main.scss
index 90a584af..54c5c2d0 100644
--- a/frontend/styles/main.scss
+++ b/frontend/styles/main.scss
@@ -1,26 +1,3 @@
-.view-medium {
- display: block;
- max-width: 95%;
- margin: auto 50px auto 315px;
-
-
- @media (max-width: 768px) {
- width: 100%;
- margin: auto;
- }
-}
-
-.fade-enter-active,
-.fade-leave-active {
- opacity: 0;
- transition: opacity $transition-duration;
-}
-
-.fade-enter-to,
-.fade-leave-to {
- opacity: 1;
-}
-
:root {
--padding: calc((100vw - 1700px) / 2);
}
\ No newline at end of file
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index a96795fc..a746f2a7 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -1,44 +1,4 @@
{
- // https://v3.nuxtjs.org/concepts/typescript
- "extends": "./.nuxt/tsconfig.json",
- "compilerOptions": {
- // Type Checking
- "allowUnreachableCode": false,
- "allowUnusedLabels": false,
- "exactOptionalPropertyTypes": false,
- "noFallthroughCasesInSwitch": true,
- "noImplicitOverride": true,
- "noImplicitReturns": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "strict": true,
- "useUnknownInCatchVariables": true,
- "noUncheckedIndexedAccess": true,
- // Modules
- "module": "ESNext",
- "moduleResolution": "Node",
- "resolveJsonModule": true,
- // Emit
- "importHelpers": false,
- "verbatimModuleSyntax": true,
- "inlineSources": true,
- "newLine": "lf",
- "noEmitHelpers": true,
- "outDir": "build",
- "preserveConstEnums": true,
- "removeComments": true,
- "sourceMap": true,
- "esModuleInterop": true,
- "forceConsistentCasingInFileNames": true,
- "skipLibCheck": true,
- // Language and Environment
- "jsx": "preserve",
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "lib": ["ESNext", "DOM", "es2021"],
- "types": ["node"],
- "typeRoots": ["./node_modules/@types"],
- "target": "ESNext",
- "useDefineForClassFields": true
- }
+ // https://nuxt.com/docs/guide/concepts/typescript
+ "extends": "./.nuxt/tsconfig.json"
}