refactor(client): Refine routing (#8846)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import { $i } from './account';
|
||||
import { mainRouter } from '@/router';
|
||||
import { search } from '@/scripts/search';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { ui } from '@/config';
|
||||
import { $i } from './account';
|
||||
import { unisonReload } from '@/scripts/unison-reload';
|
||||
import { router } from './router';
|
||||
|
||||
export const menuDef = reactive({
|
||||
notifications: {
|
||||
@@ -60,16 +60,16 @@ export const menuDef = reactive({
|
||||
title: 'lists',
|
||||
icon: 'fas fa-list-ul',
|
||||
show: computed(() => $i != null),
|
||||
active: computed(() => router.currentRoute.value.path.startsWith('/timeline/list/') || router.currentRoute.value.path === '/my/lists' || router.currentRoute.value.path.startsWith('/my/lists/')),
|
||||
active: computed(() => mainRouter.currentRoute.value.path.startsWith('/timeline/list/') || mainRouter.currentRoute.value.path === '/my/lists' || mainRouter.currentRoute.value.path.startsWith('/my/lists/')),
|
||||
action: (ev) => {
|
||||
const items = ref([{
|
||||
type: 'pending'
|
||||
type: 'pending',
|
||||
}]);
|
||||
os.api('users/lists/list').then(lists => {
|
||||
const _items = [...lists.map(list => ({
|
||||
type: 'link',
|
||||
text: list.name,
|
||||
to: `/timeline/list/${list.id}`
|
||||
to: `/timeline/list/${list.id}`,
|
||||
})), null, {
|
||||
type: 'link',
|
||||
to: '/my/lists',
|
||||
@@ -91,16 +91,16 @@ export const menuDef = reactive({
|
||||
title: 'antennas',
|
||||
icon: 'fas fa-satellite',
|
||||
show: computed(() => $i != null),
|
||||
active: computed(() => router.currentRoute.value.path.startsWith('/timeline/antenna/') || router.currentRoute.value.path === '/my/antennas' || router.currentRoute.value.path.startsWith('/my/antennas/')),
|
||||
active: computed(() => mainRouter.currentRoute.value.path.startsWith('/timeline/antenna/') || mainRouter.currentRoute.value.path === '/my/antennas' || mainRouter.currentRoute.value.path.startsWith('/my/antennas/')),
|
||||
action: (ev) => {
|
||||
const items = ref([{
|
||||
type: 'pending'
|
||||
type: 'pending',
|
||||
}]);
|
||||
os.api('antennas/list').then(antennas => {
|
||||
const _items = [...antennas.map(antenna => ({
|
||||
type: 'link',
|
||||
text: antenna.name,
|
||||
to: `/timeline/antenna/${antenna.id}`
|
||||
to: `/timeline/antenna/${antenna.id}`,
|
||||
})), null, {
|
||||
type: 'link',
|
||||
to: '/my/antennas',
|
||||
@@ -178,29 +178,22 @@ export const menuDef = reactive({
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'default');
|
||||
unisonReload();
|
||||
}
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.deck,
|
||||
active: ui === 'deck',
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'deck');
|
||||
unisonReload();
|
||||
}
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.classic,
|
||||
active: ui === 'classic',
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'classic');
|
||||
unisonReload();
|
||||
}
|
||||
}, /*{
|
||||
text: i18n.ts.desktop + ' (β)',
|
||||
active: ui === 'desktop',
|
||||
action: () => {
|
||||
localStorage.setItem('ui', 'desktop');
|
||||
unisonReload();
|
||||
}
|
||||
}*/], ev.currentTarget ?? ev.target);
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user