Skip to content

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

13.3 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)="goTo()"
          [attr.aria-label]="'Go to' | translate:locale.language"
          [disabled]="!selected || selected.isDisabled"
          class="btn btn-default app-top-menu-tool-bar__action--quiet app-top-menu-tool-bar__action--breadcrumb-aligned"
          type="button">
    <svg [lucideIcon]="icons.LucideMapPin"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Go to</span>
  </button>
  <button (click)="removeFavorite()"
          [attr.aria-label]="'Remove from favorites' | translate:locale.language"
          [disabled]="!selected"
          class="btn btn-default app-top-menu-tool-bar__action--quiet"
          type="button">
    <svg [lucideIcon]="icons.REMOVE_FAVORITE"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Unfavorite</span>
  </button>
  <button (click)="loadFavorites()"
          [attr.aria-label]="'Refresh' | translate:locale.language"
          class="d-none d-md-block btn btn-default"
          [tooltip]="'Refresh' | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.LucideRotateCw" [class]="loading ? 'icon-spin' : ''"></svg>
  </button>
  <div class="d-flex align-items-center ms-auto">
    <app-navigation-view (switchView)="galleryMode = $event"></app-navigation-view>
  </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-text-size]="galleryMode.textSize + 'px'"
       class="app-gallery">
    <app-virtual-scroll (contextmenu)="onContextMenu($event)"
                        [childHeight]="galleryMode.dimensions"
                        [childWidth]="galleryMode.dimensions"
                        [items]="favorites | searchFilter:navbarSearch.viewFilter()"
                        [galleryMode]="true"
                        [resizeOffset]="115">
      <div *ngTemplateOutlet="CommonMessages"></div>
      <div class="row g-0" tabindex="-1">
        @for (f of scrollView?.viewPortItems; track f.fileId) {
          <div (click)="onSelect(f)"
               (contextmenu)="onTargetContextMenu($event, f)"
               (appTap)="goTo(f)"
               [class.disabled]="f.isDisabled"
               [class.selected]="f.fileId === selected?.fileId"
               class="card">
            <div [attr.rowIndex]="$index" class="card-body">
              <img [src]="f.mimeUrl"
                   alt=""
                   class="gallery-image"
                   draggable="false"
                   (error)="f.fallBackMimeUrl()">
              @if (f.newly) {
                <span class="label-top-right">
                  <span class="badge bg-purple">{{ f.hTimeAgo }}</span>
                </span>
              }
              <span class="label-bottom-right">
                @let maxBadges = galleryMode.maxBadges || 0;
                @let hiddenBadges = f.nbBadges - maxBadges;
                @for (badge of f.galleryBadges; track badge; let i = $index) {
                  @if (i < maxBadges) {
                    @switch (badge) {
                      @case ('comments') {
                        <span (click)="goToDetails($event, f, TAB_MENU.COMMENTS)"
                              class="badge bg-success cursor-pointer">
                          <svg [lucideIcon]="icons.LucideMessageSquareMore"></svg>
                        </span>
                      }
                      @case ('shares') {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer">
                          <svg [lucideIcon]="icons.SHARED"></svg>
                          @if (f.shares.length > 1) {
                            {{ f.shares.length }}
                          }
                        </span>
                      }
                      @case ('spaces') {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer">
                          <svg [lucideIcon]="icons.SPACES"></svg>
                          @if (f.spaces.length > 1) {
                            {{ f.spaces.length }}
                          }
                        </span>
                      }
                      @case ('links') {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer">
                          <svg [lucideIcon]="icons.LINKS"></svg>
                          @if (f.links.length > 1) {
                            {{ f.links.length }}
                          }
                        </span>
                      }
                      @case ('syncs') {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer">
                          <svg [lucideIcon]="icons.SYNC"></svg>
                          @if (f.syncs.length > 1) {
                            {{ f.syncs.length }}
                          }
                        </span>
                      }
                    }
                  }
                }
                @if (hiddenBadges > 0) {
                  <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                        class="badge bg-primary cursor-pointer">
                    <svg [lucideIcon]="icons.LucideCirclePlus"></svg>
                    {{ hiddenBadges }}
                  </span>
                }
              </span>
              @if (f.isDisabled) {
                <span class="label-bottom-left">
                  <span class="badge bg-warning text-dark" l10nTranslate>
                    <svg [lucideIcon]="icons.LucideTriangleAlert"></svg>
                    No longer accessible
                  </span>
                </span>
              }
            </div>
            <div class="card-footer text-center text-truncate p-1">
              <span class="no-pointer-events text-file-name-preserve" draggable="false">{{ f.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]="favorites | searchFilter:navbarSearch.viewFilter()">
    <div *ngTemplateOutlet="CommonMessages"></div>
    <table class="app-table">
      <tbody tabindex="-1">
        @for (f of scrollView?.viewPortItems; track f.fileId) {
          <tr (click)="onSelect(f)"
              (contextmenu)="onTargetContextMenu($event, f)"
              (appTap)="goTo(f)"
              [class.disabled]="f.isDisabled"
              [class.selected]="f.fileId === selected?.fileId">
            @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">
                        <img [src]="f.mimeUrl" alt="" draggable="false" height="30" width="30" (error)="f.fallBackMimeUrl()">
                        <div class="d-flex flex-column text-truncate">
                          <span class="no-pointer-events text-file-name-preserve" draggable="false">{{ f.name }}</span>
                          @if (f.isDisabled) {
                            <span class="text-warning fs-xs" l10nTranslate>No longer accessible</span>
                          }
                        </div>
                      </div>
                    }
                    @case ('location') {
                      @if (f.isDisabled) {
                        <span class="text-warning" l10nTranslate>
                          <svg [lucideIcon]="icons.LucideTriangleAlert"></svg>
                          No longer accessible
                        </span>
                      } @else {
                        <app-file-location [location]="f" [displayAsRepository]="true"></app-file-location>
                      }
                    }
                    @case ('info') {
                      @if (f.hasComments) {
                        <span (click)="goToDetails($event, f, TAB_MENU.COMMENTS)"
                              class="badge bg-success cursor-pointer me-1">
                          <svg [lucideIcon]="icons.LucideMessageSquareMore"></svg>
                        </span>
                      }
                      @if (f.shares.length) {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer me-1">
                          <svg [lucideIcon]="icons.SHARED"></svg>
                          @if (f.shares.length > 1) {
                            {{ f.shares.length }}
                          }
                        </span>
                      }
                      @if (f.links.length) {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer me-1">
                          <svg [lucideIcon]="icons.LINKS"></svg>
                          @if (f.links.length > 1) {
                            {{ f.links.length }}
                          }
                        </span>
                      }
                      @if (f.spaces.length) {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer me-1">
                          <svg [lucideIcon]="icons.SPACES"></svg>
                          @if (f.spaces.length > 1) {
                            {{ f.spaces.length }}
                          }
                        </span>
                      }
                      @if (f.syncs.length) {
                        <span (click)="goToDetails($event, f, TAB_MENU.SELECTION)"
                              class="badge bg-primary cursor-pointer">
                          <svg [lucideIcon]="icons.SYNC"></svg>
                          @if (f.syncs.length > 1) {
                            {{ f.syncs.length }}
                          }
                        </span>
                      }
                    }
                    @case ('size') {
                      <span>{{ f.isDir && f.size === 0 ? '●' : (f.size | toBytes:0:true) }}</span>
                    }
                    @case ('modified') {
                      <span class="{{th.value.newly && f[th.value.newly] ? 'badge prop-newly-' + f[th.value.newly] : ''}}">
                        <span>{{ f.hTimeAgo }}</span>
                      </span>
                    }
                    @case ('created') {
                      <span>{{ f.createdAt | amLiveTimeAgo:true }}</span>
                    }
                  }
                </td>
              }
            }
          </tr>
        }
      </tbody>
    </table>
  </app-virtual-scroll>
  <!--End Table Files Content-->
}
<!--Start Foot Content-->
<div class="app-foot-menu">
  <span class="mx-auto">{{ favorites.length }} {{ 'favorites' | translate:locale.language }}</span>
</div>
<!--End Foot Content-->
<!--Start Common Messages-->
<ng-template #CommonMessages>
  @if (!loading && !favorites.length) {
    <div class="fs-base text-center text-gray fw-bold no-select p-4">
      <span l10nTranslate>No favorites</span>
    </div>
  }
</ng-template>
<!--End Common Messages-->
<!--Start Context Menu -->
<context-menu #MainContextMenu>
  <ng-template (execute)="loadFavorites()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideRotateCw"></svg>Refresh</span>
  </ng-template>
</context-menu>
<context-menu #TargetContextMenu>
  @if (!selected?.isDisabled) {
    <ng-template (execute)="goTo()" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.LucideMapPin"></svg>Go to</span>
    </ng-template>
    <ng-template [divider]="true" contextMenuItem></ng-template>
  }
  <ng-template (execute)="removeFavorite()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.REMOVE_FAVORITE"></svg>Remove from favorites</span>
  </ng-template>
</context-menu>
<!--End Context Menu-->