Skip to content

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

11.0 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">
  @if (canCreateSpace) {
    <button (click)="openSpaceDialog(true)"
            [attr.aria-label]="'New space' | 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 space</span>
    </button>
  }
  @if (canManageSpaces) {
    <button (click)="openSpaceDialog()"
            [attr.aria-label]="'Edit space' | translate:locale.language"
            [disabled]="!canEditSpace"
            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 space</span>
    </button>
    <button (click)="openChildShareDialog()"
            [attr.aria-label]="'Edit children shares' | translate:locale.language"
            [disabled]="!canEditSpace || !selected?.counts.shares"
            class="btn btn-default"
            [tooltip]="'Edit children shares' | translate:locale.language"
            type="button">
      <svg [lucideIcon]="icons.SHARES"></svg>
    </button>
  }
  @if (canUsePersonalSpace) {
    <button (click)="openSpaceRootsDialog()"
            [attr.aria-label]="'Manage my anchored files' | translate:locale.language"
            [disabled]="!canManageRoots"
            class="btn btn-default"
            [tooltip]="'Manage my anchored files' | translate:locale.language"
            type="button">
      <svg [lucideIcon]="icons.LucideAnchor"></svg>
    </button>
  }
  <button (click)="loadSpaces()"
          [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-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]="spaces | 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)="browse(s)"
               [class.disabled]="!s.enabled"
               [class.selected]="s.id === selected?.id"
               class="card">
            <div [attr.rowIndex]="$index" class="card-body">
              <span class="circle-primary-icon gallery-icon">
                <svg [lucideIcon]="icons.SPACES"></svg>
              </span>
              <span class="label-top-right">
                @if (s.newly) {
                  <span class="badge bg-purple">{{ s.hTimeAgo }}</span>
                }
              </span>
              @if (s.managers.length) {
                <span class="label-bottom-left">
                  <app-user-avatar-stack
                    [users]="s.managers"
                    [isMember]="true"
                    [height]="galleryMode.dimensions / 3.5"
                    [width]="galleryMode.dimensions / 3.5"
                    [fontSize]="galleryMode.iconSize / 2.5">
                  </app-user-avatar-stack>
                </span>
              }
              <span class="label-bottom-right">
                @if (s.counts?.roots) {
                  <span (click)="openSpaceRootsDialog()" class="badge bg-primary cursor-pointer me-1">
                          <svg [lucideIcon]="icons.LucideAnchor"></svg>
                    {{ s.counts.roots }}
                        </span>
                }
                @if (s.role === SPACE_ROLE.IS_MANAGER && s.counts.shares) {
                  <span (click)="openChildShareDialog(s)" class="badge bg-purple cursor-pointer me-1">
                          <svg [lucideIcon]="icons.SHARES"></svg>
                    {{ s.counts.shares }}
                        </span>
                }
              </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]="spaces | 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)="browse(s)"
              [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">
                        <span class="circle-primary-icon">
                          <svg [lucideIcon]="icons.SPACES"></svg>
                        </span>
                        <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 ('managers') {
                      <app-user-avatar-stack [users]="s.managers" [isMember]="true" [container]="'body'"></app-user-avatar-stack>
                    }
                    @case ('members') {
                      <app-badge-members [members]="s.counts"></app-badge-members>
                    }
                    @case ('info') {
                      @if (s.counts?.roots) {
                        <span (click)="openSpaceRootsDialog()" class="badge bg-primary cursor-pointer me-1">
                          <svg [lucideIcon]="icons.LucideAnchor"></svg>
                          {{ s.counts.roots }}
                        </span>
                      }
                      @if (s.role === SPACE_ROLE.IS_MANAGER && s.counts.shares) {
                        <span (click)="openChildShareDialog(s)" class="badge bg-purple cursor-pointer me-1">
                          <svg [lucideIcon]="icons.SHARES"></svg>
                          {{ s.counts.shares }}
                        </span>
                      }
                    }
                    @case ('permissions') {
                      @if (s.permissions) {
                        <app-badge-permissions [permissions]="s.hPerms" tooltipPlacement="auto"></app-badge-permissions>
                      }
                    }
                    @case ('modified') {
                      <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">{{ spaces.length }} {{ 'spaces' | translate:locale.language }}</span>
</div>
<!--End Foot Content-->
<!--Start Context Menu -->
<context-menu #MainContextMenu>
  @if (canCreateSpace) {
    <ng-template
      (execute)="openSpaceDialog(true)" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.LucidePlus"></svg>New space</span>
    </ng-template>
    <ng-template [divider]="true" contextMenuItem></ng-template>
  }
  <ng-template (execute)="loadSpaces()" contextMenuItem>
    <span l10nTranslate><svg [lucideIcon]="icons.LucideRotateCw"></svg>Refresh</span>
  </ng-template>
</context-menu>
<context-menu #TargetContextMenu>
  @if (canEditSpace) {
    <ng-template (execute)="openSpaceDialog()" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.LucidePencil"></svg>Edit space</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>
    }
  }
  @if (canManageRoots) {
    <ng-template (execute)="openSpaceRootsDialog()" contextMenuItem>
      <span l10nTranslate><svg [lucideIcon]="icons.LucideAnchor"></svg>Manage my anchored files</span>
    </ng-template>
  }
  @if (canEditSpace || canManageRoots) {
    <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-->