From d915ae0807353a0f33cde565686e40f7718e9cca Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 8 Feb 2020 12:46:14 +0900 Subject: [PATCH] Resolve #5879 --- src/client/app.vue | 229 ++++++++++++++++++++++----------------------- 1 file changed, 112 insertions(+), 117 deletions(-) diff --git a/src/client/app.vue b/src/client/app.vue index ace3ba868..5b9e423d3 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -24,57 +24,67 @@ - + + + + + + +
@@ -124,7 +134,7 @@
- + @@ -162,6 +172,7 @@ export default Vue.extend({ return { host: host, pageKey: 0, + showNav: false, searching: false, notificationsOpen: false, accounts: [], @@ -302,67 +313,6 @@ export default Vue.extend({ } }, - showNav(ev) { - this.$root.menu({ - items: [{ - text: this.$t('search'), - icon: faSearch, - action: this.search, - }, null, this.$store.state.i.isAdmin || this.$store.state.i.isModerator ? { - text: this.$t('instance'), - icon: faServer, - action: () => this.oepnInstanceMenu(ev), - } : undefined, { - type: 'link', - text: this.$t('announcements'), - to: '/announcements', - icon: faBroadcastTower, - indicate: this.$store.state.i.hasUnreadAnnouncement, - }, { - type: 'link', - text: this.$t('featured'), - to: '/featured', - icon: faFireAlt, - }, { - type: 'link', - text: this.$t('explore'), - to: '/explore', - icon: faHashtag, - }, { - type: 'link', - text: this.$t('messaging'), - to: '/my/messaging', - icon: faComments, - indicate: this.$store.state.i.hasUnreadMessagingMessage, - }, this.$store.state.i.isLocked ? { - type: 'link', - text: this.$t('followRequests'), - to: '/my/follow-requests', - icon: faUserClock, - indicate: this.$store.state.i.pendingReceivedFollowRequestsCount > 0, - } : undefined, { - type: 'link', - text: this.$t('drive'), - to: '/my/drive', - icon: faCloud, - }, { - text: this.$t('more'), - icon: faEllipsisH, - action: () => this.more(ev), - indicate: this.$store.state.i.hasUnreadMentions || this.$store.state.i.hasUnreadSpecifiedNotes - }, null, { - type: 'user', - user: this.$store.state.i, - action: () => this.openAccountMenu(ev), - }], - direction: 'up', - align: 'left', - fixed: true, - width: 200, - source: ev.currentTarget || ev.target, - }); - }, - async openAccountMenu(ev) { const accounts = (await this.$root.api('users/show', { userIds: this.$store.state.device.accounts.map(x => x.id) })).filter(x => x.id !== this.$store.state.i.id); @@ -619,6 +569,28 @@ export default Vue.extend({ transform: translateY(32px); } +.nav-enter-active, +.nav-leave-active { + opacity: 1; + transform: translateX(0); + transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1), opacity 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.nav-enter, +.nav-leave-active { + opacity: 0; + transform: translateX(-240px); +} + +.nav-back-enter-active, +.nav-back-leave-active { + opacity: 1; + transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1); +} +.nav-back-enter, +.nav-back-leave-active { + opacity: 0; +} + .mk-app { $header-height: 60px; $nav-width: 250px; @@ -764,6 +736,16 @@ export default Vue.extend({ } } + > .nav-back { + position: fixed; + top: 0; + left: 0; + z-index: 1001; + width: 100%; + height: 100%; + background: var(--modalBg); + } + > .nav { $avatar-size: 32px; $avatar-margin: ($header-height - $avatar-size) / 2; @@ -778,7 +760,14 @@ export default Vue.extend({ } @media (max-width: $nav-hide-threshold) { - display: none; + position: fixed; + top: 0; + left: 0; + z-index: 1001; + } + + @media (min-width: $nav-hide-threshold + 1px) { + display: block !important; } > div { @@ -799,7 +788,7 @@ export default Vue.extend({ border-top: solid 1px var(--divider); } - @media (max-width: $nav-icon-only-threshold) { + @media (max-width: $nav-icon-only-threshold) and (min-width: $nav-hide-threshold + 1px) { width: $nav-icon-only-width; padding: 8px 0; @@ -813,7 +802,6 @@ export default Vue.extend({ display: block; padding-left: 32px; font-size: $ui-font-size; - font-weight: bold; line-height: 3.2rem; text-overflow: ellipsis; overflow: hidden; @@ -871,7 +859,7 @@ export default Vue.extend({ color: var(--navActive); } - @media (max-width: $nav-icon-only-threshold) { + @media (max-width: $nav-icon-only-threshold) and (min-width: $nav-hide-threshold + 1px) { padding-left: 0; width: 100%; text-align: center; @@ -892,6 +880,13 @@ export default Vue.extend({ } } } + + @media (max-width: $nav-hide-threshold) { + > .index, + > .notifications { + display: none; + } + } } }