Skip to content

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

9.8 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)="openShareDialog(true)"
          [attr.aria-label]="'New share' | translate:locale.language"
          class="btn btn-default app-top-menu-tool-bar__action--quiet app-top-menu-tool-bar__action--breadcrumb-aligned"
          type="button">
    <svg [lucideIcon]="icons.LucidePlus"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>New share</span>
  </button>
  <button (click)="openShareDialog()"
          [attr.aria-label]="'Edit share' | translate:locale.language"
          [disabled]="!selected"
          class="btn btn-default app-top-menu-tool-bar__action--quiet"
          type="button">
    <svg [lucideIcon]="icons.LucidePencil"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Edit share</span>
  </button>
  <button (click)="openChildShareDialog()"
          [attr.aria-label]="'Edit children shares' | translate:locale.language"
          [disabled]="!selected?.counts.shares"
          class="btn btn-default"
          [tooltip]="'Edit children shares' | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.SHARES"></svg>
  </button>
  <button (click)="goTo()"
          [attr.aria-label]="'Go to' | translate:locale.language"
          [disabled]="!selected"
          class="btn btn-default"
          [tooltip]="'Go to' | translate:locale.language"
          type="button">
    <svg [lucideIcon]="icons.LucideMapPin"></svg>
  </button>
  <button (click)="loadShares()"
          [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">
    <!--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-text-size]="galleryMode.textSize + 'px'"
       class="app-gallery">
    <app-virtual-scroll (contextmenu)="onContextMenu($event)"
                        [childHeight]="galleryMode.dimensions"
                        [childWidth]="galleryMode.dimensions"
                        [items]="shares | searchFilter:navbarSearch.viewFilter()"
                        [galleryMode]="true"
                        [resizeOffset]="115">
      <div class="row g-0" tabindex="-1">
        @for (s of scrollView?.viewPortItems; track s.id) {
          <div (click)="onSelect(s)"
               (contextmenu)="onTargetContextMenu($event, s)"
               (appTap)="openShareDialog()"
               [class.disabled]="!s.enabled"
               [class.selected]="s.id === selected?.id"
               class="card">
            <div [attr.rowIndex]="$index" class="card-body">
              <img [src]="s.mimeUrl"
                   alt=""
                   class="gallery-image"
                   draggable="true"
                   (error)="s.fallBackMimeUrl()">
              <span class="label-top-right">
                @if (s.newly) {
                  <span class="badge bg-purple">{{ s.hTimeAgo }}</span>
                }
              </span>
              <span class="label-bottom-right">
                @if (s.hasComments) {
                  <span (click)="goToComments(s)"
                        class="badge bg-success cursor-pointer">
                    <svg [lucideIcon]="icons.LucideMessageSquareMore"></svg>
                  </span>
                }
                @if (s.counts.shares) {
                  <div (click)="openChildShareDialog(s)"
                       class="badge bg-purple cursor-pointer">
                    <svg [lucideIcon]="icons.SHARES"></svg>
                    {{ s.counts.shares }}
                  </div>
                }
              </span>
              <span class="label-bottom-left">
                <app-share-repository [share]="s" [galleryMode]="galleryMode"></app-share-repository>
              </span>

            </div>
            <div class="card-footer text-center text-truncate p-1">
              <span class="no-pointer-events text-file-name-preserve" draggable="false">{{ s.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]="shares | searchFilter:navbarSearch.viewFilter()">
    <table class="app-table">
      <tbody tabindex="-1">
        @for (s of scrollView?.viewPortItems; track s.id) {
          <tr (click)="onSelect(s)"
              (contextmenu)="onTargetContextMenu($event, s)"
              (appTap)="openShareDialog()"
              [class.disabled]="!s.enabled"
              [class.selected]="s.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">
                        <img [src]="s.mimeUrl" alt="" draggable="false" height="30" width="30" (error)="s.fallBackMimeUrl()">
                        <div class="d-flex flex-column text-truncate">
                          <span class="no-pointer-events text-file-name-preserve" draggable="false">{{ s.name }}</span>
                          <span class="no-pointer-events text-muted fs-xs" draggable="false">{{ s.description }}</span>
                        </div>
                      </div>
                    }
                    @case ('from') {
                      <app-share-repository [share]="s"></app-share-repository>
                    }
                    @case ('members') {
                      <app-badge-members [members]="s.counts"></app-badge-members>
                    }
                    @case ('info') {
                      @if (s.counts.shares) {
                        <span (click)="openChildShareDialog(s)" class="badge bg-purple cursor-pointer me-1">
                          <svg [lucideIcon]="icons.SHARES"></svg>
                          {{ s.counts.shares }}
                        </span>
                      }
                      @if (s.hasComments) {
                        <span (click)="goToComments(s)" class="badge bg-success cursor-pointer">
                          <svg [lucideIcon]="icons.LucideMessageSquareMore"></svg>
                        </span>
                      }
                    }
                    @case ('created') {
                      <span class="{{th.value.newly && s[th.value.newly] ? 'badge prop-newly-' + s[th.value.newly] : ''}}">
                        <span>{{ s.hTimeAgo }}</span>
                      </span>
                    }
                  }
                </td>
              }
            }
          </tr>
        }
      </tbody>
    </table>
  </app-virtual-scroll>
  <!--End Table Files Content-->
}
<!--Start Foot Content-->
<div class="app-foot-menu">
  <span class="mx-auto">{{ shares.length }} {{ 'shares' | translate:locale.language }}</span>
</div>
<!--End Foot Content-->
<!--Start Context Menu -->
<context-menu #MainContextMenu>
  <ng-template (execute)="openShareDialog(true)" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucidePlus"></svg>New share</span>
  </ng-template>
  <ng-template [divider]="true" contextMenuItem></ng-template>
  <ng-template (execute)="loadShares()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideRotateCw"></svg>Refresh</span>
  </ng-template>
</context-menu>
<context-menu #TargetContextMenu>
  <ng-template (execute)="goTo()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideMapPin"></svg>Go to</span>
  </ng-template>
  <ng-template (execute)="openShareDialog()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucidePencil"></svg>Edit</span>
  </ng-template>
  @if (!!selected?.counts.shares) {
    <ng-template (execute)="openChildShareDialog()" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.SHARES"></svg>Edit children shares</span>
    </ng-template>
  }
  <ng-template [divider]="true" contextMenuItem></ng-template>
  <ng-template (execute)="layout.showRSideBarTab(TAB_MENU.SELECTION)" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.SELECTION"></svg>View selection</span>
  </ng-template>
</context-menu>
<!--End Context Menu-->