memories/src/router.ts

154 lines
3.2 KiB
TypeScript
Raw Normal View History

2022-10-28 19:08:34 +00:00
import { generateUrl } from "@nextcloud/router";
import { translate as t } from "@nextcloud/l10n";
2022-10-28 19:08:34 +00:00
import Router from "vue-router";
import Vue from "vue";
import Timeline from "./components/Timeline.vue";
2023-02-08 21:35:42 +00:00
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",
// 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",
routes: [
{
path: "/",
component: Timeline,
name: "timeline",
props: (route) => ({
rootTitle: t("memories", "Timeline"),
}),
},
2022-08-17 20:39:48 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/folders/:path*",
component: Timeline,
name: "folders",
props: (route) => ({
rootTitle: t("memories", "Folders"),
}),
},
2022-09-12 02:21:20 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/favorites",
component: Timeline,
name: "favorites",
props: (route) => ({
rootTitle: t("memories", "Favorites"),
}),
},
2022-09-13 07:55:32 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/videos",
component: Timeline,
name: "videos",
props: (route) => ({
rootTitle: t("memories", "Videos"),
}),
},
2022-09-25 23:02:26 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/albums/:user?/:name?",
component: ClusterView,
2022-10-28 19:08:34 +00:00
name: "albums",
props: (route) => ({
rootTitle: t("memories", "Albums"),
}),
},
2022-10-26 22:12:46 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/archive",
component: Timeline,
name: "archive",
props: (route) => ({
rootTitle: t("memories", "Archive"),
}),
},
2022-10-06 20:20:29 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/thisday",
component: Timeline,
name: "thisday",
props: (route) => ({
rootTitle: t("memories", "On this day"),
}),
},
2022-10-06 23:28:35 +00:00
2022-10-28 19:08:34 +00:00
{
2022-12-08 21:00:53 +00:00
path: "/recognize/:user?/:name?",
component: ClusterView,
2022-12-08 21:00:53 +00:00
name: "recognize",
props: (route) => ({
rootTitle: t("memories", "People"),
}),
},
{
path: "/facerecognition/:user?/:name?",
component: ClusterView,
2022-12-08 21:00:53 +00:00
name: "facerecognition",
2022-10-28 19:08:34 +00:00
props: (route) => ({
rootTitle: t("memories", "People"),
}),
},
2023-02-05 21:43:25 +00:00
{
path: "/places/:name*",
component: ClusterView,
2023-02-05 21:43:25 +00:00
name: "places",
props: (route) => ({
rootTitle: t("memories", "Places"),
}),
},
2022-10-28 19:08:34 +00:00
{
path: "/tags/:name*",
component: ClusterView,
2022-10-28 19:08:34 +00:00
name: "tags",
props: (route) => ({
rootTitle: t("memories", "Tags"),
}),
},
2022-10-26 18:58:06 +00:00
2022-10-28 19:08:34 +00:00
{
path: "/maps",
name: "maps",
// router-link doesn't support external url, let's force the redirect
beforeEnter() {
window.open(generateUrl("/apps/maps"), "_blank");
},
},
2022-10-29 00:25:39 +00:00
{
path: "/s/:token",
component: Timeline,
name: "folder-share",
props: (route) => ({
rootTitle: t("memories", "Shared Folder"),
}),
},
{
path: "/a/:token",
component: Timeline,
name: "album-share",
props: (route) => ({
rootTitle: t("memories", "Shared Album"),
}),
},
{
2023-02-08 22:13:13 +00:00
path: "/map",
2023-02-08 21:35:42 +00:00
component: SplitTimeline,
2023-02-08 22:13:13 +00:00
name: "map",
props: (route) => ({
2023-02-08 22:13:13 +00:00
rootTitle: t("memories", "Map"),
2023-02-08 21:35:42 +00:00
}),
},
2022-10-28 19:08:34 +00:00
],
});