Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(frontend:files): redesign copy and move sidebar

johaven294060d7b395
diff --git a/frontend/src/app/applications/comments/models/comment-recent.model.ts b/frontend/src/app/applications/comments/models/comment-recent.model.ts
index 735ec1dc..436399f0 100644
--- a/frontend/src/app/applications/comments/models/comment-recent.model.ts
+++ b/frontend/src/app/applications/comments/models/comment-recent.model.ts
@@ -1,8 +1,7 @@
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import type { CommentRecent } from '@sync-in-server/backend/src/applications/comments/interfaces/comment-recent.interface'
-import { SPACE_ALIAS } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
+import { resolveFileLocation } from '../../files/file-location.utils'
import { getAssetsMimeUrl } from '../../files/files.constants'
-import { SPACES_ICON } from '../../spaces/spaces.constants'
import { OwnerType } from '../../users/interfaces/owner.interface'
import { userAvatarUrl } from '../../users/user.functions'
@@ -26,8 +25,12 @@ export class CommentRecentModel implements CommentRecent {
this.author.avatarUrl = userAvatarUrl(this.author.login)
}
this.mimeUrl = getAssetsMimeUrl(this.file.mime)
- this.icon = this.file.fromShare ? SPACES_ICON.SHARES : this.file.fromSpace ? SPACES_ICON.SPACES : SPACES_ICON.PERSONAL
- this.iconClass = this.file.fromShare ? 'purple' : 'primary'
- this.showedPath = [...this.file.path.split('/').slice(this.file.path.split('/')[1] === SPACE_ALIAS.PERSONAL ? 2 : 1), this.file.name].join('/')
+ const location = resolveFileLocation(this.file.path, {
+ repository: this.file.fromShare ? 'share' : this.file.fromSpace ? 'space' : 'personal',
+ appendName: this.file.name
+ })
+ this.icon = location.icon
+ this.iconClass = location.iconClass
+ this.showedPath = location.relativePath
}
}
diff --git a/frontend/src/app/applications/files/components/sidebar/files-tree.component.html b/frontend/src/app/applications/files/components/sidebar/files-tree.component.html
index 32fbc994..94b6fb99 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-tree.component.html
+++ b/frontend/src/app/applications/files/components/sidebar/files-tree.component.html
@@ -2,7 +2,7 @@
<div class="sidebar-component-title justify-content-between position-relative">
<div class="sidebar-component-title-side"></div>
<div class="sidebar-component-title-label">
- @if (errorMsg) {
+ @if (errorMsg && !srcAllowed) {
<span class="text-danger fs-sm p-1" l10nTranslate>{{ errorMsg }}</span>
} @else {
<span l10nTranslate>Navigation</span>
@@ -16,50 +16,104 @@
</div>
}
@if (copyMoveOn) {
- <div class="bg-white px-2 pt-2 pb-0 fs-sm">
- <div class="text-start text-truncate">
- <span class="fs-sm text-bold me-2" l10nTranslate><span l10nTranslate>Source</span>:</span>
- @switch (store.filesSelection().length) {
- @case (1) {
- <span>
- <span>{{ store.filesSelection()[0].name }}</span>
- </span>
- }
- @case (0) {
- <span>
- <fa-icon [icon]="icons.faQuestion" class="text-bold me-1"></fa-icon>
- </span>
- }
- @default {
- <span>
- <span>{{ store.filesSelection().length }}</span>&nbsp;<span l10nTranslate>items</span>
- </span>
+ @let files = store.filesSelection();
+ @let destination = destinationLocation;
+ <div #copyMovePanel class="bg-white p-2 fs-sm">
+ <div class="d-flex">
+ <div class="d-flex flex-column align-items-center me-2 text-muted">
+ <span class="border rounded-circle d-flex align-items-center justify-content-center p-1 lh-1">
+ <fa-icon
+ [icon]="files.length === 1 ? (files[0].isDir ? icons.faFolder : icons.faFile) : files.length > 1 ? icons.faObjectGroup : icons.faQuestion"
+ [fixedWidth]="true">
+ </fa-icon>
+ </span>
+ <span class="border-start flex-grow-1"></span>
+ </div>
+ <div class="flex-grow-1 overflow-hidden pb-2">
+ <div class="text-muted mb-1">
+ <span l10nTranslate>Source</span>
+ @if (files.length === 1) {
+ <span class="mx-1 lh-1 text-muted">•</span>
+ @if (files[0].isDir) {
+ @let directorySize = getSizeLazy(files[0]) | async;
+ @if (directorySize === null) {
+ <fa-icon [icon]="icons.faSpinner" animation="spin-pulse"></fa-icon>
+ } @else if (directorySize === undefined) {
+ <fa-icon [icon]="icons.faQuestion"></fa-icon>
+ } @else {
+ <span>{{ directorySize | toBytes:0:true }}</span>
+ }
+ } @else {
+ <span>{{ files[0].hSize }}</span>
+ }
+ } @else {
+ <span class="mx-1 lh-1 text-muted">•</span>
+ <span>{{ files.length }}</span>&nbsp;<span l10nTranslate>items</span>
+ }
+ </div>
+ @switch (files.length) {
+ @case (1) {
+ <div class="app-small-card files-summary-card border rounded d-flex align-items-center px-2 py-2">
+ <span class="text-truncate">{{ files[0].name }}</span>
+ </div>
+ }
+ @case (0) {
+ <div class="app-small-card files-summary-card border rounded d-flex justify-content-center align-items-center px-2 py-2">
+ <fa-icon [icon]="icons.faQuestion" class="text-muted"></fa-icon>
+ </div>
+ }
+ @default {
+ <app-files-summary [files]="files"></app-files-summary>
+ }
}
- }
+ </div>
</div>
- <div class="text-start text-truncate mt-1">
- <span class="fs-sm text-bold me-2" l10nTranslate><span l10nTranslate>Destination</span>:</span>
- <span>{{ selection?.data.name || '' }}</span>
+
+ <div class="d-flex">
+ <div class="d-flex flex-column align-items-center me-2 text-muted">
+ <span class="border rounded-circle d-flex align-items-center justify-content-center p-1 lh-1">
+ <fa-icon [icon]="destination?.icon || icons.faQuestion" [fixedWidth]="true"></fa-icon>
+ </span>
+ </div>
+ <div class="flex-grow-1 overflow-hidden">
+ <div class="text-muted mb-1 d-flex align-items-center overflow-hidden">
+ <span class="flex-shrink-0" l10nTranslate>Destination</span>
+ @if (selection && dstAllowed && destination?.relativePath) {
+ <span class="mx-1 lh-1 text-muted">•</span>
+ <span class="text-truncate">{{ destination.relativePath }}</span>
+ }
+ </div>
+ <div class="app-small-card files-summary-card border rounded d-flex align-items-center px-2 py-2">
+ @if (errorMsg && !dstAllowed) {
+ <span class="text-danger text-truncate mx-auto" l10nTranslate>{{ errorMsg }}</span>
+ } @else if (selection && dstAllowed) {
+ <span class="text-bold text-truncate">{{ selection.data.name }}</span>
+ } @else {
+ <fa-icon [icon]="icons.faQuestion" class="text-muted mx-auto"></fa-icon>
+ }
+ </div>
+ </div>
</div>
+
<div class="d-flex gap-2 pt-1 w-100 mt-2">
<button (click)="actionMove()"
- [disabled]="!selection || !store.filesSelection().length || !srcAllowed || !dstAllowed"
- class="btn btn-xs btn-warning flex-fill"
+ [disabled]="!selection || !files.length || !srcAllowed || !dstAllowed"
+ class="btn btn-sm btn-warning flex-fill"
type="button"
l10nTranslate>
<fa-icon [icon]="icons.faArrowsAlt"></fa-icon>
Move
</button>
<button (click)="actionCopy()"
- [disabled]="!selection || !store.filesSelection().length || !dstAllowed"
- class="btn btn-xs btn-primary flex-fill"
+ [disabled]="!selection || !files.length || !dstAllowed"
+ class="btn btn-sm btn-primary flex-fill"
type="button"
l10nTranslate>
<fa-icon [icon]="icons.faClone"></fa-icon>
Copy
</button>
<button (click)="actionCancel()"
- class="btn btn-xs btn-secondary flex-fill"
+ class="btn btn-sm btn-secondary flex-fill"
type="button"
l10nTranslate>
<fa-icon [icon]="icons.faTimes"></fa-icon>
@@ -67,9 +121,9 @@
</button>
</div>
</div>
- <hr class="mx-0 mt-2 mb-0">
+ <hr class="mx-0 my-0">
}
-<div appAutoResize [overFlowX]="'auto'" [resizeOffset]="resizeOffset" [useMaxHeight]="false">
+<div appAutoResize [overFlowX]="'auto'" [resizeOffset]="treeResizeOffset" [useMaxHeight]="false">
<tree-root #tree [nodes]="nodes" [options]="options">
<ng-template #treeNodeWrapperTemplate let-index="index" let-node>
<div (click)="node.mouseAction('click', $event)"
diff --git a/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts b/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
index bb934275..e8077d64 100644
--- a/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
+++ b/frontend/src/app/applications/files/components/sidebar/files-tree.component.ts
@@ -1,10 +1,11 @@
import { IActionMapping, ITreeOptions, TREE_ACTIONS, TreeModel, TreeModule, TreeNode } from '@ali-hm/angular-tree-component'
-import { Component, EventEmitter, inject, Input, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
+import { AsyncPipe } from '@angular/common'
+import { Component, ElementRef, EventEmitter, inject, Input, OnDestroy, OnInit, Output, signal, ViewChild } from '@angular/core'
import { toObservable } from '@angular/core/rxjs-interop'
import { Router } from '@angular/router'
import { FaIconComponent } from '@fortawesome/angular-fontawesome'
import { faFile } from '@fortawesome/free-regular-svg-icons'
-import { faAnglesRight, faArrowRotateRight, faArrowsAlt, faClone, faFolder, faQuestion, faSpinner, faTimes } from '@fortawesome/free-solid-svg-icons'
+import { faArrowRotateRight, faArrowsAlt, faClone, faFolder, faObjectGroup, faQuestion, faSpinner, faTimes } from '@fortawesome/free-solid-svg-icons'
import { FILE_OPERATION } from '@sync-in-server/backend/src/applications/files/constants/operations'
import type { FileTree } from '@sync-in-server/backend/src/applications/files/interfaces/file-tree.interface'
import { SPACE_ALIAS, SPACE_ALL_OPERATIONS, SPACE_OPERATION } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
@@ -13,21 +14,36 @@ import { L10nTranslateDirective } from 'angular-l10n'
import { Subscription } from 'rxjs'
import { AutoResizeDirective } from '../../../../common/directives/auto-resize.directive'
import { TapDirective } from '../../../../common/directives/tap.directive'
+import { ToBytesPipe } from '../../../../common/pipes/to-bytes.pipe'
import { defaultResizeOffset } from '../../../../layout/layout.constants'
import { LayoutService } from '../../../../layout/layout.service'
import { StoreService } from '../../../../store/store.service'
import { SPACES_PATH, SPACES_TITLE } from '../../../spaces/spaces.constants'
import { UserService } from '../../../users/user.service'
+import { resolveFileLocation } from '../../file-location.utils'
import { mimeDirectory } from '../../files.constants'
+import type { FileModel } from '../../models/file.model'
import { FilesService } from '../../services/files.service'
+import { FilesSummaryComponent } from '../utils/files-summary.component'
@Component({
selector: 'app-files-tree',
- imports: [AutoResizeDirective, TreeModule, L10nTranslateDirective, FaIconComponent, TapDirective],
+ imports: [AsyncPipe, AutoResizeDirective, TreeModule, L10nTranslateDirective, FaIconComponent, TapDirective, ToBytesPipe, FilesSummaryComponent],
templateUrl: 'files-tree.component.html'
})
export class FilesTreeComponent implements OnInit, OnDestroy {
@ViewChild('tree', { static: true }) tree: any
+ @ViewChild('copyMovePanel')
+ set copyMovePanel(panel: ElementRef<HTMLElement> | undefined) {
+ this.copyMovePanelResizeObserver?.disconnect()
+ if (!panel) return
+ const element = panel.nativeElement
+ this.copyMovePanelResizeObserver = new ResizeObserver(() => {
+ const separator = element.nextElementSibling as HTMLElement | null
+ this.copyMoveOnHeight.set(element.offsetHeight + (separator?.tagName === 'HR' ? separator.offsetHeight : 0))
+ })
+ this.copyMovePanelResizeObserver.observe(element)
+ }
@Output() selected = new EventEmitter()
@Input() showFiles = false
@Input() allowShares = true
@@ -45,8 +61,8 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
faTimes,
faFolder,
faFile,
+ faObjectGroup,
faQuestion,
- faAnglesRight,
faSpinner
}
protected readonly options: ITreeOptions = {
@@ -67,6 +83,7 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
getChildren: (node: TreeNode) => this.getTreeNode(node)
}
protected nodes: any[]
+ protected copyMoveOn = false
protected srcAllowed = true
protected dstAllowed = true
protected errorMsg = null
@@ -74,7 +91,8 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
private readonly router = inject(Router)
private readonly user = inject(UserService)
private readonly filesService = inject(FilesService)
- private copyMoveOnHeight = 80
+ private readonly copyMoveOnHeight = signal(0)
+ private copyMovePanelResizeObserver: ResizeObserver | null = null
private subscriptions: Subscription[] = []
private preventDblClick = false
private preventTimer: any
@@ -85,23 +103,8 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
}
}
- private _copyMoveOn = false
-
- get copyMoveOn() {
- return this._copyMoveOn
- }
-
- set copyMoveOn(state: boolean) {
- if (this._copyMoveOn !== state) {
- this._copyMoveOn = state
- // adapt the resize offset on tree
- if (state) {
- this.resizeOffset += this.copyMoveOnHeight
- } else {
- this.resizeOffset -= this.copyMoveOnHeight
- }
- setTimeout(() => this.layout.resizeEvent.next(), 0)
- }
+ protected get treeResizeOffset() {
+ return this.resizeOffset + (this.copyMoveOn ? this.copyMoveOnHeight() : 0)
}
get selection() {
@@ -133,6 +136,7 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
+ this.copyMovePanelResizeObserver?.disconnect()
this.subscriptions.forEach((s) => s.unsubscribe())
}
@@ -180,6 +184,20 @@ export class FilesTreeComponent implements OnInit, OnDestroy {
this.copyMoveOn = false
}
+ getSizeLazy(file: FileModel) {
+ return this.filesService.getSizeLazy(file)
+ }
+
+ get destinationLocation() {
+ const selection = this.selection
+ if (!selection) return null
+ return resolveFileLocation(selection.data.path, {
+ repository: selection.data.inShare ? 'share' : undefined,
+ excludeLeaf: true,
+ displayLeafName: selection.parent?.data?.name
+ })
+ }
+
private initRoot() {
this.nodes = []
if (this.user.userHavePermission(USER_PERMISSION.PERSONAL_SPACE)) {
diff --git a/frontend/src/app/applications/files/file-location.utils.ts b/frontend/src/app/applications/files/file-location.utils.ts
new file mode 100644
index 00000000..65f52406
--- /dev/null
+++ b/frontend/src/app/applications/files/file-location.utils.ts
@@ -0,0 +1,51 @@
+import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'
+import { SPACE_ALIAS, SPACE_REPOSITORY } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
+import { SPACES_ICON } from '../spaces/spaces.constants'
+
+type FileLocationRepository = 'personal' | 'space' | 'share'
+
+interface FileLocationPresentation {
+ repository: FileLocationRepository
+ relativePath: string
+ icon: IconDefinition
+ iconClass: 'primary' | 'purple'
+}
+
+interface FileLocationOptions {
+ repository?: FileLocationRepository
+ appendName?: string
+ excludeLeaf?: boolean
+ displayLeafName?: string
+}
+
+const FILE_LOCATION_PRESENTATION: Record<FileLocationRepository, Pick<FileLocationPresentation, 'icon' | 'iconClass'>> = {
+ personal: { icon: SPACES_ICON.PERSONAL, iconClass: 'primary' },
+ space: { icon: SPACES_ICON.SPACES, iconClass: 'primary' },
+ share: { icon: SPACES_ICON.SHARES, iconClass: 'purple' }
+}
+
+export function resolveFileLocation(path: string, options: FileLocationOptions & { repository: FileLocationRepository }): FileLocationPresentation
+export function resolveFileLocation(path: string, options?: FileLocationOptions): FileLocationPresentation | undefined
+export function resolveFileLocation(path: string, options: FileLocationOptions = {}): FileLocationPresentation | undefined {
+ const segments = path?.split('/').filter(Boolean) || []
+ const repository = options.repository || inferRepository(segments)
+ if (!repository) return undefined
+ const relativeSegments = segments.slice(segments[1] === SPACE_ALIAS.PERSONAL ? 2 : segments.length ? 1 : 0)
+ if (options.excludeLeaf) relativeSegments.pop()
+ if (options.displayLeafName && relativeSegments.length) relativeSegments[relativeSegments.length - 1] = options.displayLeafName
+ if (options.appendName) relativeSegments.push(options.appendName)
+ return {
+ repository,
+ relativePath: relativeSegments.join('/'),
+ ...FILE_LOCATION_PRESENTATION[repository]
+ }
+}
+
+function inferRepository(segments: string[]): FileLocationRepository | undefined {
+ if (segments[0] === SPACE_REPOSITORY.SHARES) return 'share'
+ if (segments[0] === SPACE_ALIAS.PERSONAL || segments[1] === SPACE_ALIAS.PERSONAL) return 'personal'
+ if (segments[0] === SPACE_ALIAS.SPACES || segments[0] === SPACE_REPOSITORY.FILES || segments[0] === SPACE_REPOSITORY.TRASH) {
+ return 'space'
+ }
+ return undefined
+}
diff --git a/frontend/src/app/applications/files/models/file-content.model.ts b/frontend/src/app/applications/files/models/file-content.model.ts
index 039c463a..3cf9b27a 100644
--- a/frontend/src/app/applications/files/models/file-content.model.ts
+++ b/frontend/src/app/applications/files/models/file-content.model.ts
@@ -1,7 +1,6 @@
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import type { FileContent } from '@sync-in-server/backend/src/applications/files/schemas/file-content.interface'
-import { SPACE_ALIAS, SPACE_REPOSITORY } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
-import { SPACES_ICON } from '../../spaces/spaces.constants'
+import { resolveFileLocation } from '../file-location.utils'
import { defaultMimeUrl, getAssetsMimeUrl } from '../files.constants'
export class FileContentModel implements FileContent {
@@ -30,13 +29,10 @@ export class FileContentModel implements FileContent {
}
private setProperties() {
- const repository = this.path.split('/')[0]
- const isPersonal = this.path.split('/')[1] === SPACE_ALIAS.PERSONAL
- this.showedPath = this.path
- .split('/')
- .slice(isPersonal ? 2 : 1)
- .join('/')
- this.iconClass = repository === SPACE_REPOSITORY.SHARES ? 'purple' : 'primary'
- this.icon = repository === SPACE_REPOSITORY.SHARES ? SPACES_ICON.SHARES : isPersonal ? SPACES_ICON.PERSONAL : SPACES_ICON.SPACES
+ const location = resolveFileLocation(this.path)
+ if (!location) return
+ this.showedPath = location.relativePath
+ this.iconClass = location.iconClass
+ this.icon = location.icon
}
}
diff --git a/frontend/src/app/applications/files/models/file-recent.model.ts b/frontend/src/app/applications/files/models/file-recent.model.ts
index afacaafb..74e8ccfb 100644
--- a/frontend/src/app/applications/files/models/file-recent.model.ts
+++ b/frontend/src/app/applications/files/models/file-recent.model.ts
@@ -1,7 +1,7 @@
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
import type { FileRecent } from '@sync-in-server/backend/src/applications/files/schemas/file-recent.interface'
-import { SPACE_ALIAS, SPACE_REPOSITORY } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
-import { SPACES_ICON } from '../../spaces/spaces.constants'
+import { SPACE_REPOSITORY } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
+import { resolveFileLocation } from '../file-location.utils'
import { defaultMimeUrl, getAssetsMimeUrl } from '../files.constants'
export class FileRecentModel implements FileRecent {
@@ -24,12 +24,10 @@ export class FileRecentModel implements FileRecent {
constructor(props: Partial<FileRecent>) {
Object.assign(this, props)
this.mimeUrl = getAssetsMimeUrl(this.mime)
- this.iconClass = this.shareId ? 'purple' : 'primary'
- this.icon = this.shareId ? SPACES_ICON.SHARES : this.spaceId ? SPACES_ICON.SPACES : SPACES_ICON.PERSONAL
- this.showedPath = this.path
- .split('/')
- .slice(this.path.split('/')[1] === SPACE_ALIAS.PERSONAL ? 2 : 1)
- .join('/')
+ const location = resolveFileLocation(this.path, { repository: this.shareId ? 'share' : this.spaceId ? 'space' : 'personal' })
+ this.iconClass = location.iconClass
+ this.icon = location.icon
+ this.showedPath = location.relativePath
this.inTrash = this.path.split('/')[0] === SPACE_REPOSITORY.TRASH
}
diff --git a/frontend/src/app/applications/sync/models/sync-path.model.ts b/frontend/src/app/applications/sync/models/sync-path.model.ts
index dfd3320c..2de76919 100644
--- a/frontend/src/app/applications/sync/models/sync-path.model.ts
+++ b/frontend/src/app/applications/sync/models/sync-path.model.ts
@@ -1,5 +1,4 @@
import { IconDefinition } from '@fortawesome/fontawesome-svg-core'
-import { SPACE_REPOSITORY } from '@sync-in-server/backend/src/applications/spaces/constants/spaces'
import { SyncPathFromClient, SyncPathSettings } from '@sync-in-server/backend/src/applications/sync/interfaces/sync-path.interface'
import type { SyncPath } from '@sync-in-server/backend/src/applications/sync/schemas/sync-path.interface'
import { popFromObject } from '@sync-in-server/backend/src/common/shared'
@@ -12,7 +11,7 @@ import {
mimeDirectoryShare,
mimeDirectorySync
} from '../../files/files.constants'
-import { SPACES_ICON, SPACES_PATH } from '../../spaces/spaces.constants'
+import { resolveFileLocation } from '../../files/file-location.utils'
import { hasWritePermission } from '../sync.utils'
export class SyncPathModel implements Partial<SyncPath> {
@@ -89,22 +88,15 @@ export class SyncPathModel implements Partial<SyncPath> {
private setProperties() {
this.isWriteable = hasWritePermission(this.settings?.permissions)
this.newly = getNewly(this.settings.lastSync || 0, true)
- const repository = this.settings.remotePath.split('/')[0]
- this.showedPath = this.settings.remotePath.split('/').slice(1).join('/')
- this.iconClass = repository === SPACE_REPOSITORY.SHARES ? 'purple' : 'primary'
- switch (repository) {
- case SPACES_PATH.PERSONAL:
- this.icon = SPACES_ICON.PERSONAL
- this.mime = mimeDirectory
- break
- case SPACES_PATH.SPACES:
- this.icon = SPACES_ICON.SPACES
- this.mime = mimeDirectory
- break
- case SPACES_PATH.SHARES:
- this.icon = SPACES_ICON.SHARES
- this.mime = mimeDirectoryShare
- break
+ const location = resolveFileLocation(this.settings.remotePath)
+ if (!location) {
+ this.showedPath = this.settings.remotePath.split('/').slice(1).join('/')
+ this.iconClass = 'primary'
+ return
}
+ this.showedPath = location.relativePath
+ this.iconClass = location.iconClass
+ this.icon = location.icon
+ this.mime = location.repository === 'share' ? mimeDirectoryShare : mimeDirectory
}
}
diff --git a/frontend/src/app/common/directives/auto-resize.directive.ts b/frontend/src/app/common/directives/auto-resize.directive.ts
index c1d6e529..8ad937f0 100644
--- a/frontend/src/app/common/directives/auto-resize.directive.ts
+++ b/frontend/src/app/common/directives/auto-resize.directive.ts
@@ -1,10 +1,10 @@
-import { AfterViewInit, Directive, ElementRef, inject, Input, OnDestroy, Renderer2 } from '@angular/core'
+import { AfterViewInit, Directive, ElementRef, inject, Input, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core'
import { skip, Subscription } from 'rxjs'
import { defaultResizeOffset } from '../../layout/layout.constants'
import { LayoutService } from '../../layout/layout.service'
@Directive({ selector: '[appAutoResize]' })
-export class AutoResizeDirective implements AfterViewInit, OnDestroy {
+export class AutoResizeDirective implements AfterViewInit, OnChanges, OnDestroy {
@Input() overFlowX = 'hidden'
@Input() resizeOffset: number = defaultResizeOffset
@Input() useMaxHeight = true
@@ -12,6 +12,7 @@ export class AutoResizeDirective implements AfterViewInit, OnDestroy {
private readonly renderer = inject(Renderer2)
private readonly layout = inject(LayoutService)
private readonly resizeSubscription: Subscription
+ private viewInitialized = false
constructor() {
this.renderer.setStyle(this.elementRef.nativeElement, 'overflow-y', 'auto')
@@ -21,9 +22,14 @@ export class AutoResizeDirective implements AfterViewInit, OnDestroy {
ngAfterViewInit() {
this.renderer.setStyle(this.elementRef.nativeElement, 'overflow-x', this.overFlowX)
+ this.viewInitialized = true
this.onResize()
}
+ ngOnChanges(changes: SimpleChanges) {
+ if (this.viewInitialized && (changes.resizeOffset || changes.useMaxHeight)) this.onResize()
+ }
+
ngOnDestroy() {
this.resizeSubscription.unsubscribe()
}