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

[full-ci] Fix right sidebar content on small screens #7508

Merged
merged 6 commits into from
Aug 26, 2022
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Bugfix: Fix right sidebar content on small screens

We've fixed the right sidebar content on small screens because some screen sizes caused the content to flow out of the screen. Things that have been done to achieve this:

* Selection info has been removed.
* Labels of the batch actions will hide on screens <1280px if the sidebar is open.

https://github.com/owncloud/web/issues/7498
https://github.com/owncloud/web/pull/7508
15 changes: 12 additions & 3 deletions packages/web-app-files/src/components/ActionMenuItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<li>
<oc-button
v-oc-tooltip="showTooltip || action.hideLabel ? action.label(filterParams) : ''"
:type="action.componentType"
v-bind="getComponentProps(action, items)"
:class="[action.class, 'action-menu-item']"
Expand Down Expand Up @@ -29,9 +30,12 @@
:fill-type="action.iconFillType || 'line'"
size="medium"
/>
<span class="oc-files-context-action-label" data-testid="action-label">{{
action.label(filterParams)
}}</span>
<span
v-if="!action.hideLabel"
class="oc-files-context-action-label"
data-testid="action-label"
>{{ action.label(filterParams) }}</span
>
<span
v-if="action.shortcut && shortcutHint"
class="oc-files-context-action-shortcut"
Expand Down Expand Up @@ -67,6 +71,11 @@ export default {
type: Boolean,
default: true,
required: false
},
showTooltip: {
type: Boolean,
default: false,
required: false
}
},
computed: {
Expand Down
50 changes: 26 additions & 24 deletions packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="files-app-bar">
<div id="files-app-bar" ref="filesAppBar" :class="{ 'files-app-bar-squashed': !sidebarClosed }">
<oc-hidden-announcer :announcement="selectedResourcesAnnouncement" level="polite" />
<div class="files-topbar oc-py-s">
<h1 class="oc-invisible-sr" v-text="pageTitle" />
Expand Down Expand Up @@ -32,14 +32,13 @@
</div>
</div>
<div class="files-app-bar-actions">
<div class="oc-flex-1 oc-flex oc-flex-start" style="gap: 15px">
<slot v-if="showActionsOnSelection || selectedFiles.length === 0" name="actions" />
<size-info
v-if="showSelectionInfo"
class="oc-visible@l"
:class="{ 'files-app-bar-actions-squashed': !sidebarClosed }"
<div class="oc-flex-1 oc-flex oc-flex-start">
<slot
v-if="showActionsOnSelection || selectedFiles.length === 0"
name="actions"
:limitedScreenSpace="limitedScreenSpace"
/>
<batch-actions v-if="showBatchActions" />
<batch-actions v-if="showBatchActions" :show-tooltips="limitedScreenSpace" />
</div>
</div>
<slot name="content" />
Expand All @@ -56,7 +55,6 @@ import MixinFileActions from '../../mixins/fileActions'
import BatchActions from './SelectedResources/BatchActions.vue'
import ContextActions from '../FilesList/ContextActions.vue'
import SharesNavigation from './SharesNavigation.vue'
import SizeInfo from './SelectedResources/SizeInfo.vue'
import SidebarToggle from './SidebarToggle.vue'
import ViewOptions from './ViewOptions.vue'

Expand All @@ -66,7 +64,6 @@ export default {
ContextActions,
SharesNavigation,
SidebarToggle,
SizeInfo,
ViewOptions
},
mixins: [MixinFileActions],
Expand All @@ -79,6 +76,12 @@ export default {
hasViewOptions: { type: Boolean, default: true },
showActionsOnSelection: { type: Boolean, default: false }
},
data: function () {
return {
resizeObserver: new ResizeObserver(this.onResize),
limitedScreenSpace: false
}
},
computed: {
...mapGetters('Files', ['files', 'selectedFiles']),
...mapState('Files', ['areHiddenFilesShown', 'areFileExtensionsShown']),
Expand All @@ -88,15 +91,9 @@ export default {
const title = this.$route.meta.title
return this.$gettext(title)
},
areDefaultActionsVisible() {
return this.selectedFiles.length < 1
},
showContextActions() {
return last(this.breadcrumbs).allowContextActions
},
showSelectionInfo() {
return this.hasBulkActions && this.selectedFiles.length > 0
},
showBatchActions() {
return this.hasBulkActions
},
Expand All @@ -112,6 +109,12 @@ export default {
return this.$gettextInterpolate(translated, { amount: this.selectedFiles.length })
}
},
mounted() {
this.resizeObserver.observe(this.$refs.filesAppBar)
},
beforeDestroy() {
this.resizeObserver.unobserve(this.$refs.filesAppBar)
},

created() {
// Storage returns a string so we need to convert it into a boolean
Expand All @@ -132,7 +135,13 @@ export default {
},

methods: {
...mapMutations('Files', ['SET_HIDDEN_FILES_VISIBILITY', 'SET_FILE_EXTENSIONS_VISIBILITY'])
...mapMutations('Files', ['SET_HIDDEN_FILES_VISIBILITY', 'SET_FILE_EXTENSIONS_VISIBILITY']),

onResize() {
this.limitedScreenSpace = this.sidebarClosed
? window.innerWidth <= 1000
: window.innerWidth <= 1280
}
}
}
</script>
Expand All @@ -153,13 +162,6 @@ export default {
gap: var(--oc-space-small);
justify-content: flex-end;
min-height: 3rem;

&-squashed {
display: none;
@media only screen and (min-width: 1400px) {
display: inherit;
}
}
}

#files-breadcrumb {
Expand Down
27 changes: 23 additions & 4 deletions packages/web-app-files/src/components/AppBar/CreateAndUpload.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<template>
<div v-if="showActions" class="oc-flex-inline oc-width-1-1" style="gap: 15px">
<div v-if="showActions" class="create-and-upload-actions oc-flex-inline oc-width-1-1">
<template v-if="createFileActionsAvailable">
<span v-oc-tooltip="newButtonTooltip">
<oc-button
id="new-file-menu-btn"
key="new-file-menu-btn-enabled"
v-oc-tooltip="hideButtonLabels ? $gettext('New') : ''"
:aria-label="newButtonAriaLabel"
appearance="filled"
variation="primary"
:disabled="uploadOrFileCreationBlocked"
>
<oc-icon name="add" />
<translate>New</translate>
<span v-if="!hideButtonLabels" v-text="$gettext('New')" />
</oc-button>
</span>
<oc-drop
Expand Down Expand Up @@ -71,26 +72,28 @@
<span v-oc-tooltip="newButtonTooltip">
<oc-button
id="new-folder-btn"
v-oc-tooltip="hideButtonLabels ? $gettext('New Folder') : ''"
appearance="filled"
variation="primary"
:aria-label="newButtonAriaLabel"
:disabled="uploadOrFileCreationBlocked"
@click="showCreateResourceModal"
>
<oc-icon name="resource-type-folder" />
<translate>New folder</translate>
<span v-if="!hideButtonLabels" v-text="$gettext('New Folder')" />
</oc-button>
</span>
</template>
<span v-oc-tooltip="uploadButtonTooltip">
<oc-button
id="upload-menu-btn"
key="upload-menu-btn-enabled"
v-oc-tooltip="hideButtonLabels ? $gettext('Upload') : ''"
:aria-label="uploadButtonAriaLabel"
:disabled="uploadOrFileCreationBlocked"
>
<oc-icon name="upload" fill-type="line" />
<translate>Upload</translate>
<span v-if="!hideButtonLabels" v-text="$gettext('Upload')" />
</oc-button>
</span>
<oc-drop
Expand Down Expand Up @@ -158,6 +161,13 @@ export default defineComponent({
ResourceUpload
},
mixins: [MixinFileActions],
props: {
limitedScreenSpace: {
type: Boolean,
default: false,
required: false
}
},
setup() {
const instance = getCurrentInstance().proxy
const uppyService = instance.$uppyService
Expand Down Expand Up @@ -212,6 +222,9 @@ export default defineComponent({
showPasteHereButton() {
return this.clipboardResources && this.clipboardResources.length !== 0
},
hideButtonLabels() {
return this.limitedScreenSpace && this.showPasteHereButton
},
mimetypesAllowedForCreation() {
// we can't use `mapGetters` here because the External app doesn't exist in all deployments
const mimeTypes = this.$store.getters['External/mimeTypes']
Expand Down Expand Up @@ -876,4 +889,10 @@ export default defineComponent({
border-left: 0px !important;
}
}
.create-and-upload-actions {
gap: var(--oc-space-small);
@media only screen and (min-width: 1000px) {
gap: var(--oc-space-medium);
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
appearance="outline"
class="oc-mr-s"
:shortcut-hint="false"
:show-tooltip="showTooltips"
/>
</oc-list>
</template>
Expand All @@ -24,6 +25,7 @@ import DownloadFile from '../../../mixins/actions/downloadFile'
import EmptyTrashBin from '../../../mixins/actions/emptyTrashBin'
import Move from '../../../mixins/actions/move'
import Restore from '../../../mixins/actions/restore'
import ClearSelection from '../../../mixins/actions/clearSelection'

export default {
name: 'BatchActions',
Expand All @@ -37,8 +39,16 @@ export default {
DownloadFile,
EmptyTrashBin,
Move,
Restore
Restore,
ClearSelection
],
props: {
showTooltips: {
type: Boolean,
default: false,
required: false
}
},
computed: {
...mapGetters('Files', ['selectedFiles']),

Expand All @@ -50,6 +60,7 @@ export default {

menuItemsBatchActions() {
return [
...this.$_clearSelection_items,
...this.$_acceptShare_items,
...this.$_declineShare_items,
...this.$_downloadArchive_items,
Expand All @@ -70,8 +81,6 @@ export default {
display: block;
li {
float: left !important;
margin-top: var(--oc-space-xsmall);
margin-bottom: var(--oc-space-xsmall);
}

@media only screen and (min-width: 1200px) {
Expand All @@ -84,5 +93,20 @@ export default {
display: flex;
gap: var(--oc-space-small);
}

.oc-files-context-action-label {
display: none;
@media only screen and (min-width: 1000px) {
display: inherit;
}
}
}
.files-app-bar-squashed .oc-files-appbar-batch-actions {
.oc-files-context-action-label {
display: none;
@media only screen and (min-width: 1280px) {
display: inherit;
}
}
}
</style>

This file was deleted.

Loading