memories/src/router.ts

164 lines
3.4 KiB
TypeScript
Raw Normal View History

import { generateUrl } from '@nextcloud/router';
import { translate as t } from '@nextcloud/l10n';
import Router from 'vue-router';
import Vue from 'vue';
import Timeline from './components/Timeline.vue';
import Explore from './components/Explore.vue';
import SplitTimeline from './components/SplitTimeline.vue';
import ClusterView from './components/ClusterView.vue';
2022-08-16 01:12:14 +00:00
2022-10-28 19:08:34 +00:00
Vue.use(Router);
2022-08-16 01:12:14 +00:00
2022-10-28 19:08:34 +00:00
export default new Router({
mode: 'history',
2022-10-28 19:08:34 +00:00
// if index.php is in the url AND we got this far, then it's working:
// let's keep using index.php in the url
base: generateUrl('/apps/memories'),
linkActiveClass: 'active',
2022-10-28 19:08:34 +00:00
routes: [
{
path: '/',
2022-10-28 19:08:34 +00:00
component: Timeline,
name: 'timeline',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Timeline'),
2022-10-28 19:08:34 +00:00
}),
},
2022-08-17 20:39:48 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/folders/:path*',
2022-10-28 19:08:34 +00:00
component: Timeline,
name: 'folders',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Folders'),
2022-10-28 19:08:34 +00:00
}),
},
2022-09-12 02:21:20 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/favorites',
2022-10-28 19:08:34 +00:00
component: Timeline,
name: 'favorites',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Favorites'),
2022-10-28 19:08:34 +00:00
}),
},
2022-09-13 07:55:32 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/videos',
2022-10-28 19:08:34 +00:00
component: Timeline,
name: 'videos',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Videos'),
2022-10-28 19:08:34 +00:00
}),
},
2022-09-25 23:02:26 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/albums/:user?/:name?',
component: ClusterView,
name: 'albums',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Albums'),
2022-10-28 19:08:34 +00:00
}),
},
2022-10-26 22:12:46 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/archive',
2022-10-28 19:08:34 +00:00
component: Timeline,
name: 'archive',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Archive'),
2022-10-28 19:08:34 +00:00
}),
},
2022-10-06 20:20:29 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/thisday',
2022-10-28 19:08:34 +00:00
component: Timeline,
name: 'thisday',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'On this day'),
2022-10-28 19:08:34 +00:00
}),
},
2022-10-06 23:28:35 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/recognize/:user?/:name?',
component: ClusterView,
name: 'recognize',
2022-12-08 21:00:53 +00:00
props: (route) => ({
rootTitle: t('memories', 'People'),
2022-12-08 21:00:53 +00:00
}),
},
{
path: '/facerecognition/:user?/:name?',
component: ClusterView,
name: 'facerecognition',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'People'),
2022-10-28 19:08:34 +00:00
}),
},
2023-02-05 21:43:25 +00:00
{
path: '/places/:name*',
component: ClusterView,
name: 'places',
2023-02-05 21:43:25 +00:00
props: (route) => ({
rootTitle: t('memories', 'Places'),
2023-02-05 21:43:25 +00:00
}),
},
2022-10-28 19:08:34 +00:00
{
path: '/tags/:name*',
component: ClusterView,
name: 'tags',
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t('memories', 'Tags'),
2022-10-28 19:08:34 +00:00
}),
},
2022-10-26 18:58:06 +00:00
2022-10-28 19:08:34 +00:00
{
path: '/maps',
name: 'maps',
2022-10-28 19:08:34 +00:00
// router-link doesn't support external url, let's force the redirect
beforeEnter() {
window.open(generateUrl('/apps/maps'), '_blank');
2022-10-28 19:08:34 +00:00
},
},
2022-10-29 00:25:39 +00:00
{
path: '/s/:token',
2022-10-29 00:25:39 +00:00
component: Timeline,
name: 'folder-share',
2022-10-29 00:25:39 +00:00
props: (route) => ({
rootTitle: t('memories', 'Shared Folder'),
2022-10-29 00:25:39 +00:00
}),
},
{
path: '/a/:token',
component: Timeline,
name: 'album-share',
props: (route) => ({
rootTitle: t('memories', 'Shared Album'),
}),
},
{
path: '/map',
2023-02-08 21:35:42 +00:00
component: SplitTimeline,
name: 'map',
props: (route) => ({
rootTitle: t('memories', 'Map'),
2023-02-08 21:35:42 +00:00
}),
},
{
path: '/explore',
component: Explore,
name: 'explore',
props: (route) => ({
rootTitle: t('memories', 'Explore'),
}),
},
2022-10-28 19:08:34 +00:00
],
});