From fd0bd2d74f27567f778dcf9f95f54e7a9d52b214 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 6 May 2020 11:41:44 +0900 Subject: [PATCH] feat(client): Make possible to customize sidebar Resolve #6285 --- locales/ja-JP.yml | 3 + src/client/app.ts | 109 +++++++++++++++++ src/client/app.vue | 145 ++++++++++------------- src/client/pages/preferences/index.vue | 6 +- src/client/pages/preferences/sidebar.vue | 86 ++++++++++++++ src/client/store.ts | 19 ++- webpack.config.ts | 8 +- 7 files changed, 283 insertions(+), 93 deletions(-) create mode 100644 src/client/app.ts create mode 100644 src/client/pages/preferences/sidebar.vue diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index f22a76917..ce9b0dcd6 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -498,6 +498,9 @@ removeAllFollowing: "フォローを全解除" removeAllFollowingDescription: "{host}からのフォローをすべて解除します。そのインスタンスがもう存在しなくなった場合などに実行してください。" userSuspended: "このユーザーは凍結されています。" userSilenced: "このユーザーはサイレンスされています。" +sidebar: "サイドバー" +divider: "分割線" +addItem: "項目を追加" _theme: explore: "テーマを探す" diff --git a/src/client/app.ts b/src/client/app.ts new file mode 100644 index 000000000..6a03526e3 --- /dev/null +++ b/src/client/app.ts @@ -0,0 +1,109 @@ +import { faTerminal, faHashtag, faBroadcastTower, faFireAlt, faSearch, faStar, faAt, faListUl, faUserClock, faUsers, faCloud, faGamepad, faFileAlt, faSatellite } from '@fortawesome/free-solid-svg-icons'; +import { faBell, faEnvelope, faComments } from '@fortawesome/free-regular-svg-icons'; + +export function createMenuDef(actions) { + return { + notifications: { + title: 'notifications', + icon: faBell, + show: store => store.getters.isSignedIn, + indicate: store => store.getters.isSignedIn && store.state.i.hasUnreadNotification, + to: '/my/notifications', + }, + messaging: { + title: 'messaging', + icon: faComments, + show: store => store.getters.isSignedIn, + indicate: store => store.getters.isSignedIn && store.state.i.hasUnreadMessagingMessage, + to: '/my/messaging', + }, + drive: { + title: 'drive', + icon: faCloud, + show: store => store.getters.isSignedIn, + to: '/my/drive', + }, + followRequests: { + title: 'followRequests', + icon: faUserClock, + show: store => store.getters.isSignedIn && store.state.i.isLocked, + indicate: store => store.getters.isSignedIn && store.state.i.hasPendingReceivedFollowRequest, + to: '/my/follow-requests', + }, + featured: { + title: 'featured', + icon: faFireAlt, + to: '/featured', + }, + explore: { + title: 'explore', + icon: faHashtag, + to: '/explore', + }, + announcements: { + title: 'announcements', + icon: faBroadcastTower, + indicate: store => store.getters.isSignedIn && store.state.i.hasUnreadAnnouncement, + to: '/announcements', + }, + search: { + title: 'search', + icon: faSearch, + action: () => actions.search(), + }, + lists: { + title: 'lists', + icon: faListUl, + show: store => store.getters.isSignedIn, + to: '/my/lists', + }, + groups: { + title: 'groups', + icon: faUsers, + show: store => store.getters.isSignedIn, + to: '/my/groups', + }, + antennas: { + title: 'antennas', + icon: faSatellite, + show: store => store.getters.isSignedIn, + to: '/my/antennas', + }, + mentions: { + title: 'mentions', + icon: faAt, + show: store => store.getters.isSignedIn, + indicate: store => store.getters.isSignedIn && store.state.i.hasUnreadMentions, + to: '/my/mentions', + }, + messages: { + title: 'directNotes', + icon: faEnvelope, + show: store => store.getters.isSignedIn, + indicate: store => store.getters.isSignedIn && store.state.i.hasUnreadSpecifiedNotes, + to: '/my/messages', + }, + favorites: { + title: 'favorites', + icon: faStar, + show: store => store.getters.isSignedIn, + to: '/my/favorites', + }, + pages: { + title: 'pages', + icon: faFileAlt, + show: store => store.getters.isSignedIn, + to: '/my/pages', + }, + games: { + title: 'games', + icon: faGamepad, + to: '/games', + }, + scratchpad: { + title: 'scratchpad', + icon: faTerminal, + to: '/scratchpad', + }, + }; +} diff --git a/src/client/app.vue b/src/client/app.vue index 4bc571021..96f1d3ad2 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -49,44 +49,20 @@ {{ $store.getters.isSignedIn ? $t('timeline') : $t('home') }} -