All files / app/component/sidebar sidebar.component.html

28.18% Statements 95/337
24.6% Branches 31/126
0% Functions 0/11
36.14% Lines 60/166

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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 2684x 4x 15x 4x   15x             4x               4x 15x                     4x           4x           15x                           4x 15x     15x       4x               4x               4x             15x     4x     15x       4x         4x               4x       15x   4x     15x   4x     15x   4x         4x             4x         4x       4x     4x 15x     4x   4x     4x       15x                   4x   4x       4x   4x             4x   4x       4x   4x           4x   4x       4x   4x             4x   4x       4x   4x           15x           15x             15x                 4x               4x        
<ng-container *mobxAutorun>
  <div class="row">
    @if (showToggle) {
      <div class="toggle" (click)="expanded = !expanded">☰</div>
    }
    @if (store.view.type) {
      <div class="wide">
        @if (expanded && store.view.showRemotesCheckbox) {
          <app-search></app-search>
          @if (admin.getPlugin('+plugin/origin')) {
            <div class="show-remotes">
              <input id="show-remotes" #sr type="checkbox" [checked]="store.view.showRemotes" (input)="showRemotes = sr.checked">
              <label for="show-remotes" i18n>show remotes</label>
            </div>
          }
        } @else {
          <app-search class="centered"></app-search>
        }
      </div>
    }
  </div>
  @if (store.view.type) {
    @if (tag && (store.view.tag || store.view.template)) {
      @if (!user) {
        <app-query [query]="tag" class="breadcrumbs"></app-query>
      } @else {
        <app-nav class="center" [url]="'tag:/' + tag"></app-nav>
        <div class="tag-select row center">
          <div class="submit-button"
               routerLinkActive="toggled"
               [routerLink]="['/tag', inbox]"
               tabindex="0">
            <span i18n-title title="Inbox" i18n>📥️</span> <label i18n>Inbox</label>
          </div>
          <div class="submit-button"
               routerLinkActive="toggled"
               [routerLink]="['/tag', outbox]"
               tabindex="0">
            <span i18n-title title="Outbox" i18n>📤️</span> <label i18n>Outbox</label>
          </div>
        </div>
      }
    }
  }
  @if (expanded) {
    @if (store.view.type) {
      <div class="row mini-col reverse">
        <app-filter [type]="store.view.type!" [activeExts]="activeExts"></app-filter>
        <app-sort [type]="store.view.type!"></app-sort>
      </div>
    }
    <app-debug></app-debug>
    @if (store.view.type) {
      <app-bulk [type]="store.view.type!"
                [viewExt]="ext"
                [activeExts]="activeExts"></app-bulk>
    }
  }
  <span class="button-bar">
    @if (videoChat) {
      <app-chat-video [url]="store.view.ref?.url || 'tag:/chat'"></app-chat-video>
    }
    @if (!dm && !user && canAddTag && !plugin?.config?.reply && store.account.user && (store.view.type === 'ref' || store.view.current === 'ref/summary')) {
      @if (plugin?.config?.submitText || rootConfig?.submitText) {
        <div class="submit-button" routerLink="/submit/text" tabindex="0"
             [queryParams]="{ tag: addTags }">
        <span i18n-title title="Submit" i18n>📝️</span> <label i18n>Submit
        &nbsp;
        &nbsp;
          {{ plugin?.name || '' }}</label>
      </div>
      } @else if (plugin?.config?.submit && plugin?.config?.genId) {
        <div class="submit-button" routerLink="/submit/web" tabindex="0"
             [queryParams]="{ tag: addTags, url: genUrl }">
          <span i18n-title title="Submit" i18n>📝️</span> <label i18n>Submit
          &nbsp;
          &nbsp;
          {{ plugin!.config!.submit }}</label>
        </div>
      } @else {
        <div class="submit-button" routerLink="/submit" tabindex="0"
             [queryParams]="{ tag: addTags }">
          <span i18n-title title="Submit" i18n>📝️</span> <label i18n>Submit
          &nbsp;
          &nbsp;
          {{ plugin?.config?.submit || '' }}</label>
        </div>
      }
    }
    @if (notes && (home || store.account.tag === tag || addTags.includes('notes'))) {
      <div class="submit-button" routerLink="/submit/dm"  tabindex="0"
           [queryParams]="{ to: null }">
        <span i18n-title title="Notes" i18n>✍️</span> <label i18n>Notes</label>
      </div>
    }
    @if (store.account.tag !== tag && messages) {
      @if (dms.length) {
        <div class="submit-button" routerLink="/submit/dm"  tabindex="0"
             [queryParams]="{ to: dms, tag: null }">
          <span i18n-title title="Direct Message" i18n>✉️</span> <label i18n>Message</label>
        </div>
      } @else if (mailPlugin) {
        <div class="submit-button" routerLink="/submit/dm"  tabindex="0"
             [queryParams]="{ to: tag, tag: mailPlugin.tag }">
          <span i18n-title title="Direct Message" i18n>✉️</span> <label i18n>Message
          &nbsp;
          &nbsp;
          {{ mailPlugin.config?.submit || '' }}</label>
        </div>
      } @else if (dm || modmail || user) {
        <div class="submit-button" routerLink="/submit/dm"  tabindex="0"
             [queryParams]="{ to: tag, tag: null }">
          <span i18n-title title="Direct Message" i18n>✉️</span> <label i18n>Message</label>
        </div>
      }
    }
    @if (store.account.mod && store.view.current === 'settings/user') {
      <div class="submit-button" routerLink="/user" tabindex="0">
        <span i18n-title title="Create User" i18n>🧑️</span> <label i18n>Create Permissions</label>
      </div>
    }
    @if (writeAccess && user && store.view.current === 'tag') {
      <div class="submit-button" [routerLink]="['/user', tag]" tabindex="0">
        <span i18n-title title="Edit User" i18n>🧑️</span> <label i18n>Edit Permissions</label>
      </div>
    }
    @if (homeWriteAccess) {
      <div class="submit-button" [routerLink]="['/ext', 'config/home']" tabindex="0">
        <span i18n-title title="Edit Home Page" i18n>🏡️</span> <label i18n>Home Page</label>
      </div>
    } @else if (store.view.type === 'ext') {
      @if (writeAccess) {
        <div class="submit-button" [routerLink]="['/ext', store.view.template]" tabindex="0">
          <span i18n-title title="Extend Tag" i18n>🎨️</span> <label i18n>Extend Tag
          &nbsp;
          &nbsp;
          {{ template?.name || '' }}</label>
        </div>
      } @else if (!store.view.template) {
        <div class="submit-button" [routerLink]="['/ext']" tabindex="0">
          <span i18n-title title="Extend Tag" i18n>🎨️</span> <label i18n>Extend Tag</label>
        </div>
      }
    } @else if (local && writeAccess && store.view.noQuery) {
      <div class="submit-button" [routerLink]="['/ext', tag]" tabindex="0">
        <span i18n-title title="Edit Tag" i18n>🎨️</span> <label i18n>Edit Tag</label>
      </div>
    } @else if (!local && store.account.user && existing && store.view.noQuery) {
      <div class="submit-button" [routerLink]="['/tags', tag]" [queryParams]="{ showRemotes: true }" tabindex="0">
        <span i18n-title title="Edit Tag" i18n>🎨️</span> <label i18n>Copy Tag</label>
      </div>
    }
  </span>
  @if (home) {
    <div class="hide tag-header">
      @if (store.view.forYou) {
        <h3><a [routerLink]="['/home']" [queryParams]="{ forYou: true }" i18n>For You</a></h3>
        @if (!store.account.userSubs.length) {
          <p i18n>Follow other users to see their subscriptions alongside yours here.</p>
        }
      } @else {
        <h3><a [routerLink]="['/home']" i18n>Home</a></h3>
      }
    </div>
  }
  @if (!home && store.view.tag) {
    <div class="hide tag-header">
      @if (store.view.current === 'tag') {
        <h3>{{ ext?.name || tag }}</h3>
      }
      @if (store.account.signedIn && tag && tag !== '@*' && tag != '*' && admin.getTemplate('user')) {
        <div class="row center">
          @if (inBookmarks) {
            <button type="button"
                    class="bookmark"
                    i18n-title title="Remove from top bar"
                    [disabled]="savingBookmark"
                    (click)="removeBookmark()" i18n>&ndash; bookmark</button>
          } @else {
            <button type="button"
                    (click)="addBookmark()"
                    i18n-title title="Add to top bar"
                    [disabled]="savingBookmark"
                    class="bookmark" i18n>+ bookmark</button>
          }
          @if (admin.home) {
            @if (user) {
              @if (inSubs) {
                <button type="button"
                        class="subscribe"
                        i18n-title title="Remove from home screen"
                        [disabled]="savingSub"
                        (click)="unsubscribe()" i18n>&ndash; unfollow</button>
              } @else {
                <button type="button"
                        (click)="subscribe()"
                        i18n-title title="Add to home screen"
                        [disabled]="savingSub"
                        class="subscribe" i18n>+ follow</button>
              }
            } @else {
              @if (inSubs) {
                <button type="button"
                        class="subscribe"
                        i18n-title title="Remove from home screen"
                        [disabled]="savingSub"
                        (click)="unsubscribe()" i18n>&ndash; unsubscribe</button>
              } @else {
                <button type="button"
                        (click)="subscribe()"
                        i18n-title title="Add to home screen"
                        [disabled]="savingSub"
                        class="subscribe" i18n>+ subscribe</button>
              }
            }
          }
          @if (inAlarms) {
            <button type="button"
                    class="alarm"
                    i18n-title title="Remove alarm"
                    [disabled]="savingAlarm"
                    (click)="removeAlarm()" i18n>�</button>
          } @else {
            <button type="button"
                    (click)="addAlarm()"
                    i18n-title title="Add alarm"
                    [disabled]="savingAlarm"
                    class="alarm" i18n>🔔</button>
          }
        </div>
      }
    </div>
  }
  @if (ui && ext) {
    <app-md class="hide ui"
            [disableSanitizer]="true"
            [origin]="ext.origin || ''"
            [text]="uiMarkdown"></app-md>
  }
  @if (root) {
    <div class="hide template-root">
      @if (ext?.config?.sidebar) {
        <app-md [origin]="ext?.origin || ''" [text]="ext!.config!.sidebar"></app-md>
      }
    </div>
  }
  @if (!home && expanded) {
    @for (res of queryExts$ | async; track res.x.tag) {
      <h5>{{ res.x.name || res.x.tag}} Tags:</h5>
      @for (x of res.children; track x.tag + x.origin) {
        <app-ext [ext]="x" [useEditPage]="true"></app-ext>
      }
      @if (res.more) {
        <a [routerLink]="['/tags', res.x.tag]"
           queryParamsHandling="merge"
           class="load-more no-select" i18n>
          load more
        </a>
      }
    }
    @if (chat) {
      <app-chat query="chat" [responseOf]="store.view.ref"></app-chat>
    } @else if (store.view.ref && admin.getPlugin('plugin/chat')) {
      <a class="fake-link load-more" (click)="startChat()" i18n>chat</a>
    }
  }
</ng-container>