Skip to content

Commit d8b05ec

Browse files
committed
refactor(files): re-position "new"-menu and make it primary
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 4ca9fb8 commit d8b05ec

4 files changed

Lines changed: 44 additions & 22 deletions

File tree

apps/files/src/components/BreadCrumbs.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ export default defineComponent({
349349
flex: 1 1 100% !important;
350350
width: 100%;
351351
height: 100%;
352-
margin-block: 0;
353-
margin-inline: 10px;
352+
margin: 0;
354353
min-width: 0;
355354
356355
:deep() {

apps/files/src/views/FilesList.vue

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,33 @@
55
<template>
66
<NcAppContent :page-heading="pageHeading" data-cy-files-content>
77
<div class="files-list__header" :class="{ 'files-list__header--public': isPublic }">
8+
<!-- Uploader -->
9+
<component :is="isNarrow ? 'Teleport' : 'div'" :to="isNarrow ? 'body' : undefined">
10+
<UploadPicker
11+
v-if="canUpload && !isQuotaExceeded && currentFolder"
12+
allow-folders
13+
:no-label="isNarrow"
14+
class="files-list__header-upload-button"
15+
:class="{ 'files-list__header-upload-button--narrow': isNarrow }"
16+
:content="getContent"
17+
:destination="currentFolder"
18+
:forbidden-characters="forbiddenCharacters"
19+
multiple
20+
primary
21+
@failed="onUploadFail"
22+
@uploaded="onUpload" />
23+
</component>
24+
825
<!-- Current folder breadcrumbs -->
9-
<BreadCrumbs :path="directory" @reload="fetchContent">
10-
<template #actions>
11-
<!-- Uploader -->
12-
<UploadPicker
13-
v-if="canUpload && !isQuotaExceeded && currentFolder"
14-
allow-folders
15-
:no-label="isNarrow"
16-
class="files-list__header-upload-button"
17-
:content="getContent"
18-
:destination="currentFolder"
19-
:forbidden-characters="forbiddenCharacters"
20-
multiple
21-
@failed="onUploadFail"
22-
@uploaded="onUpload" />
23-
</template>
24-
</BreadCrumbs>
26+
<BreadCrumbs :path="directory" @reload="fetchContent" />
2527

26-
<!-- Secondary loading indicator -->
27-
<NcLoadingIcon v-if="isRefreshing" class="files-list__refresh-icon" />
28+
<!-- Loading indicator -->
29+
<NcLoadingIcon
30+
v-if="isRefreshing"
31+
class="files-list__refresh-icon"
32+
:name="t('files', 'File list is reloading')" />
2833

34+
<!-- File list actions (global actions like restore all files from trashbin) -->
2935
<NcActions
3036
class="files-list__header-actions"
3137
:inline="1"
@@ -48,8 +54,10 @@
4854
</NcActionButton>
4955
</NcActions>
5056

57+
<!-- Filters thats can be applied to the file list -->
5158
<FileListFilters />
5259

60+
<!-- Grid view toggle -->
5361
<NcButton
5462
v-if="enableGridView"
5563
:aria-label="gridViewButtonLabel"
@@ -165,6 +173,7 @@ import { UploadPicker, UploadStatus } from '@nextcloud/upload'
165173
import { useThrottleFn } from '@vueuse/core'
166174
import { normalize, relative } from 'path'
167175
import { computed, defineComponent } from 'vue'
176+
import Teleport from 'vue2-teleport' // TODO: replace with native Vue Teleport when we switch to Vue 3
168177
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
169178
import NcActions from '@nextcloud/vue/components/NcActions'
170179
import NcAppContent from '@nextcloud/vue/components/NcAppContent'
@@ -213,6 +222,7 @@ export default defineComponent({
213222
NcEmptyContent,
214223
NcIconSvgWrapper,
215224
NcLoadingIcon,
225+
Teleport,
216226
UploadPicker,
217227
ViewGridIcon,
218228
IconAlertCircleOutline,
@@ -776,6 +786,7 @@ export default defineComponent({
776786
.files-list {
777787
&__header {
778788
display: flex;
789+
gap: var(--default-grid-baseline);
779790
align-items: center;
780791
// Do not grow or shrink (vertically)
781792
flex: 0 0;
@@ -797,10 +808,16 @@ export default defineComponent({
797808
798809
&-actions {
799810
min-width: fit-content !important;
800-
margin-inline: calc(var(--default-grid-baseline) * 2);
801811
}
802812
}
803813
814+
&__header-upload-button--narrow {
815+
// this is teleported to body on narrow screens
816+
position: fixed;
817+
inset-block-end: calc(1.5 * var(--default-grid-baseline));
818+
inset-inline-end: calc(1.5 * var(--default-grid-baseline));
819+
}
820+
804821
&__before {
805822
display: flex;
806823
flex-direction: column;

build/frontend-legacy/package-lock.json

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/frontend-legacy/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"vue-localstorage": "^0.6.2",
9898
"vue-material-design-icons": "^5.3.1",
9999
"vue-router": "^3.6.5",
100+
"vue2-teleport": "^1.1.4",
100101
"vuedraggable": "^2.24.3",
101102
"vuex": "^3.6.2",
102103
"vuex-router-sync": "^5.0.0",

0 commit comments

Comments
 (0)