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

[stable28] fix(breadcrumbs): improved rendering of breadcrumb progress bar #44759

Merged
merged 3 commits into from
Apr 10, 2024
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
47 changes: 26 additions & 21 deletions apps/files/src/components/BreadCrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
-->

<template>
<NcBreadcrumbs
data-cy-files-content-breadcrumbs
:aria-label="t('files', 'Current directory path')">
<NcBreadcrumbs data-cy-files-content-breadcrumbs
:aria-label="t('files', 'Current directory path')"
class="files-list__breadcrumbs"
:class="{ 'files-list__breadcrumbs--with-progress': wrapUploadProgressBar }">
<!-- Current path sections -->
<NcBreadcrumb v-for="(section, index) in sections"
v-show="shouldShowBreadcrumbs"
:key="section.dir"
v-bind="section"
dir="auto"
:to="section.to"
:force-icon-text="true"
:force-icon-text="index === 0 && filesListWidth >= 486"
:title="titleForSection(index, section)"
:aria-description="ariaForSection(section)"
@click.native="onClick(section.to)"
Expand All @@ -51,11 +51,12 @@
</template>

<script lang="ts">
import { Permission, type Node } from '@nextcloud/files'
import type { Node } from '@nextcloud/files'

import { basename } from 'path'
import { defineComponent } from 'vue'
import { translate as t} from '@nextcloud/l10n'
import { Permission } from '@nextcloud/files'
import { translate as t } from '@nextcloud/l10n'
import HomeSvg from '@mdi/svg/svg/home.svg?raw'
import NcBreadcrumb from '@nextcloud/vue/dist/Components/NcBreadcrumb.js'
import NcBreadcrumbs from '@nextcloud/vue/dist/Components/NcBreadcrumbs.js'
Expand Down Expand Up @@ -140,14 +141,10 @@ export default defineComponent({
},

// Hide breadcrumbs if an upload is ongoing
shouldShowBreadcrumbs(): boolean {
// If we're uploading files, only show the breadcrumbs
// if the files list is greater than 768px wide
if (this.isUploadInProgress) {
return this.filesListWidth > 768
}
// If we're not uploading, we have enough space from 400px
return this.filesListWidth > 400
wrapUploadProgressBar(): boolean {
// if an upload is ongoing, and on small screens / mobile, then
// show the progress bar for the upload below breadcrumbs
return this.isUploadInProgress && this.filesListWidth < 512
},

// used to show the views icon for the first breadcrumb
Expand All @@ -169,7 +166,7 @@ export default defineComponent({
return this.filesStore.getNode(id)
},
getFileIdFromPath(path: string): number | undefined {
return this.pathsStore.getPath(this.currentView?.id, path)
return this.pathsStore.getPath(this.currentView!.id, path)
},
getDirDisplayName(path: string): string {
if (path === '/') {
Expand Down Expand Up @@ -280,15 +277,23 @@ export default defineComponent({
</script>

<style lang="scss" scoped>
.breadcrumb {
.files-list__breadcrumbs {
// Take as much space as possible
flex: 1 1 100% !important;
width: 100%;
margin-inline: 0px 10px 0px 10px;
height: 100%;
margin-block: 0;
margin-inline: 10px;

::v-deep a {
cursor: pointer !important;
:deep() {
a {
cursor: pointer !important;
}
}
}

&--with-progress {
flex-direction: column !important;
align-items: flex-start !important;
}
}
</style>
8 changes: 3 additions & 5 deletions apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -631,18 +631,16 @@ export default defineComponent({
position: relative !important;
}

$margin: 4px;
$navigationToggleSize: 50px;

.files-list {
&__header {
display: flex;
align-items: center;
// Do not grow or shrink (vertically)
flex: 0 0;
// Align with the navigation toggle icon
margin: $margin $margin $margin $navigationToggleSize;
max-width: 100%;
// Align with the navigation toggle icon
margin-block: var(--app-navigation-padding, 4px);
margin-inline: calc(var(--default-clickable-area, 44px) + 2 * var(--app-navigation-padding, 4px)) var(--app-navigation-padding, 4px);

>* {
// Do not grow or shrink (horizontally)
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

Loading