2022-08-16 01:12:14 +00:00
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
|
|
|
*
|
|
|
|
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
|
|
*
|
|
|
|
* @license AGPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { generateUrl } from '@nextcloud/router'
|
2022-09-13 01:33:24 +00:00
|
|
|
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
2022-08-16 01:12:14 +00:00
|
|
|
import Router from 'vue-router'
|
|
|
|
import Vue from 'vue'
|
2022-09-13 01:33:24 +00:00
|
|
|
import Timeline from './components/Timeline.vue';
|
2022-08-16 01:12:14 +00:00
|
|
|
|
|
|
|
Vue.use(Router)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse the path of a route : join the elements of the array and return a single string with slashes
|
|
|
|
* + always lead current path with a slash
|
|
|
|
*
|
|
|
|
* @param {string | Array} path path arguments to parse
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
const parsePathParams = (path) => {
|
|
|
|
return `/${Array.isArray(path) ? path.join('/') : path || ''}`
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new Router({
|
|
|
|
mode: 'history',
|
|
|
|
// 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
|
2022-09-13 01:33:24 +00:00
|
|
|
base: generateUrl('/apps/memories'),
|
2022-08-16 01:12:14 +00:00
|
|
|
linkActiveClass: 'active',
|
|
|
|
routes: [
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
component: Timeline,
|
|
|
|
name: 'timeline',
|
|
|
|
props: route => ({
|
2022-09-13 07:55:32 +00:00
|
|
|
rootTitle: t('memories', 'Timeline'),
|
2022-08-16 01:12:14 +00:00
|
|
|
}),
|
|
|
|
},
|
2022-08-17 20:39:48 +00:00
|
|
|
|
|
|
|
{
|
2022-09-24 01:54:14 +00:00
|
|
|
path: '/folders/:path*',
|
2022-08-17 20:39:48 +00:00
|
|
|
component: Timeline,
|
2022-09-08 23:57:50 +00:00
|
|
|
name: 'folders',
|
2022-08-17 20:39:48 +00:00
|
|
|
props: route => ({
|
2022-09-13 07:55:32 +00:00
|
|
|
rootTitle: t('memories', 'Folders'),
|
2022-08-17 20:39:48 +00:00
|
|
|
}),
|
|
|
|
},
|
2022-09-12 02:21:20 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
path: '/favorites',
|
|
|
|
component: Timeline,
|
|
|
|
name: 'favorites',
|
|
|
|
props: route => ({
|
2022-09-13 07:55:32 +00:00
|
|
|
rootTitle: t('memories', 'Favorites'),
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
path: '/videos',
|
|
|
|
component: Timeline,
|
|
|
|
name: 'videos',
|
|
|
|
props: route => ({
|
|
|
|
rootTitle: t('memories', 'Videos'),
|
2022-09-12 02:21:20 +00:00
|
|
|
}),
|
|
|
|
},
|
2022-09-25 23:02:26 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
path: '/archive',
|
|
|
|
component: Timeline,
|
|
|
|
name: 'archive',
|
|
|
|
props: route => ({
|
|
|
|
rootTitle: t('memories', 'Archive'),
|
|
|
|
}),
|
|
|
|
},
|
2022-10-06 20:20:29 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
path: '/thisday',
|
|
|
|
component: Timeline,
|
|
|
|
name: 'thisday',
|
|
|
|
props: route => ({
|
|
|
|
rootTitle: t('memories', 'On this day'),
|
|
|
|
}),
|
|
|
|
},
|
2022-08-16 01:12:14 +00:00
|
|
|
],
|
|
|
|
})
|