Add a proper setting menu
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,11 +1,3 @@
|
||||
import Profile from '@/views/Account/Profile.vue';
|
||||
import MyAccount from '@/views/Account/MyAccount.vue';
|
||||
import CreateGroup from '@/views/Group/Create.vue';
|
||||
import Group from '@/views/Group/Group.vue';
|
||||
import GroupList from '@/views/Group/GroupList.vue';
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import EditIdentity from '@/views/Account/children/EditIdentity.vue';
|
||||
|
||||
export enum ActorRouteName {
|
||||
GROUP_LIST = 'GroupList',
|
||||
GROUP = 'Group',
|
||||
@@ -13,56 +5,4 @@ export enum ActorRouteName {
|
||||
PROFILE = 'Profile',
|
||||
}
|
||||
|
||||
export enum MyAccountRouteName {
|
||||
CREATE_IDENTITY = 'CreateIdentity',
|
||||
UPDATE_IDENTITY = 'UpdateIdentity',
|
||||
}
|
||||
|
||||
export const actorRoutes: RouteConfig[] = [
|
||||
// {
|
||||
// path: '/groups',
|
||||
// name: ActorRouteName.GROUP_LIST,
|
||||
// component: GroupList,
|
||||
// meta: { requiredAuth: false },
|
||||
// },
|
||||
// {
|
||||
// path: '/groups/create',
|
||||
// name: ActorRouteName.CREATE_GROUP,
|
||||
// component: CreateGroup,
|
||||
// meta: { requiredAuth: true },
|
||||
// },
|
||||
// {
|
||||
// path: '/~:preferredUsername',
|
||||
// name: ActorRouteName.GROUP,
|
||||
// component: Group,
|
||||
// props: true,
|
||||
// meta: { requiredAuth: false },
|
||||
// },
|
||||
// {
|
||||
// path: '/@:name',
|
||||
// name: ActorRouteName.PROFILE,
|
||||
// component: Profile,
|
||||
// props: true,
|
||||
// meta: { requiredAuth: false },
|
||||
// },
|
||||
{
|
||||
path: '/my-account/identity',
|
||||
component: MyAccount,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
children: [
|
||||
{
|
||||
path: 'create',
|
||||
name: MyAccountRouteName.CREATE_IDENTITY,
|
||||
component: EditIdentity,
|
||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: false }),
|
||||
},
|
||||
{
|
||||
path: 'update/:identityName?',
|
||||
name: MyAccountRouteName.UPDATE_IDENTITY,
|
||||
component: EditIdentity,
|
||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: true }),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import Dashboard from '@/views/Admin/Dashboard.vue';
|
||||
import Follows from '@/views/Admin/Follows.vue';
|
||||
import Followings from '@/components/Admin/Followings.vue';
|
||||
import Followers from '@/components/Admin/Followers.vue';
|
||||
import Settings from '@/views/Admin/Settings.vue';
|
||||
|
||||
export enum AdminRouteName {
|
||||
DASHBOARD = 'Dashboard',
|
||||
RELAYS = 'Relays',
|
||||
ADMIN_SETTINGS = 'ADMIN_SETTINGS',
|
||||
RELAY_FOLLOWINGS = 'Followings',
|
||||
RELAY_FOLLOWERS = 'Followers',
|
||||
}
|
||||
|
||||
export const adminRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/admin',
|
||||
name: AdminRouteName.DASHBOARD,
|
||||
component: Dashboard,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/admin/settings',
|
||||
name: AdminRouteName.ADMIN_SETTINGS,
|
||||
component: Settings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/admin/relays',
|
||||
name: AdminRouteName.RELAYS,
|
||||
redirect: { name: AdminRouteName.RELAY_FOLLOWINGS },
|
||||
component: Follows,
|
||||
children: [
|
||||
{
|
||||
path: 'followings',
|
||||
name: AdminRouteName.RELAY_FOLLOWINGS,
|
||||
component: Followings,
|
||||
},
|
||||
{
|
||||
path: 'followers',
|
||||
name: AdminRouteName.RELAY_FOLLOWERS,
|
||||
component: Followers,
|
||||
},
|
||||
],
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
];
|
||||
@@ -5,12 +5,11 @@ import PageNotFound from '@/views/PageNotFound.vue';
|
||||
import Home from '@/views/Home.vue';
|
||||
import { UserRouteName, userRoutes } from './user';
|
||||
import { EventRouteName, eventRoutes } from '@/router/event';
|
||||
import { ActorRouteName, actorRoutes, MyAccountRouteName } from '@/router/actor';
|
||||
import { AdminRouteName, adminRoutes } from '@/router/admin';
|
||||
import { ActorRouteName } from '@/router/actor';
|
||||
import { ErrorRouteName, errorRoutes } from '@/router/error';
|
||||
import { authGuardIfNeeded } from '@/router/guards/auth-guard';
|
||||
import Search from '@/views/Search.vue';
|
||||
import { ModerationRouteName, moderationRoutes } from '@/router/moderation';
|
||||
import { SettingsRouteName, settingsRoutes } from '@/router/settings';
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
@@ -45,9 +44,7 @@ export const RouteName = {
|
||||
...UserRouteName,
|
||||
...EventRouteName,
|
||||
...ActorRouteName,
|
||||
...MyAccountRouteName,
|
||||
...AdminRouteName,
|
||||
...ModerationRouteName,
|
||||
...SettingsRouteName,
|
||||
...ErrorRouteName,
|
||||
};
|
||||
|
||||
@@ -58,9 +55,7 @@ const router = new Router({
|
||||
routes: [
|
||||
...userRoutes,
|
||||
...eventRoutes,
|
||||
...actorRoutes,
|
||||
...adminRoutes,
|
||||
...moderationRoutes,
|
||||
...settingsRoutes,
|
||||
...errorRoutes,
|
||||
{
|
||||
path: '/search/:searchTerm/:searchType?',
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import ReportList from '@/views/Moderation/ReportList.vue';
|
||||
import Report from '@/views/Moderation/Report.vue';
|
||||
import Logs from '@/views/Moderation/Logs.vue';
|
||||
|
||||
export enum ModerationRouteName {
|
||||
REPORTS = 'Reports',
|
||||
REPORT = 'Report',
|
||||
LOGS = 'Logs',
|
||||
}
|
||||
|
||||
export const moderationRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/moderation/reports/:filter?',
|
||||
name: ModerationRouteName.REPORTS,
|
||||
component: ReportList,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation/report/:reportId',
|
||||
name: ModerationRouteName.REPORT,
|
||||
component: Report,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation/logs',
|
||||
name: ModerationRouteName.LOGS,
|
||||
component: Logs,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
];
|
||||
156
js/src/router/settings.ts
Normal file
156
js/src/router/settings.ts
Normal file
@@ -0,0 +1,156 @@
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import Settings from '@/views/Settings.vue';
|
||||
import AccountSettings from '@/views/Settings/AccountSettings.vue';
|
||||
import Preferences from '@/views/Settings/Preferences.vue';
|
||||
import Notifications from '@/views/Settings/Notifications.vue';
|
||||
import Dashboard from '@/views/Admin/Dashboard.vue';
|
||||
import AdminSettings from '@/views/Admin/Settings.vue';
|
||||
import Follows from '@/views/Admin/Follows.vue';
|
||||
import Followings from '@/components/Admin/Followings.vue';
|
||||
import Followers from '@/components/Admin/Followers.vue';
|
||||
import ReportList from '@/views/Moderation/ReportList.vue';
|
||||
import Report from '@/views/Moderation/Report.vue';
|
||||
import Logs from '@/views/Moderation/Logs.vue';
|
||||
import EditIdentity from '@/views/Account/children/EditIdentity.vue';
|
||||
|
||||
|
||||
export enum SettingsRouteName {
|
||||
SETTINGS = 'SETTINGS',
|
||||
ACCOUNT_SETTINGS = 'ACCOUNT_SETTINGS',
|
||||
ACCOUNT_SETTINGS_GENERAL = 'ACCOUNT_SETTINGS_GENERAL',
|
||||
PREFERENCES = 'PREFERENCES',
|
||||
NOTIFICATIONS = 'NOTIFICATIONS',
|
||||
ADMIN = 'ADMIN',
|
||||
ADMIN_DASHBOARD = 'ADMIN_DASHBOARD',
|
||||
ADMIN_SETTINGS = 'ADMIN_SETTINGS',
|
||||
RELAYS = 'Relays',
|
||||
RELAY_FOLLOWINGS = 'Followings',
|
||||
RELAY_FOLLOWERS = 'Followers',
|
||||
MODERATION = 'MODERATION',
|
||||
REPORTS = 'Reports',
|
||||
REPORT = 'Report',
|
||||
REPORT_LOGS = 'Logs',
|
||||
CREATE_IDENTITY = 'CreateIdentity',
|
||||
UPDATE_IDENTITY = 'UpdateIdentity',
|
||||
IDENTITIES = 'IDENTITIES',
|
||||
}
|
||||
|
||||
export const settingsRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/settings',
|
||||
component: Settings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS },
|
||||
name: SettingsRouteName.SETTINGS,
|
||||
children: [
|
||||
{
|
||||
path: 'account',
|
||||
name: SettingsRouteName.ACCOUNT_SETTINGS,
|
||||
redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL },
|
||||
},
|
||||
{
|
||||
path: 'account/general',
|
||||
name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL,
|
||||
component: AccountSettings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'preferences',
|
||||
name: SettingsRouteName.PREFERENCES,
|
||||
component: Preferences,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'notifications',
|
||||
name: SettingsRouteName.NOTIFICATIONS,
|
||||
component: Notifications,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'admin',
|
||||
name: SettingsRouteName.ADMIN,
|
||||
redirect: { name: SettingsRouteName.ADMIN_DASHBOARD },
|
||||
},
|
||||
{
|
||||
path: 'admin/dashboard',
|
||||
name: SettingsRouteName.ADMIN_DASHBOARD,
|
||||
component: Dashboard,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'admin/settings',
|
||||
name: SettingsRouteName.ADMIN_SETTINGS,
|
||||
component: AdminSettings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'admin/relays',
|
||||
name: SettingsRouteName.RELAYS,
|
||||
redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS },
|
||||
component: Follows,
|
||||
children: [
|
||||
{
|
||||
path: 'followings',
|
||||
name: SettingsRouteName.RELAY_FOLLOWINGS,
|
||||
component: Followings,
|
||||
},
|
||||
{
|
||||
path: 'followers',
|
||||
name: SettingsRouteName.RELAY_FOLLOWERS,
|
||||
component: Followers,
|
||||
},
|
||||
],
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation',
|
||||
name: SettingsRouteName.MODERATION,
|
||||
redirect: { name: SettingsRouteName.REPORTS },
|
||||
},
|
||||
{
|
||||
path: '/moderation/reports/:filter?',
|
||||
name: SettingsRouteName.REPORTS,
|
||||
component: ReportList,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation/report/:reportId',
|
||||
name: SettingsRouteName.REPORT,
|
||||
component: Report,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation/logs',
|
||||
name: SettingsRouteName.REPORT_LOGS,
|
||||
component: Logs,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/identity',
|
||||
name: SettingsRouteName.IDENTITIES,
|
||||
redirect: { name: SettingsRouteName.UPDATE_IDENTITY },
|
||||
},
|
||||
{
|
||||
path: '/identity/create',
|
||||
name: SettingsRouteName.CREATE_IDENTITY,
|
||||
component: EditIdentity,
|
||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: false }),
|
||||
},
|
||||
{
|
||||
path: '/identity/update/:identityName?',
|
||||
name: SettingsRouteName.UPDATE_IDENTITY,
|
||||
component: EditIdentity,
|
||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: true }),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -7,7 +7,6 @@ import SendPasswordReset from '@/views/User/SendPasswordReset.vue';
|
||||
import PasswordReset from '@/views/User/PasswordReset.vue';
|
||||
import { beforeRegisterGuard } from '@/router/guards/register-guard';
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import AccountSettings from '@/views/User/AccountSettings.vue';
|
||||
import EmailValidate from '@/views/User/EmailValidate.vue';
|
||||
|
||||
export enum UserRouteName {
|
||||
@@ -18,7 +17,6 @@ export enum UserRouteName {
|
||||
PASSWORD_RESET = 'PasswordReset',
|
||||
VALIDATE = 'Validate',
|
||||
LOGIN = 'Login',
|
||||
ACCOUNT_SETTINGS = 'ACCOUNT_SETTINGS',
|
||||
}
|
||||
|
||||
export const userRoutes: RouteConfig[] = [
|
||||
@@ -80,10 +78,4 @@ export const userRoutes: RouteConfig[] = [
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/my-account/settings',
|
||||
name: UserRouteName.ACCOUNT_SETTINGS,
|
||||
component: AccountSettings,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user