All files / app/page/submit/upload upload.component.html

34.85% Statements 61/175
28% Branches 7/25
0% Functions 0/11
48.27% Lines 42/87

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 1331x 1x 1x 1x 1x 1x   3x 3x     1x   1x 1x 1x   1x       3x       1x     3x     1x             1x 1x   1x 1x 1x 1x           3x   1x 1x 1x             1x   3x         3x         1x   1x   1x 1x                       1x   1x 3x       1x                     3x               3x                 1x   3x          
<ng-container *mobxAutorun>
  <div class="padded list-container max-form-width">
    <span><!-- Title --></span>
    <h2 i18n>Upload</h2>
    <span><!-- Description --></span>
    <p i18n>
      Upload Refs, Exts, images, audio, video, spreadsheets, bookmarks (XML or HTML), and PDFs.
      <span>View your <a [routerLink]="['/tag', store.account.tag]" [queryParams]="{ filter: 'query/plugin/file' }">files here</a>.</span>
      @if (store.account.admin) {
        <span>Visit the <a routerLink="/settings/setup">setup</a> settings page to manage mods.</span>
      }
    </p>
 
    <span><!-- Add Tags --></span>
    <div class="padded form-array">
      <input #tagInput
             id="add-tag"
             i18n-placeholder placeholder="Tag All"
             (keydown)="$event.key === 'Enter' && tagAll(tagInput) || true"
             type="text"
             inputmode="email"
             [pattern]="tagRegex"
             autocorrect="off"
             autocapitalize="none"
             appAutofocus>
      <button type="button" (click)="tagAll(tagInput)" i18n>+</button>
    </div>
 
    @if (store.submit.tags.length) {
      <span><!-- Tags --></span>
      <div class="tag-list form-array right">
        <span i18n>Tagging:</span>
        @for (p of store.submit.tags | tagPreview | async; track p.tag) {
          <a class="tag" [routerLink]="['/tag', p.tag]">{{ p.name || '#' + p.tag }}</a>
        }
      </div>
    }
 
    <span><!-- Default upload --></span>
    <div>
      <div class="padded form-array">
        <span i18n>drop files anywhere to </span>
        <button type="button" (click)="upload.click()" i18n-title title="Upload Refs and Exts" i18n>+ add</button>
        <span i18n>Refs and Exts</span>
        <input #upload type="file"
               accept=".json,.zip,.png,.jpg,.jpeg,.gif,.svg,.webp,.3gp,.mpg,.mpeg,.mp4,.m4v,.m4p,.webm,.ogv,.m3u8,.mov,.mp3,.aac,.flac,.m4a,.ogg,.wav,.xls,.xlsx,.csv,.odx,.txt,.pdf"
               (change)="readUploads($any(upload.files))"
               multiple/>
      </div>
 
      @if (fileCache) {
        <div class="padded form-array">
          <span i18n>or </span>
          <button type="button" (click)="fileUpload.click()" i18n-title title="Cache Files" i18n>+ cache</button>
          <span i18n>any kind of file</span>
          <input #fileUpload type="file"
                 accept="*"
                 (change)="readUploads($any(fileUpload.files), true)"
                 multiple/>
        </div>
      }
    </div>
 
    @for (c of store.submit.uploads; track c) {
      <span><!-- Uploading --></span>
      <div>Uploading {{ c.name }} <progress max="100" [value]="c.progress"></progress></div>
    }
 
    @if (!store.submit.empty) {
      <span></span>
      <div>
        <hr>
        <div class="padded form-array">
          <button type="button" (click)="push()" i18n>upload all</button>
          <div><input id="overwrite" type="checkbox" [checked]="store.submit.overwrite" (input)="overwrite = !store.submit.overwrite"></div>
          <label for="overwrite" i18n>Overwrite existing</label>
          <div class="buttons right">
            <button type="button" (click)="download()" i18n>download all</button>
            <button type="button" (click)="clear(upload)" i18n>clear</button>
          </div>
        </div>
      </div>
 
      <span></span>
      <div>
        @if (processing) {
          <app-loading></app-loading>
        }
      </div>
    }
  </div>
 
  <div class="padded list-container">
    @if (store.submit.huge) {
      <span></span>
      <span class="warning">
        * Preview disabled for huge archives
        <button type="button" (click)="store.submit.overrideHuge()" i18n>show anyway</button>
      </span>
      @if (store.submit.exts.length) {
        <span>Exts: </span>
        <span>{{ store.submit.exts.length }}</span>
      }
      @if (store.submit.refs.length) {
        <span>Refs: </span>
        <span>{{ store.submit.refs.length }}</span>
      }
    } @else {
      @if (store.submit.exts.length) {
        <span class="upload-label">Exts: </span>
        <span></span>
        @for (ext of store.submit.exts; track ext; let i = $index) {
          <div class="list-number">{{ i + 1 }}</div>
          <app-ext [ext]="ext"></app-ext>
        }
      }
      @if (store.submit.refs.length) {
        <span class="upload-label">Refs: </span>
        <span></span>
        @for (ref of store.submit.refs; track ref; let i = $index) {
          <div class="list-number">{{ i + 1 }}</div>
          <app-ref [ref]="ref" [showToggle]="true" [scrollToLatest]="true"></app-ref>
        }
      }
    }
  </div>
 
  @for (e of serverErrors; track e) {
    <span><!-- Unexpected Error --></span>
    <div class="error">{{ e }}</div>
  }
</ng-container>