Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
feat(settings): hideable tab labels in navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
herteleo committed Apr 28, 2019
1 parent 996b18f commit ea95c72
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
37 changes: 35 additions & 2 deletions src/components/AppLayout.vue
Expand Up @@ -4,8 +4,10 @@
[$style.app]: true,
[$style.app__osMac]: $options.isMac,
[$style.app__osWin]: $options.isWin,
[$style.app__layoutLeft_extended]: !isLayoutInverted,
[$style.app__layoutRight_extended]: isLayoutInverted,
[$style.app__layoutLeft_compact]: !isLayoutInverted && !displaysTabLabels,
[$style.app__layoutLeft_extended]: !isLayoutInverted && displaysTabLabels,
[$style.app__layoutRight_compact]: isLayoutInverted && !displaysTabLabels,
[$style.app__layoutRight_extended]: isLayoutInverted && displaysTabLabels,
}"
>
<div
Expand Down Expand Up @@ -46,6 +48,9 @@ export default {
isLayoutInverted() {
return this.$store.getters['Settings/byKey']('layout.sideBarLocation') === 'right';
},
displaysTabLabels() {
return this.$store.getters['Settings/byKey']('navigation.displayTabLabels');
},
},
};
</script>
Expand All @@ -65,27 +70,55 @@ export default {
height: 100vh;
}
.app__osMac.app__layoutLeft_compact {
grid-template-areas:
"space space title title title"
"aside main main main main"
;
}
.app__osMac.app__layoutLeft_extended {
grid-template-areas:
"space space title title title"
"aside aside main main main"
;
}
.app__osMac.app__layoutRight_compact {
grid-template-areas:
"space space title title ....."
"main main main main aside"
;
}
.app__osMac.app__layoutRight_extended {
grid-template-areas:
"space space title ..... ....."
"main main main aside aside"
;
}
.app__osWin.app__layoutLeft_compact {
grid-template-areas:
"title title title space space"
"aside main main main main"
;
}
.app__osWin.app__layoutLeft_extended {
grid-template-areas:
"title title title space space"
"aside aside main main main"
;
}
.app__osWin.app__layoutRight_compact {
grid-template-areas:
"title title title space space"
"main main main main aside"
;
}
.app__osWin.app__layoutRight_extended {
grid-template-areas:
"title title title space space"
Expand Down
9 changes: 9 additions & 0 deletions src/components/TabsNav.vue
Expand Up @@ -11,11 +11,13 @@
v-for="tab in tabList"
:key="tab.id"
:item="tab"
:show-label="displaysTabLabels"
/>
<div
slot="footer"
:class="{
[$style.footer]: true,
[$style.footer__extended]: displaysTabLabels,
}"
>
<side-bar-button
Expand Down Expand Up @@ -54,6 +56,9 @@ export default {
this.$store.commit('Tabs/setSorting', items);
},
},
displaysTabLabels() {
return this.$store.getters['Settings/byKey']('navigation.displayTabLabels');
},
},
};
</script>
Expand All @@ -70,6 +75,10 @@ export default {
@apply mt-auto;
}
.footer__extended {
@apply flex flex-row-reverse;
}
.drag {
@apply cursor-move text-blue-lighter bg-blue;
}
Expand Down
13 changes: 10 additions & 3 deletions src/components/TabsNavItem.vue
Expand Up @@ -26,7 +26,10 @@
face="tab"
/>
</div>
<div :class="$style.label">
<div
v-if="showLabel"
:class="$style.label"
>
{{ item.label }}
</div>
</router-link>
Expand All @@ -39,6 +42,10 @@ export default {
type: Object,
default: () => ({}),
},
showLabel: {
type: Boolean,
required: true,
},
},
computed: {
pageState() {
Expand Down Expand Up @@ -71,7 +78,7 @@ export default {
.thumb {
@apply
flex flex-no-shrink justify-center items-center
p-1 w-8 h-8 mr-3 rounded-sm;
p-1 w-8 h-8 rounded-sm;
}
.thumbIsImage {
Expand All @@ -87,6 +94,6 @@ export default {
}
.label {
@apply truncate;
@apply ml-3 truncate;
}
</style>
1 change: 1 addition & 0 deletions src/store/modules/Settings.js
Expand Up @@ -6,6 +6,7 @@ const db = new Connection({
'dimmer.dimDelayInMs': 5000,
'dimmer.dimIfWindowIsNotInFocus': false,
'layout.sideBarLocation': 'left',
'navigation.displayTabLabels': true,
'notifications.holdBackIfWindowIsNotInFocus': false,
'notifications.sendSummaryIfWindowIsNotInFocus': false,
'notifications.summaryIntervalInMs': 1200000,
Expand Down
21 changes: 21 additions & 0 deletions src/views/Settings.vue
Expand Up @@ -44,6 +44,19 @@
</div>
</button>

<button
@click="displaysTabLabels = !displaysTabLabels"
>
<app-icon
:size="5"
:class="displaysTabLabels && $style.active"
:face="displaysTabLabels ? 'toggle-switch' : 'toggle-switch-off'"
/>
<div :class="$style.label">
Display navigation labels
</div>
</button>

<button
@click="notificationsPreventOnBlur = !notificationsPreventOnBlur"
>
Expand Down Expand Up @@ -139,6 +152,14 @@ export default {
this.$store.dispatch('Settings/set', ['layout.sideBarLocation', value]);
},
},
displaysTabLabels: {
get() {
return this.$store.getters['Settings/byKey']('navigation.displayTabLabels');
},
set(value) {
this.$store.dispatch('Settings/set', ['navigation.displayTabLabels', value]);
},
},
muteOnWindowBlur: {
get() {
return this.$store.getters['Settings/byKey']('window.muteAudioIfWindowIsNotInFocus');
Expand Down

0 comments on commit ea95c72

Please sign in to comment.