Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new topbar design #6018

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 139 additions & 1 deletion packages/web-app-files/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
<template>
<main id="files" class="uk-flex uk-height-1-1">
<!-- <transition :name="appNavigationAnimation">
<focus-trap v-if="isSidebarVisible" :active="isSidebarFixed && appNavigationVisible"> -->
<oc-sidebar-nav

id="web-nav-sidebar"
class="oc-app-navigation"
:accessible-label-header="$gettext('Sidebar header')"
:accessible-label-nav="$gettext('Sidebar navigation menu')"
:accessible-label-footer="$gettext('Sidebar footer')"
:class="sidebarClasses"
>
<template #header>
<div class="uk-text-center">
<oc-button
v-if="isSidebarFixed"
variation="inverse"
appearance="raw"
class="web-sidebar-btn-close"
:aria-label="$gettext('Close sidebar')"
@click="toggleAppNavigationVisibility"
>
<oc-icon name="close" />
</oc-button>
</div>
</template>
<template #nav>
<oc-list>
<oc-sidebar-nav-item
v-for="link in sidebarNavItems"
:key="link.route.path"
:active="link.active"
:target="link.route.path"
:icon="link.icon || link.iconMaterial"
>
{{ link.name }}
</oc-sidebar-nav-item>
</oc-list>
</template>
<template v-if="sidebar.sidebarFooterContentComponent" #footer>
<component :is="sidebar.sidebarFooterContentComponent" />
</template>
</oc-sidebar-nav>
<!-- </focus-trap>
</transition> -->

<div
ref="filesListWrapper"
tabindex="-1"
Expand Down Expand Up @@ -29,16 +74,19 @@ import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'
import AppBar from './components/AppBar/AppBar.vue'
import ProgressBar from './components/Upload/ProgressBar.vue'
import SideBar from './components/SideBar/SideBar.vue'
import { FocusTrap } from 'focus-trap-vue'

export default {
components: {
AppBar,
ProgressBar,
SideBar
SideBar,
FocusTrap
},
mixins: [Mixins, MixinRoutes],
data() {
return {
appNavigationVisible: false,
createFolder: false,
fileUploadName: '',
fileUploadProgress: 0,
Expand All @@ -48,6 +96,12 @@ export default {
}
},
computed: {
...mapState(['route', 'sidebar']),
...mapGetters([
'capabilities',
'getNavItemsByExtension'
]),

...mapGetters('Files', ['dropzone', 'inProgress']),
...mapState('Files/sidebar', { sidebarClosed: 'closed' }),

Expand All @@ -56,6 +110,66 @@ export default {
},
showSidebar() {
return !this.sidebarClosed
},

sidebarNavItems() {
if (this.publicPage()) {
return []
}

const items = this.getNavItemsByExtension(this.currentExtension)
if (!items) {
return []
}

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),
active: this.$route.name === item.route.name
}))
},

sidebarClasses() {
if (this.appNavigationVisible) {
return ''
}

return 'uk-visible@l'
},

isSidebarFixed() {
return this.windowWidth <= 960
},

isSidebarVisible() {
if (this.sidebarNavItems.length === 0) {
return false
}
return this.windowWidth >= 900 || this.appNavigationVisible
},

appNavigationAnimation() {
if (this.windowWidth > 1200) {
return null
}

if (this.windowWidth > 960) {
return 'push-right'
}

return 'fade'
}
},
watch: {
Expand Down Expand Up @@ -206,4 +320,28 @@ main {
}
}
}

// .oc-app-navigation {
// position: sticky;
// top: 0;
// z-index: 1;
// }


// .web-sidebar-btn-close {
// position: absolute;
// right: var(--oc-space-medium);
// top: var(--oc-space-medium);
// z-index: 3;
// }
// @media only screen and (max-width: 960px) {
// #web-nav-sidebar {
// height: 100%;
// left: 0;
// position: fixed;
// top: 0;
// width: 100%;
// z-index: 3;
// }
// }
</style>
32 changes: 11 additions & 21 deletions packages/web-app-markdown-editor/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// --- Components --------------------------------------------------------------

import App from './App.vue'
import t from '../l10n/translations'

// --- Routing -----------------------------------------------------------------

import translations from '../l10n/translations'
import store from './store.js'

const routes = [
Expand All @@ -17,6 +12,14 @@ const routes = [
}
]

const routesForFileExtensions = [
'files-personal',
'files-favorites',
'files-shared-with-others',
'files-shared-with-me',
'files-public-list'
]

const appInfo = {
name: 'MarkdownEditor',
id: 'markdown-editor',
Expand All @@ -30,13 +33,7 @@ const appInfo = {
return $gettext('New plain text file…')
}
},
routes: [
'files-personal',
'files-favorites',
'files-shared-with-others',
'files-shared-with-me',
'files-public-list'
]
routes: routesForFileExtensions
},
{
extension: 'md',
Expand All @@ -45,18 +42,11 @@ const appInfo = {
return $gettext('New mark-down file…')
}
},
routes: [
'files-personal',
'files-favorites',
'files-shared-with-others',
'files-shared-with-me',
'files-public-list'
]
routes: routesForFileExtensions
}
]
}

const translations = t
export default {
appInfo,
routes,
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-media-viewer/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,12 @@ export default {

<style lang="scss" scoped>
#mediaviewer {
min-height: 100vh;
min-height: 93vh;
}
.media-viewer-player {
max-width: 90vw;
height: 70vh;
margin: 10px auto;
margin: 0 auto;
object-fit: contain;
img,
video {
Expand Down
Loading