diff --git a/src/web/src/layouts/DefaultLayout.vue b/src/web/src/layouts/DefaultLayout.vue new file mode 100644 index 0000000..c9d2462 --- /dev/null +++ b/src/web/src/layouts/DefaultLayout.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/web/src/router/index.ts b/src/web/src/router/index.ts index 75d75d1..4288733 100644 --- a/src/web/src/router/index.ts +++ b/src/web/src/router/index.ts @@ -1,8 +1,18 @@ +/* +Alpacca: The modern package repository hosting platform. +Copyright (C) 2025, Zervó Zadachin + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT. +*/ + import { createRouter, createWebHistory } from 'vue-router' import Index from '@/views/Index.vue' +import { withLayout } from './layoutWrapper' const routes = [ - { path: '/', component: Index }, + { path: '/', component: withLayout(Index) }, ] const router = createRouter({ diff --git a/src/web/src/router/layoutWrapper.ts b/src/web/src/router/layoutWrapper.ts new file mode 100644 index 0000000..1c21fac --- /dev/null +++ b/src/web/src/router/layoutWrapper.ts @@ -0,0 +1,22 @@ +/* +Alpacca: The modern package repository hosting platform. +Copyright (C) 2025, Zervó Zadachin + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +The full copyright notice can be found at https://git.zervo.org/zervo/Alpacca/src/branch/main/COPYRIGHT. +*/ + +import { defineComponent, h } from 'vue' +import DefaultLayout from '@/layouts/DefaultLayout.vue' + +export function withLayout (pageComponent: any, layoutComponent: any = DefaultLayout) { + return defineComponent({ + name: 'WrappedWithLayout', + render () { + return h(layoutComponent, {}, { + default: () => h(pageComponent), + }) + }, + }) +}