Skip to content

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

7.5 KB
Raw Blame
<!--Start Top Menu-->
<div class="app-top-menu app-top-menu-tool-bar"
     [attr.aria-label]="'Actions' | translate:locale.language"
     role="toolbar">
  <button (click)="browse(selected)"
          [attr.aria-label]="'Open' | translate:locale.language"
          [disabled]="!selected?.enabled || loading"
          class="btn btn-default app-top-menu-tool-bar__action--quiet app-top-menu-tool-bar__action--breadcrumb-aligned"
          type="button">
    <svg [lucideIcon]="icons.LucideFolderOpen"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Open</span>
  </button>
  <button (click)="openEmptyTrashDialog(selected)"
          [attr.aria-label]="'Empty' | translate:locale.language"
          [disabled]="!selected?.enabled || !selected?.nb || loading"
          class="btn btn-default app-top-menu-tool-bar__action--quiet"
          type="button">
    <svg [lucideIcon]="icons.TRASH"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Empty</span>
  </button>
  <button (click)="loadTrashBins()"
          [attr.aria-label]="'Refresh' | translate:locale.language"
          [tooltip]="'Refresh' | translate:locale.language"
          class="d-none d-md-block btn btn-default app-top-menu-tool-bar__action--icon app-top-menu-tool-bar__action--quiet"
          type="button">
    <svg [lucideIcon]="icons.LucideRotateCw" [class]="loading ? 'icon-spin' : ''"></svg>
  </button>
  <div class="d-flex align-items-center ms-auto">
    <!--Start View Button-->
    <app-navigation-view (switchView)="galleryMode = $event">
    </app-navigation-view>
    <!--End View Button-->
  </div>
</div>
<!--End Top Menu-->
@if (galleryMode?.enabled) {
  <!--Start Gallery Content-->
  <div [style.--gallery-card-size]="galleryMode.dimensions + 'px'"
       [style.--gallery-badge-size]="galleryMode.badgeSize + 'px'"
       [style.--gallery-image-size]="galleryMode.image + 'px'"
       [style.--gallery-icon-size]="galleryMode.iconSize + 'px'"
       [style.--gallery-text-size]="galleryMode.textSize + 'px'"
       class="app-gallery">
    <app-virtual-scroll (contextmenu)="onContextMenu($event)"
                        [childHeight]="galleryMode.dimensions"
                        [childWidth]="galleryMode.dimensions"
                        [items]="trashBins | searchFilter:navbarSearch.viewFilter()"
                        [galleryMode]="true"
                        [resizeOffset]="115">
      <div class="row g-0" tabindex="-1">
        @for (t of scrollView?.viewPortItems; track t.id) {
          <div (click)="onSelect(t)"
               (contextmenu)="onTargetContextMenu($event, t)"
               (appTap)="browse(t)"
               [class.disabled]="!t.enabled"
               [class.selected]="t.id === selected?.id"
               class="card">
            <div [attr.rowIndex]="$index" class="card-body">
              <span class="circle-primary-icon gallery-icon">
                <svg [lucideIcon]="t.isPersonal ? icons.PERSONAL : icons.SPACES"></svg>
              </span>
              <span class="label-top-right">
                @if (t.newly) {
                  <span class="badge bg-purple">{{ t.hTimeAgo }}</span>
                }
              </span>
              <span class="label-bottom-right">
                <span class="badge bg-danger">{{ t.nb }}</span>
              </span>
            </div>
            <div class="card-footer text-center text-truncate p-1">
              <span
                class="no-pointer-events text-file-name-preserve"
                draggable="false"
                [textContent]="t.isPersonal ? (t.name | translate:locale.language) : t.name">
              </span>
            </div>
          </div>
        }
      </div>
    </app-virtual-scroll>
  </div>
  <!--End Gallery Content-->
} @else {
  <!--Start Table Files Content-->
  <table class="app-table">
    <thead>
    <tr>
      @for (th of tableHeaders | keyvalue: originalOrderKeyValue; track th.key) {
        @if (th.value.show) {
          <th (click)="sortBy(th.key)"
              [style.width.%]="th.value.width"
              [class.text-align-center]="th.value.textCenter"
              [class.cursor-pointer]="th.value.sortable"
              class="{{th.value.class}}"
              l10nTranslate>
            {{ th.value.label }}
            @if (sortTable.sortParam.column === th.key) {
              <svg [lucideIcon]="sortTable.sortParam.asc ? icons.LucideArrowDown : icons.LucideArrowUp"></svg>
            }
          </th>
        }
      }
    </tr>
    </thead>
  </table>
  <app-virtual-scroll (contextmenu)="onContextMenu($event)"
                      [bufferAmount]="5"
                      [items]="trashBins | searchFilter:navbarSearch.viewFilter()">
    <table class="app-table">
      <tbody tabindex="-1">
        @for (t of scrollView?.viewPortItems; track t.id) {
          <tr (click)="onSelect(t)"
              (contextmenu)="onTargetContextMenu($event, t)"
              (appTap)="browse(t)"
              [class.disabled]="!t.enabled"
              [class.selected]="t.id === selected?.id">
            @for (th of tableHeaders | keyvalue: originalOrderKeyValue; track th.key) {
              @if (th.value.show) {
                <td [style.width.%]="th.value.width"
                    [class.text-align-center]="th.value.textCenter"
                    class="{{th.value.class}}">
                  @switch (th.key) {
                    @case ('name') {
                      <div class="d-flex align-items-center">
                        <span class="circle-primary-icon">
                          <svg [lucideIcon]="t.isPersonal ? icons.PERSONAL : icons.SPACES"></svg>
                        </span>
                        <span
                          class="no-pointer-events text-file-name-preserve"
                          draggable="false"
                          [textContent]="t.isPersonal ? (t.name | translate:locale.language) : t.name">
                        </span>
                      </div>
                    }
                    @case ('nb') {
                      <span class="badge bg-danger">{{ t.nb }}</span>
                    }
                    @case ('modified') {
                      <span class="{{th.value.newly && t[th.value.newly] ? 'badge prop-newly-' + t[th.value.newly] : ''}}">
                        <span>{{ t.hTimeAgo }}</span>
                      </span>
                    }
                  }
                </td>
              }
            }
          </tr>
        }
      </tbody>
    </table>
  </app-virtual-scroll>
  <!--End Table Files Content-->
}
<!--Start Context Menu -->
<context-menu #MainContextMenu>
  <ng-template (execute)="loadTrashBins()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideRotateCw"></svg>Refresh</span>
  </ng-template>
</context-menu>
<context-menu #TargetContextMenu>
  @if (selected?.enabled) {
    <ng-template (execute)="browse(selected)" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.LucideFolderOpen"></svg>Open</span>
    </ng-template>
  }
  @if (selected?.enabled && selected?.nb) {
    <ng-template [divider]="true" contextMenuItem></ng-template>
    <ng-template (execute)="openEmptyTrashDialog(selected)" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.TRASH" class="text-danger"></svg>Empty</span>
    </ng-template>
  }
</context-menu>
<!--End Context Menu-->
<!--Start Foot Content-->
<div class="app-foot-menu">
  <span class="mx-auto">{{ trashBins.length }} {{ 'trash bins' | translate:locale.language }}</span>
</div>
<!--End Foot Content-->