Skip to content

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

10.7 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)="copyToClipboard()"
          [attr.aria-label]="'Copy link' | translate:locale.language"
          [class.btn-default]="!linkWasCopied"
          [class.btn-primary]="linkWasCopied"
          [disabled]="!selected"
          class="btn btn-default app-top-menu-tool-bar__action--quiet app-top-menu-tool-bar__action--breadcrumb-aligned"
          type="button">
    <svg [lucideIcon]="linkWasCopied? icons.LucideClipboardCheck : icons.LucideClipboard"></svg>
    <span class="app-top-menu-tool-bar__label" l10nTranslate>Copy link</span>
  </button>
  <button (click)="openLinkDialog()"
          [attr.aria-label]="'Edit link' | 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 link</span>
  </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)="loadShareLinks()"
          [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)="openLinkDialog()"
               [class.selected]="s.id === selected?.id"
               [class.disabled]="!s.link.isActive"
               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.hTimeAccessAgo }}
                  </span>
                }
              </span>
              <span class="label-bottom-right">
                @if (s.link.limitAccess) {
                  <span class="badge {{s.link.nbAccess >= s.link.limitAccess ? 'bg-danger': 'bg-success'}}">
                          {{ s.link.nbAccess }}/{{ s.link.limitAccess }}
                        </span>
                } @else {
                  <span class="badge bg-success">{{ s.link.nbAccess }}</span>
                }
                @if (s.link.expiresAt) {
                  <span class="badge bg-{{s.hTimeExpirationAgo >= 1 ? 'warning': 'danger'}} ms-1">
                          <svg [lucideIcon]="icons.LucideClock"></svg>
                    @if (s.hTimeExpirationAgo >= 1) {
                      {{ s.hTimeExpirationAgo }}&nbsp;{{ (s.hTimeExpirationAgo === 1 ? 'day' : 'days') | translate:locale.language }}
                    }
                  </span>
                }
              </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)="openLinkDialog()"
              [class.selected]="s.id === selected?.id"
              [class.disabled]="!s.link.isActive">
            @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 ('link') {
                      <span class="d-flex flex-column">
                        <span>{{ s.link.name }}</span>
                        @if (s.link.email) {
                          <span>{{ s.link.email || '' }}</span>
                        }
                      </span>
                    }
                    @case ('from') {
                      <app-share-repository [share]="s"></app-share-repository>
                    }
                    @case ('info') {
                      @if (s.link.limitAccess) {
                        <span class="badge {{s.link.nbAccess >= s.link.limitAccess ? 'bg-danger': 'bg-success'}}">
                          {{ s.link.nbAccess }}/{{ s.link.limitAccess }}
                        </span>
                      } @else {
                        <span class="badge bg-success">{{ s.link.nbAccess }}</span>
                      }
                      @if (s.link.expiresAt) {
                        <span class="badge bg-{{s.hTimeExpirationAgo >= 1 ? 'warning': 'danger'}} ms-1">
                          <svg [lucideIcon]="icons.LucideClock"></svg>
                          @if (s.hTimeExpirationAgo >= 1) {
                            {{ s.hTimeExpirationAgo }}&nbsp;{{ (s.hTimeExpirationAgo === 1 ? 'day' : 'days') | translate:locale.language }}
                          }
                        </span>
                      }
                      @if (s.link.requireAuth) {
                        <span class="badge bg-gray-dark ms-1">
                          <svg [lucideIcon]="icons.LucideLock"></svg>
                        </span>
                      }
                    }
                    @case ('permissions') {
                      @if (s.link.permissions) {
                        <app-badge-permissions [permissions]="s.hPerms" tooltipPlacement="auto"></app-badge-permissions>
                      }
                    }
                    @case ('accessed') {
                      <span class="{{th.value.newly !== undefined && s[th.value.newly] ? 'badge prop-newly-' + s[th.value.newly] : ''}}">
                        @if (s.link.currentAccess) {
                          <span>{{ s.hTimeAccessAgo }}</span>
                        } @else {
                          <span class="badge sync-newly-0" l10nTranslate>never</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)="loadShareLinks()" 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)="openLinkDialog()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucidePencil"></svg>Edit link</span>
  </ng-template>
  <ng-template (execute)="copyToClipboard()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideClipboard"></svg>Copy link</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-->