Skip to content

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

3.3 KB
Raw Blame
@for (r of space.roots; track r.alias) {
  <div class="bg-theme mb-1 px-3 py-2" style="border-radius: 4px">
    <div class="d-flex align-items-center text-truncate no-select" style="max-height: 38px">
      <div class="d-flex align-items-center text-truncate w-100">
        @if (showUsers) {
          <app-user-avatar [user]="r.owner" tooltipPlacement="bottom"></app-user-avatar>
          <div class="vr mx-2"></div>
        }
        <img
          [src]="r.file.mimeUrl"
          [class.cursor-pointer]="!!r.file.path"
          [tooltip]="r.file.path"
          draggable="false"
          height="32"
          width="32"
          alt="">
        <div class="d-flex flex-column text-truncate w-100 ms-2">
          @if (r.isRenamed) {
            <input #InputRename appInputEdit (updateObject)="onRenameRoot($event)" [inputObject]="r" [fullWidth]="true" type="text" required>
          } @else {
            <div class="text-truncate">
              <span>{{ r.name }}</span>
            </div>
            <div class="d-none d-lg-block fs-xs text-truncate text-muted">
              @if (user.isAdmin && r.externalPath) {
                <span>{{ r.externalPath }}</span>
              } @else {
                <span>{{ r.file.path | pathSlice:-2 }}</span>
              }
            </div>
          }
        </div>
      </div>
      @if (showInfo) {
        <div class="d-flex fs-2xs text-muted d-none d-lg-block ms-3">
          <div class="d-flex justify-content-end">{{ r.createdAt | amTimeAgo }}</div>
        </div>
      }
      <div class="d-flex no-select">
        <div class="vr mx-2"></div>
        @for (perm of r.hPerms| keyvalue: originalOrderKeyValue; track perm.key) {
          @if (!r.owner?.id && user.isAdmin || r.owner?.id === user.id) {
            <button btnCheckbox
                    [(ngModel)]="r.hPerms[perm.key]"
                    (ngModelChange)="onPermissionChange(r)"
                    [tooltip]="SPACES_PERMISSIONS_TEXT[perm.key].text | translate:locale.language"
                    class="btn btn-custom {{!r.isDir && (perm.key === 'a' || perm.key === 'd') ? 'disabled' : ''}}"
                    type="button">
              <svg [lucideIcon]="SPACES_PERMISSIONS_TEXT[perm.key].icon"></svg>
            </button>
          } @else {
            <button [tooltip]="SPACES_PERMISSIONS_TEXT[perm.key].text | translate:locale.language"
                    [class.active]="r.hPerms[perm.key]"
                    class="btn btn-custom disabled"
                    type="button">
              <svg [lucideIcon]="SPACES_PERMISSIONS_TEXT[perm.key].icon"></svg>
            </button>
          }
        }
        <div class="vr"  style="margin-left: 0.15rem; margin-right: 0.35rem"></div>
        <button
          (click)="setRenamed(r)"
          [tooltip]="'Rename' | translate:locale.language"
          class="btn {{r.isRenamed ? 'btn-success' : 'btn-secondary'}}"
          [class.me-2]="showRemove"
          type="button">
          <svg [lucideIcon]="icons.LucidePencil"></svg>
        </button>
        @if (showRemove) {
          <button
            (click)="removeRoot(r)"
            [tooltip]="'Remove' | translate:locale.language"
            class="btn btn-danger"
            type="button">
            <svg [lucideIcon]="icons.LucideX"></svg>
          </button>
        }
      </div>
    </div>
  </div>
}