diff --git a/libs/portal/shared/ui/src/lib/components/global-favorites-list/global-favorites-list.component.html b/libs/portal/shared/ui/src/lib/components/global-favorites-list/global-favorites-list.component.html
index 17eecd7d8..675ee1fdb 100644
--- a/libs/portal/shared/ui/src/lib/components/global-favorites-list/global-favorites-list.component.html
+++ b/libs/portal/shared/ui/src/lib/components/global-favorites-list/global-favorites-list.component.html
@@ -1,7 +1,7 @@
@if (enrichedChannels().length === 0) {
@@ -32,7 +32,7 @@
@for (ch of enrichedChannels(); track trackByUid($index, ch)) {
(null);
readonly searchTermInput = input('');
readonly draggable = input(true);
+ readonly sortMode = input(
+ DEFAULT_FAVORITES_CHANNEL_SORT_MODE
+ );
readonly channelSelected = output();
readonly channelsReordered = output();
readonly favoriteToggled = output();
+ readonly isCustomSort = computed(() => this.sortMode() === 'custom');
+ readonly canDragDrop = computed(
+ () => this.draggable() && this.isCustomSort() && !this.hasSearchTerm()
+ );
+
readonly hasSearchTerm = computed(
() => this.searchTermInput().trim().length > 0
);
@@ -59,7 +72,12 @@ export class GlobalFavoritesListComponent {
? channels.filter((ch) => ch.name.toLowerCase().includes(term))
: channels;
- return filtered.map((ch) => {
+ const sorted = sortFavoriteChannelItems(filtered, this.sortMode(), {
+ getName: (ch) => ch.name,
+ getAddedAt: (ch) => ch.addedAt,
+ });
+
+ return sorted.map((ch) => {
const epgKey = ch.tvgId?.trim() || ch.name?.trim();
const currentEpgProgram = epgKey
? (epgMap.get(epgKey) ?? null)
@@ -81,7 +99,7 @@ export class GlobalFavoritesListComponent {
}
onDrop(event: CdkDragDrop): void {
- if (this.hasSearchTerm()) {
+ if (!this.canDragDrop()) {
return;
}
diff --git a/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.html b/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.html
index adbd4f578..b87ddad80 100644
--- a/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.html
+++ b/libs/portal/shared/ui/src/lib/components/unified-collection/unified-collection-page.component.html
@@ -58,6 +58,36 @@