Skip to content

Commit

Permalink
add Bottom Bar
Browse files Browse the repository at this point in the history
  • Loading branch information
coke12103 authored and mei23 committed Oct 11, 2020
1 parent e9e4a9d commit ed10408
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 28 deletions.
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ common:
ShowAdvancedSettings: "Display unnecessary settings"
navbar-position: "Navbar position"
navbar-position-top: "Top"
navbar-position-bottom: "Bottom"
navbar-position-left: "Left"
navbar-position-right: "Right"
i-am-under-limited-internet: "I have limited bandwidth"
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ common:
ShowAdvancedSettings: "いらない設定を表示する"
navbar-position: "ナビゲーションバーの位置"
navbar-position-top: ""
navbar-position-bottom: ""
navbar-position-left: ""
navbar-position-right: ""
i-am-under-limited-internet: "私は通信を制限されている"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<section v-if="!$root.isMobile">
<header>{{ $t('@._settings.navbar-position') }}</header>
<ui-radio v-model="navbar" value="top">{{ $t('@._settings.navbar-position-top') }}</ui-radio>
<ui-radio v-model="navbar" value="bottom">{{ $t('@._settings.navbar-position-bottom') }}</ui-radio>
<ui-radio v-model="navbar" value="left">{{ $t('@._settings.navbar-position-left') }}</ui-radio>
<ui-radio v-model="navbar" value="right">{{ $t('@._settings.navbar-position-right') }}</ui-radio>
</section>
Expand Down
46 changes: 39 additions & 7 deletions src/client/app/desktop/views/components/ui.header.account.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<template>
<div class="account" v-hotkey.global="keymap">
<button class="header" :data-active="isOpen" @click="toggle">
<span class="username">{{ $store.state.i.username }}<template v-if="!isOpen"><fa icon="angle-down"/></template><template v-if="isOpen"><fa icon="angle-up"/></template></span>
<span class="username">{{ $store.state.i.username }}
<template v-if="!isOpen">
<fa v-if="navbar == 'bottom'" icon="angle-up"/>
<fa v-if="navbar == 'top'" icon="angle-down"/>
</template>
<template v-if="isOpen">
<fa v-if="navbar == 'top'" icon="angle-up"/>
<fa v-if="navbar == 'bottom'" icon="angle-down"/>
</template>
</span>
<mk-avatar class="avatar" :user="$store.state.i"/>
</button>
<transition name="zoom-in-top">
<div class="menu" v-if="isOpen">
<div class="menu" :class="navbar" v-if="isOpen">
<ul>
<li @click="closeMenu">
<router-link :to="`/@${ $store.state.i.username }`">
Expand Down Expand Up @@ -125,6 +134,9 @@ export default Vue.extend({
};
},
computed: {
navbar(): string {
return this.$store.state.device.navbar;
},
keymap(): any {
return {
'a|m': this.toggle
Expand Down Expand Up @@ -245,36 +257,56 @@ export default Vue.extend({
$bgcolor = var(--secondary)
display block
position absolute
top 56px
right -2px
width 230px
font-size 0.8em
background $bgcolor
border-radius 4px
box-shadow 0 var(--lineWidth) 4px rgba(#000, 0.25)
&.top
top 56px
&:before
border-bottom solid 14px rgba(#000, 0.1)
top -28px
&:after
border-bottom solid 14px $bgcolor
top -27px
&.bottom
bottom 56px
&:before
border-top solid 14px rgba(#000, 0.1)
bottom -27px
&:after
border-top solid 14px $bgcolor
bottom -27px
&:before
content ""
pointer-events none
display block
position absolute
top -28px
right 12px
border-top solid 14px transparent
border-right solid 14px transparent
border-bottom solid 14px rgba(#000, 0.1)
border-bottom solid 14px transparent
border-left solid 14px transparent
&:after
content ""
pointer-events none
display block
position absolute
top -27px
right 12px
border-top solid 14px transparent
border-right solid 14px transparent
border-bottom solid 14px $bgcolor
border-bottom solid 14px transparent
border-left solid 14px transparent
ul
Expand Down
13 changes: 11 additions & 2 deletions src/client/app/desktop/views/components/ui.header.clock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<span class="hhnn">{{ hh }}<span :style="{ visibility: now.getSeconds() % 2 == 0 ? 'visible' : 'hidden' }">:</span>{{ nn }}</span>
</time>
</div>
<div class="content">
<div class="content" :class="navbar">
<mk-analog-clock :dark="true"/>
</div>
</div>
Expand All @@ -24,6 +24,10 @@ export default Vue.extend({
};
},
computed: {
navbar(): string {
return this.$store.state.device.navbar;
},
yyyy(): number {
return this.now.getFullYear();
},
Expand Down Expand Up @@ -95,10 +99,15 @@ export default Vue.extend({
opacity 0.7
> .content
&.top
top auto
&.bottom
bottom 48px
visibility hidden
display block
position absolute
top auto
right 0
z-index 3
margin 0
Expand Down
25 changes: 20 additions & 5 deletions src/client/app/desktop/views/components/ui.header.nav.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="nav">
<div class="nav" :class="navbar">
<ul>
<li class="timeline" :class="{ active: $route.name == 'index' }" @click="goToTop">
<router-link to="/"><fa icon="home"/><p>{{ $t('@.timeline') }}</p></router-link>
Expand Down Expand Up @@ -36,6 +36,11 @@ export default Vue.extend({
faNewspaper, faHashtag
};
},
computed: {
navbar(): string {
return this.$store.state.device.navbar;
},
},
mounted() {
if (this.$store.getters.isSignedIn) {
this.connection = this.$root.stream.useSharedConnection('main');
Expand Down Expand Up @@ -80,6 +85,20 @@ export default Vue.extend({
line-height 3rem
vertical-align top
&.top
> ul
> li
&.active
> a
border-bottom solid 3px var(--primary)
&.bottom
> ul
> li
&.active
> a
border-top solid 3px var(--primary)
> ul
display inline-block
margin 0
Expand All @@ -94,10 +113,6 @@ export default Vue.extend({
height 48px
line-height 48px
&.active
> a
border-bottom solid 3px var(--primary)
> a
display inline-block
z-index 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<i class="bell"><fa :icon="['far', 'bell']"/></i>
<i class="circle" v-if="hasUnreadNotification"><fa icon="circle"/></i>
</button>
<div class="pop" v-if="isOpen">
<div class="pop" :class="navbar" v-if="isOpen">
<div class="read-all" v-if="hasUnreadNotification">
<button @click="readAllNotifications">{{ $t('mark-all-as-read') }}</button>
</div>
Expand All @@ -27,6 +27,10 @@ export default Vue.extend({
},
computed: {
navbar(): string {
return this.$store.state.device.navbar;
},
hasUnreadNotification(): boolean {
return this.$store.getters.isSignedIn && this.$store.state.i.hasUnreadNotification;
},
Expand Down Expand Up @@ -102,9 +106,31 @@ export default Vue.extend({
> .pop
$bgcolor = var(--secondary)
&.top
top 56px
&:before
top -28px
border-bottom solid 14px rgba(#000, 0.1)
&:after
top -27px
border-bottom solid 14px $bgcolor
&.bottom
bottom 56px
&:before
bottom -28px
border-top solid 14px rgba(#000, 0.1)
&:after
bottom -27px
border-top solid 14px $bgcolor
display block
position absolute
top 56px
right -72px
width 300px
background $bgcolor
Expand All @@ -124,23 +150,21 @@ export default Vue.extend({
pointer-events none
display block
position absolute
top -28px
right 74px
border-top solid 14px transparent
border-right solid 14px transparent
border-bottom solid 14px rgba(#000, 0.1)
border-bottom solid 14px transparent
border-left solid 14px transparent
&:after
content ""
pointer-events none
display block
position absolute
top -27px
right 74px
border-top solid 14px transparent
border-right solid 14px transparent
border-bottom solid 14px $bgcolor
border-bottom solid 14px transparent
border-left solid 14px transparent
> .mk-notifications
Expand Down
26 changes: 23 additions & 3 deletions src/client/app/desktop/views/components/ui.header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="header" :style="{'box-shadow': '0 0px 8px rgba(0, 0, 0, 0.2)'}">
<div class="header" :class="navbar" :style="{'box-shadow': '0 0px 8px rgba(0, 0, 0, 0.2)'}">
<div class="main" ref="main">
<div class="backdrop"></div>
<div class="main">
Expand Down Expand Up @@ -57,6 +57,12 @@ export default Vue.extend({
};
},
computed: {
navbar(): string {
return this.$store.state.device.navbar;
},
},
mounted() {
this.$store.commit('setUiHeaderHeight', this.$el.offsetHeight);
},
Expand All @@ -75,10 +81,25 @@ export default Vue.extend({
<style lang="stylus" scoped>
.header
position fixed
top 0
z-index 1000
width 100%
&.top
top 0
&.bottom
bottom 0
&.top
> .main
> .backdrop
background var(--desktopHeaderBg)
&.bottom
> .main
> .backdrop
background var(--secondary)
> .warn
display block
margin 0
Expand All @@ -97,7 +118,6 @@ export default Vue.extend({
z-index 1000
width 100%
height 48px
background var(--desktopHeaderBg)
> .main
z-index 1001
Expand Down
30 changes: 25 additions & 5 deletions src/client/app/desktop/views/components/ui.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<div class="mk-ui" v-hotkey.global="keymap">
<div class="bg" v-if="$store.getters.isSignedIn && $store.state.i.wallpaperUrl" :style="style"></div>
<x-header class="header" v-if="navbar == 'top'" v-show="!zenMode" ref="header"/>
<x-sidebar class="sidebar" v-if="navbar != 'top'" v-show="!zenMode" ref="sidebar"/>
<div class="content" :class="[{ sidebar: navbar != 'top', zen: zenMode }, navbar]">
<x-sidebar class="sidebar" v-if="navbar == 'left'" v-show="!zenMode" ref="sidebar"/>
<x-sidebar class="sidebar" v-if="navbar == 'right'" v-show="!zenMode" ref="sidebar"/>
<div class="content" :class="[{ sidebar: (navbar != 'top' && navbar != 'bottom'), zen: zenMode }, navbar]">
<slot></slot>
</div>
<x-header class="header" v-if="navbar == 'bottom'" v-show="!zenMode" ref="header"/>
<mk-stream-indicator v-if="$store.getters.isSignedIn"/>
</div>
</template>
Expand Down Expand Up @@ -50,18 +52,36 @@ export default Vue.extend({
watch: {
'$store.state.uiHeaderHeight'() {
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
if (this.navbar == 'bottom') {
this.$el.style.paddingTop = '0px';
this.$el.style.paddingBottom = this.$store.state.uiHeaderHeight + 'px';
}else if(this.navbar == 'top'){
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
this.$el.style.paddingBottom = '0px';
}else{
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
this.$el.style.paddingBottom = this.$store.state.uiHeaderHeight + 'px';
}
},
navbar() {
if (this.navbar != 'top') {
if (this.navbar != 'top' && this.navbar != 'bottom') {
this.$store.commit('setUiHeaderHeight', 0);
}
}
},
mounted() {
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
if (this.navbar == 'bottom') {
this.$el.style.paddingTop = '0px';
this.$el.style.paddingBottom = this.$store.state.uiHeaderHeight + 'px';
}else if(this.navbar == 'top'){
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
this.$el.style.paddingBottom = '0px';
}else{
this.$el.style.paddingTop = this.$store.state.uiHeaderHeight + 'px';
this.$el.style.paddingBottom = this.$store.state.uiHeaderHeight + 'px';
}
},
methods: {
Expand Down

0 comments on commit ed10408

Please sign in to comment.