diff --git a/changelog/unreleased/enhancement-redesign-create-upload-buttons b/changelog/unreleased/enhancement-redesign-create-upload-buttons new file mode 100644 index 00000000000..581e50dd641 --- /dev/null +++ b/changelog/unreleased/enhancement-redesign-create-upload-buttons @@ -0,0 +1,7 @@ +Enhancement: Redesign create and upload buttons + +We have separated the "Create new file/folder" and "Upload" actions above the files list into two separate buttons, +also using the new resource type icons for more consistency. + +https://github.com/owncloud/web/issues/6279 +https://github.com/owncloud/web/pull/6358 diff --git a/packages/web-app-draw-io/src/index.js b/packages/web-app-draw-io/src/index.js index 32f90039321..96e059c72db 100644 --- a/packages/web-app-draw-io/src/index.js +++ b/packages/web-app-draw-io/src/index.js @@ -24,7 +24,7 @@ const appInfo = { routeName: 'draw-io', newFileMenu: { menuTitle($gettext) { - return $gettext('New draw.io document…') + return $gettext('Draw.io document') } } }, diff --git a/packages/web-app-files/src/components/AppBar/AppBar.vue b/packages/web-app-files/src/components/AppBar/AppBar.vue index 8ebf1f4c36e..c67b37ee188 100644 --- a/packages/web-app-files/src/components/AppBar/AppBar.vue +++ b/packages/web-app-files/src/components/AppBar/AppBar.vue @@ -30,31 +30,114 @@
@@ -195,12 +230,15 @@ export default { } return mimeTypes.filter((mimetype) => mimetype.allow_creation) || [] }, + createFileActionsAvailable() { + return this.newFileHandlersForRoute.length > 0 || this.mimetypesAllowedForCreation.length > 0 + }, newButtonTooltip() { if (!this.canUpload) { - return this.$gettext('You have no permission to upload!') + return this.$gettext('You have no permission to create new files!') } if (!this.hasFreeSpace) { - return this.$gettext('You have not enough space left to upload!') + return this.$gettext('You have not enough space left to create new files!') } return null }, @@ -209,7 +247,26 @@ export default { if (tooltip) { return tooltip } - return this.$gettext('Add files or folders') + if (!this.createFileActionsAvailable) { + return this.$gettext('Create a new folder') + } + return this.$gettext('Create new files or folders') + }, + uploadButtonTooltip() { + if (!this.canUpload) { + return this.$gettext('You have no permission to upload!') + } + if (!this.hasFreeSpace) { + return this.$gettext('You have not enough space left to upload!') + } + return null + }, + uploadButtonAriaLabel() { + const tooltip = this.uploadButtonTooltip + if (tooltip) { + return tooltip + } + return this.$gettext('Upload files or folders') }, currentPath() { @@ -331,7 +388,7 @@ export default { return this.selectedFiles.length < 1 }, - isNewBtnDisabled() { + uploadOrFileCreationBlocked() { return !this.canUpload || !this.hasFreeSpace }, @@ -372,6 +429,7 @@ export default { showCreateResourceModal( isFolder = true, + // why default to txt file in line below? ext = 'txt', openAction = null, addAppProviderFile = false @@ -402,6 +460,7 @@ export default { ? this.checkNewFolderName(defaultName) : this.checkNewFileName(defaultName), onCancel: this.hideModal, + // what happens below looks wrong, I don't get it onConfirm: isFolder ? this.addNewFolder : addAppProviderFile @@ -562,6 +621,7 @@ export default { async addAppProviderFile(fileName) { // FIXME: this belongs in web-app-external, but the app provider handles file creation differently than other editor extensions. Needs more refactoring. if (fileName === '') { + // shouldn't we show an error here? return } try { @@ -739,6 +799,23 @@ export default { display: flex; gap: var(--oc-space-small); justify-content: flex-end; + + #create-list { + li { + border: 1px solid transparent; + button { + gap: 10px; + justify-content: left; + width: 100%; + } + } + .create-list-folder { + border-bottom: 1px solid var(--oc-color-border); + } + .create-list-file button { + margin: 2px 0; + } + } } } diff --git a/packages/web-app-files/src/components/AppBar/Upload/FileUpload.vue b/packages/web-app-files/src/components/AppBar/Upload/FileUpload.vue index 271a9ad6fae..3303719fdf9 100644 --- a/packages/web-app-files/src/components/AppBar/Upload/FileUpload.vue +++ b/packages/web-app-files/src/components/AppBar/Upload/FileUpload.vue @@ -1,8 +1,8 @@