11import { DragDropModule } from '@angular/cdk/drag-drop' ;
2- import { CommonModule } from '@angular/common' ;
2+ import { CommonModule , SlicePipe } from '@angular/common' ;
33import {
44 Component ,
55 OnChanges ,
@@ -15,6 +15,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
1515import { MatRippleModule } from '@angular/material/core' ;
1616import { MatMenuModule } from '@angular/material/menu' ;
1717import { MatTooltipModule } from '@angular/material/tooltip' ;
18+ import { RouterLink } from '@angular/router' ;
1819import { IconComponent , TranslatePipe } from '@placeos/components' ;
1920import { SignagePlaylist } from '@placeos/ts-client' ;
2021import { SignageStateService } from './signage-state.service' ;
@@ -25,6 +26,7 @@ interface PlaylistCount {
2526}
2627
2728const PLAYLIST_ITEM_COUNTS = signal < Record < string , PlaylistCount > > ( { } ) ;
29+ const PLAYLIST_ITEM_THUMBNAILS = signal < Record < string , string [ ] > > ( { } ) ;
2830
2931@Component ( {
3032 selector : `signage-item-playlists` ,
@@ -85,6 +87,28 @@ const PLAYLIST_ITEM_COUNTS = signal<Record<string, PlaylistCount>>({});
8587 >
8688 <icon>drag_handle</icon>
8789 </button>
90+ <a
91+ preview
92+ matRipple
93+ [routerLink]="['/signage', 'media']"
94+ [queryParams]="{ playlist: item.id }"
95+ class="h-14 w-14 overflow-hidden rounded border border-base-200 bg-base-200"
96+ >
97+ @for (
98+ media of playlist_thumbnails()[item.id] || []
99+ | slice: 0 : 2;
100+ track media;
101+ let i = $index
102+ ) {
103+ <img
104+ auth
105+ [source]="media"
106+ class="absolute h-full w-full rounded object-cover shadow-lg"
107+ [style.top]="0.5 + i * 1 + 'rem'"
108+ [style.left]="0.5 + i * 1 + 'rem'"
109+ />
110+ }
111+ </a>
88112 <div class="w-1/2 flex-1 text-base-content">
89113 <div class="truncate">
90114 {{ item.name }}
@@ -98,12 +122,14 @@ const PLAYLIST_ITEM_COUNTS = signal<Record<string, PlaylistCount>>({});
98122 playlist_count()[item.id]
99123 ?.count || 0,
100124 }
125+ : playlist_count()[item.id]
126+ ?.count || 0
101127 }}
102128 </div>
103129 </div>
104130 @if (isScheduled(item)) {
105131 <div
106- class="rounded border border-info bg-base-100 bg- info-light p-1 text-lg"
132+ class="rounded border border-info bg-info-light p-1 text-lg"
107133 [matTooltip]="'COMMON.SCHEDULED' | translate"
108134 >
109135 <icon>event</icon>
@@ -205,6 +231,8 @@ const PLAYLIST_ITEM_COUNTS = signal<Record<string, PlaylistCount>>({});
205231 MatMenuModule ,
206232 DragDropModule ,
207233 MatTooltipModule ,
234+ RouterLink ,
235+ SlicePipe ,
208236 ] ,
209237} )
210238export class SignageItemPlaylistsComponent implements OnChanges {
@@ -244,6 +272,10 @@ export class SignageItemPlaylistsComponent implements OnChanges {
244272 } ;
245273 return m ;
246274 } ) ;
275+ this . playlist_thumbnails . update ( ( m ) => {
276+ m [ item . id ] = media ;
277+ return m ;
278+ } ) ;
247279 } ) ;
248280 }
249281 } ) ;
@@ -265,6 +297,7 @@ export class SignageItemPlaylistsComponent implements OnChanges {
265297 }
266298
267299 public readonly playlist_count = PLAYLIST_ITEM_COUNTS ;
300+ public readonly playlist_thumbnails = PLAYLIST_ITEM_THUMBNAILS ;
268301
269302 public playlistCount ( id : string ) {
270303 return PLAYLIST_ITEM_COUNTS ( ) [ id ] ?. count || 0 ;
0 commit comments