diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 06b53f26a03da87e78fa99fb262b2f4ba831006e..e87a1af90ecca11f918f7c5e2150914c0d1697aa 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -556,6 +556,12 @@ testEmail: "é…信テスト" wordMute: "ワードミュート" userSaysSomething: "{name}ãŒä½•ã‹ã‚’言ã„ã¾ã—ãŸ" makeActive: "アクティブã«ã™ã‚‹" +display: "表示" + +_sidebar: + full: "フル" + icon: "アイコン" + hide: "éš ã™" _wordMute: muteWords: "ミュートã™ã‚‹ãƒ¯ãƒ¼ãƒ‰" diff --git a/src/client/app.vue b/src/client/app.vue index dcd393db32504df5d6af20d6ef51520eae31e9bb..32777e21b106bceb5b391d1372a15a77127ddf0c 100644 --- a/src/client/app.vue +++ b/src/client/app.vue @@ -1,6 +1,6 @@ <template> <div class="mk-app" v-hotkey.global="keymap"> - <header class="header"> + <header class="header" ref="header"> <div class="title" ref="title"> <transition :name="$store.state.device.animation ? 'header' : ''" mode="out-in" appear> <button class="_button back" v-if="canBack" @click="back()"><fa :icon="faChevronLeft"/></button> @@ -31,7 +31,7 @@ </div> </header> - <x-sidebar ref="nav"/> + <x-sidebar ref="nav" @change-view-mode="calcHeaderWidth"/> <div class="contents" ref="contents" :class="{ wallpaper }"> <main ref="main"> @@ -77,7 +77,7 @@ </template> </div> - <div class="buttons"> + <div class="buttons" :class="{ navHidden }"> <button class="button nav _button" @click="showNav" ref="navButton"><fa :icon="faBars"/><i v-if="navIndicated"><fa :icon="faCircle"/></i></button> <button v-if="$route.name === 'index'" class="button home _button" @click="top()"><fa :icon="faHome"/></button> <button v-else class="button home _button" @click="$router.push('/')"><fa :icon="faHome"/></button> @@ -85,7 +85,7 @@ <button v-if="$store.getters.isSignedIn" class="button post _buttonPrimary" @click="post()"><fa :icon="faPencilAlt"/></button> </div> - <button v-if="$store.getters.isSignedIn" class="post _buttonPrimary" @click="post()"><fa :icon="faPencilAlt"/></button> + <button v-if="$store.getters.isSignedIn" class="post _buttonPrimary" :class="{ navHidden }" @click="post()"><fa :icon="faPencilAlt"/></button> <stream-indicator v-if="$store.getters.isSignedIn"/> </div> @@ -124,6 +124,7 @@ export default Vue.extend({ isDesktop: window.innerWidth >= DESKTOP_THRESHOLD, canBack: false, menuDef: this.$store.getters.nav({}), + navHidden: false, wallpaper: localStorage.getItem('wallpaper') != null, faGripVertical, faChevronLeft, faComments, faHashtag, faBroadcastTower, faFireAlt, faEllipsisH, faPencilAlt, faBars, faTimes, faBell, faSearch, faUserCog, faCog, faUser, faHome, faStar, faCircle, faAt, faEnvelope, faListUl, faPlus, faUserClock, faLaugh, faUsers, faTachometerAlt, faExchangeAlt, faGlobe, faChartBar, faCloud, faServer, faProjectDiagram }; @@ -225,22 +226,15 @@ export default Vue.extend({ }, mounted() { - const adjustTitlePosition = () => { - const left = this.$refs.main.getBoundingClientRect().left - this.$refs.nav.$el.offsetWidth; - if (left >= 0) { - this.$refs.title.style.left = left + 'px'; - } - }; - - adjustTitlePosition(); + this.adjustTitlePosition(); const ro = new ResizeObserver((entries, observer) => { - adjustTitlePosition(); + this.adjustTitlePosition(); }); ro.observe(this.$refs.contents); - window.addEventListener('resize', adjustTitlePosition, { passive: true }); + window.addEventListener('resize', this.adjustTitlePosition, { passive: true }); if (!this.isDesktop) { window.addEventListener('resize', () => { @@ -250,9 +244,27 @@ export default Vue.extend({ // widget follow this.attachSticky(); + + this.$nextTick(() => { + this.calcHeaderWidth(); + }); }, methods: { + adjustTitlePosition() { + const left = this.$refs.main.getBoundingClientRect().left - this.$refs.nav.$el.offsetWidth; + if (left >= 0) { + this.$refs.title.style.left = left + 'px'; + } + }, + + calcHeaderWidth() { + const navWidth = this.$refs.nav.$el.offsetWidth; + this.navHidden = navWidth === 0; + this.$refs.header.style.width = `calc(100% - ${navWidth}px)`; + this.adjustTitlePosition(); + }, + showNav() { this.$refs.nav.show(); }, @@ -373,12 +385,8 @@ export default Vue.extend({ <style lang="scss" scoped> .mk-app { $header-height: 60px; - $nav-width: 250px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-icon-only-width: 80px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ $main-width: 670px; $ui-font-size: 1em; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-icon-only-threshold: 1279px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-hide-threshold: 650px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ $header-sub-hide-threshold: 1090px; $left-widgets-hide-threshold: 1600px; $right-widgets-hide-threshold: 1090px; @@ -399,21 +407,13 @@ export default Vue.extend({ top: 0; right: 0; height: $header-height; - width: calc(100% - #{$nav-width}); + width: 100%; //background-color: var(--panel); -webkit-backdrop-filter: blur(32px); backdrop-filter: blur(32px); background-color: var(--header); border-bottom: solid 1px var(--divider); - @media (max-width: $nav-icon-only-threshold) { - width: calc(100% - #{$nav-icon-only-width}); - } - - @media (max-width: $nav-hide-threshold) { - width: 100%; - } - > .title { position: relative; line-height: $header-height; @@ -683,7 +683,7 @@ export default Vue.extend({ } > .post { - display: none; + display: block; position: fixed; z-index: 1000; bottom: 32px; @@ -694,8 +694,8 @@ export default Vue.extend({ box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12); font-size: 22px; - @media (min-width: ($nav-hide-threshold + 1px)) { - display: block; + &.navHidden { + display: none; } @media (min-width: ($header-sub-hide-threshold + 1px)) { @@ -717,7 +717,7 @@ export default Vue.extend({ padding: 0 16px 16px 16px; } - @media (min-width: ($nav-hide-threshold + 1px)) { + &:not(.navHidden) { display: none; } diff --git a/src/client/components/sidebar.vue b/src/client/components/sidebar.vue index 558087f1d8d179b4dd313c2e69d6d035bb03f077..d64112c52e12e06df9e5c1d4531ced8f56d521ac 100644 --- a/src/client/components/sidebar.vue +++ b/src/client/components/sidebar.vue @@ -9,7 +9,7 @@ </transition> <transition name="nav"> - <nav class="nav" v-show="showing"> + <nav class="nav" :class="{ iconOnly, hidden }" v-show="showing"> <div> <button class="item _button account" @click="openAccountMenu" v-if="$store.getters.isSignedIn"> <mk-avatar :user="$store.state.i" class="avatar"/><mk-acct class="text" :user="$store.state.i"/> @@ -62,6 +62,8 @@ export default Vue.extend({ menuDef: this.$store.getters.nav({ search: this.search }), + iconOnly: false, + hidden: false, faGripVertical, faChevronLeft, faComments, faHashtag, faBroadcastTower, faFireAlt, faEllipsisH, faPencilAlt, faBars, faTimes, faBell, faSearch, faUserCog, faCog, faUser, faHome, faStar, faCircle, faAt, faEnvelope, faListUl, faPlus, faUserClock, faLaugh, faUsers, faTachometerAlt, faExchangeAlt, faGlobe, faChartBar, faCloud, faServer, faProjectDiagram }; }, @@ -85,9 +87,35 @@ export default Vue.extend({ $route(to, from) { this.showing = false; }, + + '$store.state.device.sidebarDisplay'() { + this.calcViewState(); + }, + + iconOnly() { + this.$nextTick(() => { + this.$emit('change-view-mode'); + }); + }, + + hidden() { + this.$nextTick(() => { + this.$emit('change-view-mode'); + }); + } + }, + + created() { + window.addEventListener('resize', this.calcViewState); + this.calcViewState(); }, methods: { + calcViewState() { + this.iconOnly = (window.innerWidth <= 1279) || (this.$store.state.device.sidebarDisplay === 'icon'); + this.hidden = (window.innerWidth <= 650) || (this.$store.state.device.sidebarDisplay === 'hide'); + }, + show() { this.showing = true; }, @@ -314,10 +342,8 @@ export default Vue.extend({ .mvcprjjd { $ui-font-size: 1em; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-width: 250px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-icon-only-width: 80px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-icon-only-threshold: 1279px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ - $nav-hide-threshold: 650px; // TODO: ã©ã“ã‹ã«é›†ç´„ã—ãŸã„ + $nav-width: 250px; + $nav-icon-only-width: 80px; > .nav-back { z-index: 1001; @@ -331,19 +357,66 @@ export default Vue.extend({ width: $nav-width; box-sizing: border-box; - @media (max-width: $nav-icon-only-threshold) { + &.iconOnly { flex: 0 0 $nav-icon-only-width; width: $nav-icon-only-width; + + &:not(.hidden) { + > div { + width: $nav-icon-only-width; + + > .divider { + margin: 8px auto; + width: calc(100% - 32px); + } + + > .item { + padding-left: 0; + width: 100%; + text-align: center; + font-size: $ui-font-size * 1.2; + line-height: 3.7rem; + + > [data-icon], + > .avatar { + margin-right: 0; + } + + > i { + left: 10px; + } + + > .text { + display: none; + } + + &:first-child { + margin-bottom: 8px; + } + + &:last-child { + margin-top: 8px; + } + } + } + } } - @media (max-width: $nav-hide-threshold) { + &.hidden { position: fixed; top: 0; left: 0; z-index: 1001; + + > div { + > .index, + > .notifications { + display: none; + } + } } - @media (min-width: $nav-hide-threshold + 1px) { + &:not(.hidden) { display: block !important; } @@ -365,25 +438,6 @@ export default Vue.extend({ border-top: solid 1px var(--divider); } - @media (max-width: $nav-icon-only-threshold) and (min-width: $nav-hide-threshold + 1px) { - width: $nav-icon-only-width; - - > .divider { - margin: 8px auto; - width: calc(100% - 32px); - } - - > .item { - &:first-child { - margin-bottom: 8px; - } - - &:last-child { - margin-top: 8px; - } - } - } - > .item { position: relative; display: block; @@ -452,34 +506,6 @@ export default Vue.extend({ margin-top: 16px; border-top: solid 1px var(--divider); } - - @media (max-width: $nav-icon-only-threshold) and (min-width: $nav-hide-threshold + 1px) { - padding-left: 0; - width: 100%; - text-align: center; - font-size: $ui-font-size * 1.2; - line-height: 3.7rem; - - > [data-icon], - > .avatar { - margin-right: 0; - } - - > i { - left: 10px; - } - - > .text { - display: none; - } - } - } - - @media (max-width: $nav-hide-threshold) { - > .index, - > .notifications { - display: none; - } } } } diff --git a/src/client/components/ui/radio.vue b/src/client/components/ui/radio.vue index 0b0fad6773483e11c8c1538b24bffc182e0ba657..311cdce32dbfcb347ede681a741aa3442d5d03cb 100644 --- a/src/client/components/ui/radio.vue +++ b/src/client/components/ui/radio.vue @@ -42,6 +42,7 @@ export default Vue.extend({ }, methods: { toggle() { + if (this.disabled) return; this.$emit('change', this.value); } } @@ -61,7 +62,10 @@ export default Vue.extend({ &.disabled { opacity: 0.6; - cursor: not-allowed; + + &, * { + cursor: not-allowed !important; + } } &.checked { diff --git a/src/client/pages/preferences/sidebar.vue b/src/client/pages/preferences/sidebar.vue index 34c9916cf51de2bf8c03d1ced64d5c76b7a73d61..10aad0f3a0637cc1d407499bbc5c51f4f749de56 100644 --- a/src/client/pages/preferences/sidebar.vue +++ b/src/client/pages/preferences/sidebar.vue @@ -7,6 +7,12 @@ <template #desc><button class="_textButton" @click="addItem">{{ $t('addItem') }}</button></template> </mk-textarea> </div> + <div class="_content"> + <div>{{ $t('display') }}</div> + <mk-radio v-model="sidebarDisplay" value="full">{{ $t('_sidebar.full') }}</mk-radio> + <mk-radio v-model="sidebarDisplay" value="icon">{{ $t('_sidebar.icon') }}</mk-radio> + <!-- <mk-radio v-model="sidebarDisplay" value="hide" disabled>{{ $t('_sidebar.hide') }}</mk-radio>--> <!-- TODO: サイドãƒãƒ¼ã‚’完全ã«éš ã›ã‚‹ã‚ˆã†ã«ã™ã‚‹ã¨ã€åˆ¥é€”ãƒãƒ³ãƒãƒ¼ã‚¬ãƒ¼ãƒœã‚¿ãƒ³ã®ã‚ˆã†ãªã‚‚ã®ã‚’UIã«è¡¨ç¤ºã™ã‚‹å¿…è¦ãŒã‚ã‚Šé¢å€’ --> + </div> <div class="_footer"> <mk-button inline @click="save()" primary><fa :icon="faSave"/> {{ $t('save') }}</mk-button> <mk-button inline @click="reset()"><fa :icon="faRedo"/> {{ $t('default') }}</mk-button> @@ -19,12 +25,14 @@ import Vue from 'vue'; import { faListUl, faSave, faRedo } from '@fortawesome/free-solid-svg-icons'; import MkButton from '../../components/ui/button.vue'; import MkTextarea from '../../components/ui/textarea.vue'; +import MkRadio from '../../components/ui/radio.vue'; import { defaultDeviceUserSettings } from '../../store'; export default Vue.extend({ components: { MkButton, MkTextarea, + MkRadio, }, data() { @@ -38,7 +46,12 @@ export default Vue.extend({ computed: { splited(): string[] { return this.items.trim().split('\n').filter(x => x.trim() !== ''); - } + }, + + sidebarDisplay: { + get() { return this.$store.state.device.sidebarDisplay; }, + set(value) { this.$store.commit('device/set', { key: 'sidebarDisplay', value }); } + }, }, created() { diff --git a/src/client/store.ts b/src/client/store.ts index 0bf452048765a3705c7dec622cf5a3487bcfca51..93a28182d2a2402f51f6bd7a05b27fad012e0227 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -77,6 +77,7 @@ export const defaultDeviceSettings = { enableInfiniteScroll: true, fixedWidgetsPosition: false, useBlurEffectForModal: true, + sidebarDisplay: 'full', // full, icon, hide roomGraphicsQuality: 'medium', roomUseOrthographicCamera: true, deckColumnAlign: 'left',