Skip to content

Commit

Permalink
Permanently visible left sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasHirt committed May 10, 2020
1 parent 1ad7f25 commit 00e9a5e
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 164 deletions.
2 changes: 1 addition & 1 deletion apps/files/src/components/FilesAppBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="files-app-bar" class="oc-app-bar">
<div id="files-app-bar" class="uk-padding-small">
<file-drop
v-if="!isIE11()"
:root-path="item"
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/branded-sidebar
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: Permanently visible branded left navigation sidebar

We've made left navigation sidebar permanently visible and moved branding (logo and brand color) into it.

https://github.com/owncloud/phoenix/issues/3395
https://github.com/owncloud/phoenix/pull/3442
124 changes: 90 additions & 34 deletions src/Phoenix.vue
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
<template>
<div>
<div class="uk-height-1-1">
<skip-to target="main">Skip to main</skip-to>
<div id="Phoenix" class="uk-height-1-1">
<template v-if="!showHeader">
<router-view name="fullscreen"></router-view>
<router-view name="fullscreen" />
</template>
<template v-else>
<message-bar :active-messages="activeMessages" @deleteMessage="$_deleteMessage" />
<top-bar
:applications-list="$_applicationsList"
:active-notifications="activeNotifications"
:user-id="user.id"
:user-display-name="user.displayname"
:has-app-navigation="appNavigationEntries.length > 1"
@toggleAppNavigationVisibility="toggleAppNavigationVisibility"
<div v-else key="core-content" class="uk-height-1-1 uk-flex uk-flex-row uk-flex-row">
<oc-sidebar
:logo-img="logoImage"
:product-name="productName"
:nav-items="navItems"
:class="sidebarClasses"
:fixed="isSidebarFixed"
@closed="toggleAppNavigationVisibility"
/>
<side-menu
v-if="appNavigationEntries.length > 1"
:visible="appNavigationVisible"
:entries="appNavigationEntries"
@closed="hideAppNavigation"
/>
<main id="main">
<router-view id="oc-app-container" name="app" class="uk-height-1-1"></router-view>
</main>
</template>
<div class="uk-width-expand">
<top-bar
class="uk-width-expand"
:applications-list="$_applicationsList"
:active-notifications="activeNotifications"
:user-id="user.id"
:user-display-name="user.displayname"
@toggleAppNavigationVisibility="toggleAppNavigationVisibility"
/>
<main id="main">
<message-bar :active-messages="activeMessages" @deleteMessage="$_deleteMessage" />
<router-view id="oc-app-container" name="app" class="uk-height-1-1" />
</main>
</div>
</div>
</div>
</div>
</template>
<script>
import 'inert-polyfill'
import { mapGetters, mapState, mapActions } from 'vuex'
import TopBar from './components/Top-Bar.vue'
import Menu from './components/Menu.vue'
import MessageBar from './components/MessageBar.vue'
import SkipTo from './components/SkipTo.vue'
export default {
components: {
MessageBar,
'side-menu': Menu,
TopBar,
SkipTo
},
data() {
return {
appNavigationVisible: false,
$_notificationsInterval: null
$_notificationsInterval: null,
windowWidth: 0
}
},
computed: {
Expand All @@ -73,7 +76,22 @@ export default {
return list.flat()
},
appNavigationEntries() {
showHeader() {
return this.$route.meta.hideHeadbar !== true
},
favicon() {
return this.configuration.theme.logo.favicon
},
logoImage() {
return `/themes/${this.configuration.theme.name}/assets/logo.png`
},
productName() {
return this.configuration.theme.general.name
},
navItems() {
if (this.publicPage()) {
return []
}
Expand All @@ -85,24 +103,36 @@ export default {
return []
}
return items.filter(item => {
if (item.enabled === undefined) {
return true
}
items.filter(item => {
if (this.capabilities === undefined) {
return false
}
if (item.enabled === undefined) {
return true
}
return item.enabled(this.capabilities)
})
return items.map(item => {
item.name = this.$gettext(item.name)
item.active = this.$route.name === item.route.name
return item
})
},
showHeader() {
return this.$route.meta.hideHeadbar !== true
sidebarClasses() {
if (this.appNavigationVisible) {
return ''
}
return 'uk-visible@l'
},
favicon() {
return this.configuration.theme.logo.favicon
isSidebarFixed() {
return this.windowWidth <= 960
}
},
watch: {
Expand All @@ -126,11 +156,17 @@ export default {
}
}
},
beforeDestroy() {
window.removeEventListener('resize', this.onResize)
},
destroyed() {
if (this.$_notificationsInterval) {
clearInterval(this.$_notificationsInterval)
}
},
metaInfo() {
const metaInfo = {
title: this.configuration.theme.general.name
Expand All @@ -140,9 +176,18 @@ export default {
}
return metaInfo
},
mounted() {
this.$nextTick(() => {
window.addEventListener('resize', this.onResize)
this.onResize()
})
},
beforeMount() {
this.initAuth()
},
methods: {
...mapActions(['initAuth', 'fetchNotifications', 'deleteMessage']),
Expand All @@ -163,6 +208,17 @@ export default {
$_deleteMessage(item) {
this.deleteMessage(item)
},
onResize() {
const width = window.innerWidth
// Reset navigation visibility in case of switching back to permanently visible sidebar
if (width >= 1200) {
this.appNavigationVisible = false
}
this.windowWidth = width
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/components/ApplicationsMenu.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<template>
<div v-if="!!applicationsList.length">
<div>
<oc-button
id="_appSwitcherButton"
ref="menubutton"
icon="apps"
variation="primary"
class="oc-topbar-menu-burger uk-height-1-1"
variation="raw"
class="oc-topbar-menu-burger"
:aria-label="$gettext('Application Switcher')"
/>
>
<oc-icon name="apps" aria-hidden="true" class="uk-flex" />
</oc-button>
<oc-drop
ref="menu"
drop-id="app-switcher-dropdown"
Expand Down
85 changes: 0 additions & 85 deletions src/components/Menu.vue

This file was deleted.

5 changes: 2 additions & 3 deletions src/components/Notifications.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<template>
<div id="oc-notification" class="uk-navbar-item">
<div id="oc-notification">
<oc-icon
id="oc-notification-bell"
class="oc-cursor-pointer"
class="oc-cursor-pointer uk-flex uk-flex-middle"
name="bell"
variation="inverted"
aria-label="Notifications"
/>
<oc-drop
Expand Down
Loading

0 comments on commit 00e9a5e

Please sign in to comment.