diff --git a/src/app/component/ext/ext-list/ext-list.component.html b/src/app/component/ext/ext-list/ext-list.component.html index 920e650be..d097d12ff 100644 --- a/src/app/component/ext/ext-list/ext-list.component.html +++ b/src/app/component/ext/ext-list/ext-list.component.html @@ -1,13 +1,17 @@
- + @for (ext of page?.content; track ext; let i = $index) {
{{ i + page!.page.number * page!.page.size + 1 }}
-
+ }
- - - -

- No results found -

+@if (page) { + @if (page.content.length) { + + } @else { +

+ No results found +

+ } +} @else { + +} diff --git a/src/app/component/ext/ext.component.html b/src/app/component/ext/ext.component.html index 06a35ae65..3f3d1a642 100644 --- a/src/app/component/ext/ext.component.html +++ b/src/app/component/ext/ext.component.html @@ -5,54 +5,68 @@
- + @if (ext.modified) { modified {{ ext.modified.toRelative() }} - - + } @else { not found - - + } + @for (icon of icons; track icon) { {{ icon.config!.view! }} - - - on {{ ext.origin || 'default' }} - + } + @if (!local) { + on {{ ext.origin || 'default' }} + }
- - parent + @if (!ext.upload) { + @if (parent) { + parent + } tags - copy - edit - - diff - source - + @if (!local) { + copy + } + @if (local && writeAccess) { + @if (useEditPage) { + edit + } @else { + edit + } + } @else if (useEditPage) { + source + } @else { + source + } download - delete - - + @if (store.account.mod || writeAccess) { + delete + } + } + @if (store.account.user && ext.upload) { upload - parent + @if (parent) { + parent + } tags edit download delete - + }
-
+@if (editing) { + - + - @for (e of serverError; track e) { - -
{{ e }}
- } + @for (e of serverError; track e) { + +
{{ e }}
+ } - - + +
@@ -64,14 +78,13 @@ - - -
- -
- - + +} @else if (viewSource) { +
+ +
+} @else { @for (e of serverError; track e) {
{{ e }}
} -
+} diff --git a/src/app/component/ext/ext.component.ts b/src/app/component/ext/ext.component.ts index cba7f45cf..e486676ca 100644 --- a/src/app/component/ext/ext.component.ts +++ b/src/app/component/ext/ext.component.ts @@ -49,6 +49,8 @@ export class ExtComponent implements OnChanges, HasChanges { @Input() ext!: Ext; + @Input() + useEditPage = false; editForm!: UntypedFormGroup; submitted = false; diff --git a/src/app/component/sidebar/sidebar.component.html b/src/app/component/sidebar/sidebar.component.html index 5e54586bb..adefab978 100644 --- a/src/app/component/sidebar/sidebar.component.html +++ b/src/app/component/sidebar/sidebar.component.html @@ -1,29 +1,36 @@
-
-
- -
- - + @if (showToggle) { +
+ } + @if (store.view.type && (!home || store.view.search || store.view.filter.length || query.page?.content?.length)) { +
+ + @if (expanded && (store.view.settings || store.view.tags)) { +
+ + +
+ }
-
+ }
@if (expanded) { @if (store.view.type && (!home || store.view.search || store.view.filter.length || query.page?.content?.length)) { - + @if (store.view.tag) { + + }
} - + @if (store.view.type) { + + } } @if (!user && canAddTag && !plugin?.config?.reply && store.account.user && (store.view.type === 'ref' || store.view.current === 'ref/summary')) { @@ -119,107 +126,134 @@
} - -
- @if (store.view.forYou) { -

For You

-

- Follow other users to see their subscriptions alongside yours here. -

- } @else { -

Home

- } -
-
-

{{ ext?.name || tag }}

-
- @if (inBookmarks) { - - } @else { - - } - @if (user) { - @if (inSubs) { - - } @else { - + @if (home) { +
+ @if (store.view.forYou) { +

For You

+ @if (!store.account.userSubs.length) { +

Follow other users to see their subscriptions alongside yours here.

} } @else { - @if (inSubs) { - - } @else { - - } +

Home

} - @if (inAlarms) { - - } @else { - +
+ } + @if (!home && store.view.tag) { +
+ @if (store.view.current === 'tag') { +

{{ ext?.name || tag }}

+ } + @if (store.account.signedIn && tag && admin.getTemplate('user')) { +
+ @if (inBookmarks) { + + } @else { + + } + @if (user) { + @if (inSubs) { + + } @else { + + } + } @else { + @if (inSubs) { + + } @else { + + } + } + @if (inAlarms) { + + } @else { + + } +
}
-
- + } @if (ui && ext) { } - -
- -
- -
-
- My Bookmarks: -
- - {{ book.name || userConfig!.bookmarks![i] }} -
-
-
-
- Following: -
- - {{ sub.name || (sub.tag + sub.origin) }} -
-
+ @if (root) { +
+ @if (ext?.config?.sidebar) { + + }
-
- Subscribed to: -
- - {{ sub.name || (sub.tag + sub.origin) }} -
-
+ } + @for (res of queryExts$ | async; track res) { +
{{ res.ext.name || res.ext.tag}} Tags:
+ @for (c of res.children; track ext) { + + } + @if (res.more) { + + load more + + } + } + @if (user || home) { +
+ @if (bookmarkExts.length) { +
+ My Bookmarks: +
+ @for (book of bookmarkExts; track book; let i = $index) { + {{ book.name || userConfig!.bookmarks![i] }} +
+ } +
+ } + @if (userSubExts.length) { +
+ Following: +
+ @for (sub of userSubExts; track sub; let i = $index) { + {{ sub.name || (sub.tag + sub.origin) }} +
+ } +
+ } + @if (tagSubExts.length) { +
+ Subscribed to: +
+ @for (sub of tagSubExts; track sub; let i = $index) { + {{ sub.name || (sub.tag + sub.origin) }} +
+ } +
+ }
-
+ } diff --git a/src/app/component/sidebar/sidebar.component.ts b/src/app/component/sidebar/sidebar.component.ts index 968c13910..0ed850e39 100644 --- a/src/app/component/sidebar/sidebar.component.ts +++ b/src/app/component/sidebar/sidebar.component.ts @@ -1,8 +1,8 @@ import { Component, ElementRef, HostBinding, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; import { NavigationEnd, Router } from '@angular/router'; -import { uniq } from 'lodash-es'; +import { flatMap, uniq, uniqBy } from 'lodash-es'; import { autorun, IReactionDisposer, runInAction } from 'mobx'; -import { catchError, filter, of, Subject } from 'rxjs'; +import { catchError, filter, forkJoin, map, mergeAll, mergeMap, Observable, of, Subject } from 'rxjs'; import { v4 as uuid } from 'uuid'; import { Ext } from '../../model/ext'; import { Plugin } from '../../model/plugin'; @@ -22,6 +22,8 @@ import { Store } from '../../store/store'; import { memo, MemoCache } from '../../util/memo'; import { hasPrefix, localTag, tagOrigin, topAnds } from '../../util/tag'; +type Exts = { ext: Ext, children: Ext[], more: boolean }; + @Component({ standalone: false, selector: 'app-sidebar', @@ -246,6 +248,26 @@ export class SidebarComponent implements OnInit, OnChanges, OnDestroy { return this.exts.getCachedExts(this.tagSubs || []).pipe(this.admin.extFallbacks); } + @memo + get queryExts$() { + if (!this.store.view.exts.length) return of([]); + return forkJoin(this.store.view.exts.map(ext => this.exts.page({ + query: ext.tag, + sort: ['origin', 'levels', 'tag', 'modified,DESC'], + size: 5, + }).pipe( + map(page => ({ + ext: ext, + children: uniqBy(page.content, c => c.tag).filter(c => c.tag !== ext.tag), + more: page.page.totalPages > 1, + })), + map(ext => ext.children.length ? ext : null), + catchError(() => of(null)) + ))).pipe( + filter(exts => !!exts), + ) as Observable; + } + @memo get messages() { if (this.home) return false;