From 0b383504aea5133b6081fbf18f4c3ee4fda7d860 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 18 Jul 2025 11:41:19 -0500 Subject: [PATCH] Signed-off-by: Matt Bruce --- src/features/Queue/Queue.tsx | 75 ++++++++++++++++++++---------------- src/index.css | 5 +++ 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/src/features/Queue/Queue.tsx b/src/features/Queue/Queue.tsx index 8127e23..88ba603 100644 --- a/src/features/Queue/Queue.tsx +++ b/src/features/Queue/Queue.tsx @@ -1,10 +1,10 @@ import React from 'react'; -import { IonItem, IonItemSliding, IonItemOptions, IonItemOption, IonIcon, IonLabel, IonChip } from '@ionic/react'; +import { IonItem, IonItemSliding, IonItemOptions, IonItemOption, IonIcon, IonLabel } from '@ionic/react'; import { trash, arrowUp, arrowDown } from 'ionicons/icons'; -import { ActionButton, PlayerControls, InfiniteScrollList, PageHeader } from '../../components/common'; +import { ActionButton, InfiniteScrollList, PageHeader } from '../../components/common'; import { useQueue } from '../../hooks'; import { useAppSelector } from '../../redux'; -import { selectQueue, selectPlayerState } from '../../redux'; +import { selectQueue, selectPlayerState, selectIsAdmin } from '../../redux'; import { PlayerState } from '../../types'; import type { QueueItem } from '../../types'; @@ -20,23 +20,26 @@ const Queue: React.FC = () => { const queue = useAppSelector(selectQueue); const playerState = useAppSelector(selectPlayerState); + const isAdmin = useAppSelector(selectIsAdmin); const queueCount = Object.keys(queue).length; // Debug logging console.log('Queue component - queue count:', queueCount); console.log('Queue component - queue items:', queueItems); console.log('Queue component - player state:', playerState); + console.log('Queue component - isAdmin:', isAdmin); + console.log('Queue component - canReorder:', canReorder); - // Check if first item can be deleted (only when stopped or paused) - const canDeleteFirstItem = playerState?.state === PlayerState.stopped || playerState?.state === PlayerState.paused; + // Check if items can be deleted (admin can delete any item when not playing) + const canDeleteItems = isAdmin && (playerState?.state === PlayerState.stopped || playerState?.state === PlayerState.paused); - console.log('Queue component - canDeleteFirstItem:', canDeleteFirstItem); + console.log('Queue component - canDeleteItems:', canDeleteItems); console.log('Queue component - canReorder:', canReorder); // Render queue item for InfiniteScrollList const renderQueueItem = (queueItem: QueueItem, index: number) => { console.log(`Queue item ${index}: order=${queueItem.order}, key=${queueItem.key}`); - const canDelete = index === 0 ? canDeleteFirstItem : true; + const canDelete = isAdmin; // Allow admin to delete any item return ( @@ -48,7 +51,10 @@ const Queue: React.FC = () => { {/* Song Info */} -

+

+ {queueItem.singer.name} +

+

{queueItem.song.title}

@@ -56,30 +62,36 @@ const Queue: React.FC = () => {

- {/* Singer Pill - Moved to far right */} - - {queueItem.singer.name} - - {/* Admin Controls */} - {canReorder && ( -
- {queueItem.order > 2 && ( + {(canReorder || isAdmin) && ( +
+
+ {queueItem.order > 2 && ( + handleMoveUp(queueItem)} + variant="secondary" + size="sm" + > + + + )} + {queueItem.order > 1 && queueItem.order < queueItems.length && ( + handleMoveDown(queueItem)} + variant="secondary" + size="sm" + > + + + )} +
+ {canDelete && ( handleMoveUp(queueItem)} - variant="secondary" + onClick={() => handleRemoveFromQueue(queueItem)} + variant="danger" size="sm" > - - - )} - {queueItem.order > 1 && queueItem.order < queueItems.length && ( - handleMoveDown(queueItem)} - variant="secondary" - size="sm" - > - + )}
@@ -108,12 +120,7 @@ const Queue: React.FC = () => { subtitle={`${queueStats.totalSongs} song${queueStats.totalSongs !== 1 ? 's' : ''} in queue`} /> - {/* Player Controls - Only visible to admin users */} -
-
- -
-
+
{/* Queue List */} diff --git a/src/index.css b/src/index.css index 7302c87..9197ae7 100644 --- a/src/index.css +++ b/src/index.css @@ -100,6 +100,11 @@ ion-modal ion-button { color: #111827 !important; } +/* Override Ionic label text color for song titles */ +ion-item ion-label .bold-title { + color: #111827 !important; +} + /* Input field styling to match search box */ .visible-input { border: 1px solid #d1d5db !important;