mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 10:10:21 +01:00
feat: add tools to navbar (#12204)
* feat: add tools to navbar * docs(changelog): ナビゲーションバーにツールを追加しました
This commit is contained in:
parent
e2f34e3db6
commit
cf026e4c72
3 changed files with 46 additions and 27 deletions
|
@ -28,6 +28,7 @@
|
|||
- Feat: プラグイン・テーマを外部サイトから直接インストールできるようになりました
|
||||
- 外部サイトでの実装が必要です。詳細は Misskey Hub をご覧ください
|
||||
https://misskey-hub.net/docs/advanced/publish-on-your-website.html
|
||||
- Feat: ナビゲーションバーにツールを追加しました
|
||||
- Enhance: スワイプしてタイムラインを再読込できるように
|
||||
- PCの場合は右上のボタンからでも再読込できます
|
||||
- Enhance: タイムラインの自動更新を無効にできるように
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { computed, reactive } from 'vue';
|
||||
import { $i } from '@/account.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { openInstanceMenu } from '@/ui/_common_/common.js';
|
||||
import { openInstanceMenu, openToolsMenu } from '@/ui/_common_/common.js';
|
||||
import { lookup } from '@/scripts/lookup.js';
|
||||
import * as os from '@/os.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
@ -142,6 +142,13 @@ export const navbarItemDef = reactive({
|
|||
openInstanceMenu(ev);
|
||||
},
|
||||
},
|
||||
tools: {
|
||||
title: i18n.ts.tools,
|
||||
icon: 'ti ti-tool',
|
||||
action: (ev) => {
|
||||
openToolsMenu(ev);
|
||||
},
|
||||
},
|
||||
reload: {
|
||||
title: i18n.ts.reload,
|
||||
icon: 'ti ti-refresh',
|
||||
|
|
|
@ -3,12 +3,42 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
import * as os from '@/os.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import { host } from '@/config.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { $i } from '@/account.js';
|
||||
|
||||
function toolsMenuItems(): MenuItem[] {
|
||||
return [{
|
||||
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',
|
||||
}, {
|
||||
type: 'link',
|
||||
to: '/clicker',
|
||||
text: '🍪👈',
|
||||
icon: 'ti ti-cookie',
|
||||
}, ($i && ($i.isAdmin || $i.policies.canManageCustomEmojis)) ? {
|
||||
type: 'link',
|
||||
to: '/custom-emojis-manager',
|
||||
text: i18n.ts.manageCustomEmojis,
|
||||
icon: 'ti ti-icons',
|
||||
} : undefined, ($i && ($i.isAdmin || $i.policies.canManageAvatarDecorations)) ? {
|
||||
type: 'link',
|
||||
to: '/avatar-decorations',
|
||||
text: i18n.ts.manageAvatarDecorations,
|
||||
icon: 'ti ti-sparkles',
|
||||
} : undefined];
|
||||
}
|
||||
|
||||
export function openInstanceMenu(ev: MouseEvent) {
|
||||
os.popupMenu([{
|
||||
text: instance.name ?? host,
|
||||
|
@ -47,32 +77,7 @@ export function openInstanceMenu(ev: MouseEvent) {
|
|||
type: 'parent',
|
||||
text: i18n.ts.tools,
|
||||
icon: 'ti ti-tool',
|
||||
children: [{
|
||||
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',
|
||||
}, {
|
||||
type: 'link',
|
||||
to: '/clicker',
|
||||
text: '🍪👈',
|
||||
icon: 'ti ti-cookie',
|
||||
}, ($i && ($i.isAdmin || $i.policies.canManageCustomEmojis)) ? {
|
||||
type: 'link',
|
||||
to: '/custom-emojis-manager',
|
||||
text: i18n.ts.manageCustomEmojis,
|
||||
icon: 'ti ti-icons',
|
||||
} : undefined, ($i && ($i.isAdmin || $i.policies.canManageAvatarDecorations)) ? {
|
||||
type: 'link',
|
||||
to: '/avatar-decorations',
|
||||
text: i18n.ts.manageAvatarDecorations,
|
||||
icon: 'ti ti-sparkles',
|
||||
} : undefined],
|
||||
children: toolsMenuItems(),
|
||||
}, null, (instance.impressumUrl) ? {
|
||||
text: i18n.ts.impressum,
|
||||
icon: 'ti ti-file-invoice',
|
||||
|
@ -105,3 +110,9 @@ export function openInstanceMenu(ev: MouseEvent) {
|
|||
align: 'left',
|
||||
});
|
||||
}
|
||||
|
||||
export function openToolsMenu(ev: MouseEvent) {
|
||||
os.popupMenu(toolsMenuItems(), ev.currentTarget ?? ev.target, {
|
||||
align: 'left',
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue