mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-22 20:45:13 +00:00
refactor
This commit is contained in:
parent
a970309b8b
commit
0be42fc3a9
3 changed files with 66 additions and 124 deletions
63
packages/frontend/src/ui/_common_/common.ts
Normal file
63
packages/frontend/src/ui/_common_/common.ts
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { instance } from '@/instance';
|
||||||
|
import { host } from '@/config';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
|
export function openInstanceMenu(ev: MouseEvent) {
|
||||||
|
os.popupMenu([{
|
||||||
|
text: instance.name ?? host,
|
||||||
|
type: 'label',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.instanceInfo,
|
||||||
|
icon: 'ti ti-info-circle',
|
||||||
|
to: '/about',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.customEmojis,
|
||||||
|
icon: 'ti ti-mood-happy',
|
||||||
|
to: '/about#emojis',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.federation,
|
||||||
|
icon: 'ti ti-whirl',
|
||||||
|
to: '/about#federation',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.charts,
|
||||||
|
icon: 'ti ti-chart-line',
|
||||||
|
to: '/about#charts',
|
||||||
|
}, null, {
|
||||||
|
type: 'parent',
|
||||||
|
text: i18n.ts.help,
|
||||||
|
icon: 'ti ti-question-circle',
|
||||||
|
children: [{
|
||||||
|
type: 'link',
|
||||||
|
to: '/mfm-cheat-sheet',
|
||||||
|
text: i18n.ts._mfm.cheatSheet,
|
||||||
|
icon: 'ti ti-code',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
to: '/scratchpad',
|
||||||
|
text: i18n.ts.scratchpad,
|
||||||
|
icon: 'ti ti-terminal-2',
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
to: '/api-console',
|
||||||
|
text: 'API Console',
|
||||||
|
icon: 'ti ti-terminal-2',
|
||||||
|
}, null, {
|
||||||
|
text: i18n.ts.document,
|
||||||
|
icon: 'ti ti-question-circle',
|
||||||
|
action: () => {
|
||||||
|
window.open('https://misskey-hub.net/help.html', '_blank');
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
}, {
|
||||||
|
type: 'link',
|
||||||
|
text: i18n.ts.aboutMisskey,
|
||||||
|
to: '/about-misskey',
|
||||||
|
}], ev.currentTarget ?? ev.target, {
|
||||||
|
align: 'left',
|
||||||
|
});
|
||||||
|
}
|
|
@ -43,14 +43,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, defineComponent, ref, toRef, watch } from 'vue';
|
import { computed, defineAsyncComponent, ref, toRef, watch } from 'vue';
|
||||||
import { host } from '@/config';
|
import { openInstanceMenu } from './common';
|
||||||
import { search } from '@/scripts/search';
|
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { navbarItemDef } from '@/navbar';
|
import { navbarItemDef } from '@/navbar';
|
||||||
import { openAccountMenu as openAccountMenu_ } from '@/account';
|
import { openAccountMenu as openAccountMenu_ } from '@/account';
|
||||||
import { defaultStore } from '@/store';
|
import { defaultStore } from '@/store';
|
||||||
import { instance } from '@/instance';
|
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
const menu = toRef(defaultStore.state, 'menu');
|
const menu = toRef(defaultStore.state, 'menu');
|
||||||
|
@ -68,65 +66,6 @@ function openAccountMenu(ev: MouseEvent) {
|
||||||
}, ev);
|
}, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openInstanceMenu(ev: MouseEvent) {
|
|
||||||
os.popupMenu([{
|
|
||||||
text: instance.name ?? host,
|
|
||||||
type: 'label',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.instanceInfo,
|
|
||||||
icon: 'ti ti-info-circle',
|
|
||||||
to: '/about',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.customEmojis,
|
|
||||||
icon: 'ti ti-mood-happy',
|
|
||||||
to: '/about#emojis',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.federation,
|
|
||||||
icon: 'ti ti-whirl',
|
|
||||||
to: '/about#federation',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.charts,
|
|
||||||
icon: 'ti ti-chart-line',
|
|
||||||
to: '/about#charts',
|
|
||||||
}, null, {
|
|
||||||
type: 'parent',
|
|
||||||
text: i18n.ts.help,
|
|
||||||
icon: 'ti ti-question-circle',
|
|
||||||
children: [{
|
|
||||||
type: 'link',
|
|
||||||
to: '/mfm-cheat-sheet',
|
|
||||||
text: i18n.ts._mfm.cheatSheet,
|
|
||||||
icon: 'ti ti-code',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
to: '/scratchpad',
|
|
||||||
text: i18n.ts.scratchpad,
|
|
||||||
icon: 'ti ti-terminal-2',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
to: '/api-console',
|
|
||||||
text: 'API Console',
|
|
||||||
icon: 'ti ti-terminal-2',
|
|
||||||
}, null, {
|
|
||||||
text: i18n.ts.document,
|
|
||||||
icon: 'ti ti-question-circle',
|
|
||||||
action: () => {
|
|
||||||
window.open('https://misskey-hub.net/help.html', '_blank');
|
|
||||||
},
|
|
||||||
}],
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.aboutMisskey,
|
|
||||||
to: '/about-misskey',
|
|
||||||
}], ev.currentTarget ?? ev.target, {
|
|
||||||
align: 'left',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function more() {
|
function more() {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkLaunchPad.vue')), {}, {
|
os.popup(defineAsyncComponent(() => import('@/components/MkLaunchPad.vue')), {}, {
|
||||||
}, 'closed');
|
}, 'closed');
|
||||||
|
|
|
@ -54,13 +54,12 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineAsyncComponent, ref, watch } from 'vue';
|
import { computed, defineAsyncComponent, ref, watch } from 'vue';
|
||||||
|
import { openInstanceMenu } from './common';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { navbarItemDef } from '@/navbar';
|
import { navbarItemDef } from '@/navbar';
|
||||||
import { $i, openAccountMenu as openAccountMenu_ } from '@/account';
|
import { $i, openAccountMenu as openAccountMenu_ } from '@/account';
|
||||||
import { defaultStore } from '@/store';
|
import { defaultStore } from '@/store';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { instance } from '@/instance';
|
|
||||||
import { host } from '@/config';
|
|
||||||
|
|
||||||
const iconOnly = ref(false);
|
const iconOnly = ref(false);
|
||||||
|
|
||||||
|
@ -91,65 +90,6 @@ function openAccountMenu(ev: MouseEvent) {
|
||||||
}, ev);
|
}, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openInstanceMenu(ev: MouseEvent) {
|
|
||||||
os.popupMenu([{
|
|
||||||
text: instance.name ?? host,
|
|
||||||
type: 'label',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.instanceInfo,
|
|
||||||
icon: 'ti ti-info-circle',
|
|
||||||
to: '/about',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.customEmojis,
|
|
||||||
icon: 'ti ti-mood-happy',
|
|
||||||
to: '/about#emojis',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.federation,
|
|
||||||
icon: 'ti ti-whirl',
|
|
||||||
to: '/about#federation',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.charts,
|
|
||||||
icon: 'ti ti-chart-line',
|
|
||||||
to: '/about#charts',
|
|
||||||
}, null, {
|
|
||||||
type: 'parent',
|
|
||||||
text: i18n.ts.help,
|
|
||||||
icon: 'ti ti-question-circle',
|
|
||||||
children: [{
|
|
||||||
type: 'link',
|
|
||||||
to: '/mfm-cheat-sheet',
|
|
||||||
text: i18n.ts._mfm.cheatSheet,
|
|
||||||
icon: 'ti ti-code',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
to: '/scratchpad',
|
|
||||||
text: i18n.ts.scratchpad,
|
|
||||||
icon: 'ti ti-terminal-2',
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
to: '/api-console',
|
|
||||||
text: 'API Console',
|
|
||||||
icon: 'ti ti-terminal-2',
|
|
||||||
}, null, {
|
|
||||||
text: i18n.ts.document,
|
|
||||||
icon: 'ti ti-question-circle',
|
|
||||||
action: () => {
|
|
||||||
window.open('https://misskey-hub.net/help.html', '_blank');
|
|
||||||
},
|
|
||||||
}],
|
|
||||||
}, {
|
|
||||||
type: 'link',
|
|
||||||
text: i18n.ts.aboutMisskey,
|
|
||||||
to: '/about-misskey',
|
|
||||||
}], ev.currentTarget ?? ev.target, {
|
|
||||||
align: 'left',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function more(ev: MouseEvent) {
|
function more(ev: MouseEvent) {
|
||||||
os.popup(defineAsyncComponent(() => import('@/components/MkLaunchPad.vue')), {
|
os.popup(defineAsyncComponent(() => import('@/components/MkLaunchPad.vue')), {
|
||||||
src: ev.currentTarget ?? ev.target,
|
src: ev.currentTarget ?? ev.target,
|
||||||
|
|
Loading…
Reference in a new issue