forked from didirus/AstralRinth
* feat: abstract api-client DI into ui package * feat: cross platform page system * feat: tanstack as cross platform useAsyncData * feat: archon servers routes + labrinth billing routes * fix: dont use partial * feat: migrate server list page to tanstack + api-client + re-enabled broken features! * feat: migrate servers manage page to api-client before page system * feat: migrate manage page to page system * fix: type issues * fix: upgrade wrapper bugs * refactor: move state types into api-client * feat: disable financial stuff on app frontend * feat: finalize cross platform page system for now * fix: lint * fix: build issues * feat: remove papaparse * fix: lint * fix: interface error --------- Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
194 lines
4.2 KiB
JavaScript
194 lines
4.2 KiB
JavaScript
import { ServersManagePageIndex } from '@modrinth/ui'
|
|
import { createRouter, createWebHistory } from 'vue-router'
|
|
|
|
import * as Pages from '@/pages'
|
|
import * as Instance from '@/pages/instance'
|
|
import * as Library from '@/pages/library'
|
|
import * as Project from '@/pages/project'
|
|
|
|
/**
|
|
* Configures application routing. Add page to pages/index and then add to route table here.
|
|
*/
|
|
export default new createRouter({
|
|
history: createWebHistory(),
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
name: 'Home',
|
|
component: Pages.Index,
|
|
meta: {
|
|
breadcrumb: [{ name: 'Home' }],
|
|
},
|
|
},
|
|
{
|
|
path: '/worlds',
|
|
name: 'Worlds',
|
|
component: Pages.Worlds,
|
|
meta: {
|
|
breadcrumb: [{ name: 'Worlds' }],
|
|
},
|
|
},
|
|
{
|
|
path: '/servers/manage/',
|
|
name: 'Servers',
|
|
component: ServersManagePageIndex,
|
|
meta: {
|
|
breadcrumb: [{ name: 'Servers' }],
|
|
},
|
|
},
|
|
{
|
|
path: '/browse/:projectType',
|
|
name: 'Discover content',
|
|
component: Pages.Browse,
|
|
meta: {
|
|
breadcrumb: [{ name: 'Discover content' }],
|
|
},
|
|
},
|
|
{
|
|
path: '/skins',
|
|
name: 'Skins',
|
|
component: Pages.Skins,
|
|
meta: {
|
|
breadcrumb: [{ name: 'Skins' }],
|
|
},
|
|
},
|
|
{
|
|
path: '/library',
|
|
name: 'Library',
|
|
component: Library.Index,
|
|
meta: {
|
|
breadcrumb: [{ name: 'Library' }],
|
|
},
|
|
children: [
|
|
{
|
|
path: '',
|
|
name: 'Overview',
|
|
component: Library.Overview,
|
|
},
|
|
{
|
|
path: 'downloaded',
|
|
name: 'Downloaded',
|
|
component: Library.Downloaded,
|
|
},
|
|
{
|
|
path: 'custom',
|
|
name: 'Custom',
|
|
component: Library.Custom,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/project/:id',
|
|
name: 'Project',
|
|
component: Project.Index,
|
|
props: true,
|
|
children: [
|
|
{
|
|
path: '',
|
|
name: 'Description',
|
|
component: Project.Description,
|
|
meta: {
|
|
useContext: true,
|
|
breadcrumb: [{ name: '?Project' }],
|
|
},
|
|
},
|
|
{
|
|
path: 'versions',
|
|
name: 'Versions',
|
|
component: Project.Versions,
|
|
meta: {
|
|
useContext: true,
|
|
breadcrumb: [{ name: '?Project', link: '/project/{id}/' }, { name: 'Versions' }],
|
|
},
|
|
},
|
|
{
|
|
path: 'version/:version',
|
|
name: 'Version',
|
|
component: Project.Version,
|
|
props: true,
|
|
meta: {
|
|
useContext: true,
|
|
breadcrumb: [
|
|
{ name: '?Project', link: '/project/{id}/' },
|
|
{ name: 'Versions', link: '/project/{id}/versions' },
|
|
{ name: '?Version' },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
path: 'gallery',
|
|
name: 'Gallery',
|
|
component: Project.Gallery,
|
|
meta: {
|
|
useContext: true,
|
|
breadcrumb: [{ name: '?Project', link: '/project/{id}/' }, { name: 'Gallery' }],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/instance/:id',
|
|
name: 'Instance',
|
|
component: Instance.Index,
|
|
props: true,
|
|
children: [
|
|
// {
|
|
// path: '',
|
|
// name: 'Overview',
|
|
// component: Instance.Overview,
|
|
// meta: {
|
|
// useRootContext: true,
|
|
// breadcrumb: [{ name: '?Instance' }],
|
|
// },
|
|
// },
|
|
{
|
|
path: 'worlds',
|
|
name: 'InstanceWorlds',
|
|
component: Instance.Worlds,
|
|
meta: {
|
|
useRootContext: true,
|
|
breadcrumb: [{ name: '?Instance', link: '/instance/{id}/' }, { name: 'Worlds' }],
|
|
},
|
|
},
|
|
{
|
|
path: '',
|
|
name: 'Mods',
|
|
component: Instance.Mods,
|
|
meta: {
|
|
useRootContext: true,
|
|
breadcrumb: [{ name: '?Instance', link: '/instance/{id}/' }, { name: 'Content' }],
|
|
},
|
|
},
|
|
{
|
|
path: 'projects/:type',
|
|
name: 'ModsFilter',
|
|
component: Instance.Mods,
|
|
meta: {
|
|
useRootContext: true,
|
|
breadcrumb: [{ name: '?Instance', link: '/instance/{id}/' }, { name: 'Content' }],
|
|
},
|
|
},
|
|
{
|
|
path: 'logs',
|
|
name: 'Logs',
|
|
component: Instance.Logs,
|
|
meta: {
|
|
useRootContext: true,
|
|
breadcrumb: [{ name: '?Instance', link: '/instance/{id}/' }, { name: 'Logs' }],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
linkActiveClass: 'router-link-active',
|
|
linkExactActiveClass: 'router-link-exact-active',
|
|
scrollBehavior() {
|
|
// Sometimes Vue's scroll behavior is not working as expected, so we need to manually scroll to top (especially on Linux)
|
|
document.querySelector('.app-viewport')?.scrollTo(0, 0)
|
|
return {
|
|
el: '.app-viewport',
|
|
top: 0,
|
|
}
|
|
},
|
|
})
|