From e9a8682b31c90d0c48cdaadf25110c7304b8df8e Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 18 Jul 2025 14:31:51 -0500 Subject: [PATCH] Signed-off-by: Matt Bruce --- src/components/Layout/Layout.tsx | 13 ++++++------ src/features/Artists/Artists.tsx | 6 +----- src/features/Favorites/Favorites.tsx | 7 +------ src/features/History/History.tsx | 7 +------ src/features/NewSongs/NewSongs.tsx | 7 +------ src/features/Queue/Queue.tsx | 31 +++++++++++++--------------- src/features/Search/Search.tsx | 6 +----- src/features/Settings/Settings.tsx | 9 ++++---- src/features/Singers/Singers.tsx | 28 +++++++++++-------------- src/features/SongLists/SongLists.tsx | 7 +------ src/features/TopPlayed/Top100.tsx | 7 +------ src/utils/routeUtils.ts | 18 ++++++++++++++++ 12 files changed, 62 insertions(+), 84 deletions(-) create mode 100644 src/utils/routeUtils.ts diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx index 621a62b..4481723 100644 --- a/src/components/Layout/Layout.tsx +++ b/src/components/Layout/Layout.tsx @@ -1,17 +1,23 @@ import React, { useState, useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; +import { useLocation } from 'react-router-dom'; import { IonApp, IonHeader, IonToolbar, IonTitle, IonContent, IonMenuButton, IonIcon } from '@ionic/react'; import { logOut } from 'ionicons/icons'; import { selectControllerName } from '../../redux/authSlice'; import { logout } from '../../redux/authSlice'; import { ActionButton } from '../common'; import Navigation from '../Navigation/Navigation'; +import { getPageTitle } from '../../utils/routeUtils'; import type { LayoutProps } from '../../types'; const Layout: React.FC = ({ children }) => { const controllerName = useSelector(selectControllerName); const dispatch = useDispatch(); + const location = useLocation(); const [isLargeScreen, setIsLargeScreen] = useState(false); + + // Get the current page title + const currentPageTitle = getPageTitle(location.pathname); // Check screen size for responsive layout useEffect(() => { @@ -51,12 +57,7 @@ const Layout: React.FC = ({ children }) => {
- Sings A Lot - {controllerName && ( - - : {controllerName} - - )} + {currentPageTitle}
diff --git a/src/features/Artists/Artists.tsx b/src/features/Artists/Artists.tsx index de8bf47..5877cc8 100644 --- a/src/features/Artists/Artists.tsx +++ b/src/features/Artists/Artists.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { IonSearchbar, IonList, IonItem, IonLabel, IonModal, IonHeader, IonToolbar, IonTitle, IonButton, IonIcon, IonContent } from '@ionic/react'; import { close, add, heart, heartOutline, list } from 'ionicons/icons'; -import { InfiniteScrollList, PageHeader } from '../../components/common'; +import { InfiniteScrollList } from '../../components/common'; import { useArtists } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectSongs } from '../../redux'; @@ -56,10 +56,6 @@ const Artists: React.FC = () => { return ( <> - -
{/* Search Input */} diff --git a/src/features/Favorites/Favorites.tsx b/src/features/Favorites/Favorites.tsx index 9d9de52..0f0f545 100644 --- a/src/features/Favorites/Favorites.tsx +++ b/src/features/Favorites/Favorites.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { InfiniteScrollList, PageHeader, SongItem } from '../../components/common'; +import { InfiniteScrollList, SongItem } from '../../components/common'; import { useFavorites } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectFavorites } from '../../redux'; @@ -23,11 +23,6 @@ const Favorites: React.FC = () => { return ( <> - - items={favoritesItems} isLoading={favoritesCount === 0} diff --git a/src/features/History/History.tsx b/src/features/History/History.tsx index 9c2971c..4fe0923 100644 --- a/src/features/History/History.tsx +++ b/src/features/History/History.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { IonChip, IonIcon } from '@ionic/react'; import { time } from 'ionicons/icons'; -import { InfiniteScrollList, PageHeader, SongItem } from '../../components/common'; +import { InfiniteScrollList, SongItem } from '../../components/common'; import { useHistory } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectHistory } from '../../redux'; @@ -39,11 +39,6 @@ const History: React.FC = () => { return ( <> - - items={historyItems} isLoading={historyCount === 0} diff --git a/src/features/NewSongs/NewSongs.tsx b/src/features/NewSongs/NewSongs.tsx index a7ece83..56607e4 100644 --- a/src/features/NewSongs/NewSongs.tsx +++ b/src/features/NewSongs/NewSongs.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { InfiniteScrollList, PageHeader, SongItem } from '../../components/common'; +import { InfiniteScrollList, SongItem } from '../../components/common'; import { useNewSongs } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectNewSongs } from '../../redux'; @@ -23,11 +23,6 @@ const NewSongs: React.FC = () => { return ( <> - - items={newSongsItems} isLoading={newSongsCount === 0} diff --git a/src/features/Queue/Queue.tsx b/src/features/Queue/Queue.tsx index 2201f89..94699f6 100644 --- a/src/features/Queue/Queue.tsx +++ b/src/features/Queue/Queue.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import { IonButton, IonIcon, IonReorderGroup, IonReorder, IonItem, IonLabel, IonItemSliding, IonItemOptions, IonItemOption } from '@ionic/react'; import { trash, reorderThreeOutline, reorderTwoOutline, playCircle } from 'ionicons/icons'; -import { PageHeader, ActionButton } from '../../components/common'; +import { ActionButton } from '../../components/common'; import { useQueue } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectQueue, selectPlayerState, selectIsAdmin, selectControllerName } from '../../redux'; @@ -219,22 +219,19 @@ const Queue: React.FC = () => { return ( <> - - - - ) - } - /> +
+ + {isAdmin && ( + + + + )} +
diff --git a/src/features/Search/Search.tsx b/src/features/Search/Search.tsx index 2fd2672..f8b9622 100644 --- a/src/features/Search/Search.tsx +++ b/src/features/Search/Search.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { IonSearchbar } from '@ionic/react'; -import { InfiniteScrollList, PageHeader, SongItem } from '../../components/common'; +import { InfiniteScrollList, SongItem } from '../../components/common'; import { useSearch } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectIsAdmin, selectSongs } from '../../redux'; @@ -39,10 +39,6 @@ const Search: React.FC = () => { return (
- -
{/* Search Input */} { return ( <> - +
+ Configure player behavior +
diff --git a/src/features/Singers/Singers.tsx b/src/features/Singers/Singers.tsx index d155ddc..b0776fb 100644 --- a/src/features/Singers/Singers.tsx +++ b/src/features/Singers/Singers.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { IonItem, IonLabel, IonIcon, IonModal, IonHeader, IonToolbar, IonTitle, IonButton, IonContent, IonInput, IonLabel as IonInputLabel } from '@ionic/react'; import { trash, add, close } from 'ionicons/icons'; -import { InfiniteScrollList, PageHeader, ActionButton } from '../../components/common'; +import { InfiniteScrollList, ActionButton } from '../../components/common'; import { useSingers } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectSingers } from '../../redux'; @@ -70,21 +70,17 @@ const Singers: React.FC = () => { return ( <> - - - - ) - } - /> +
+ {isAdmin && ( + + + + )} +
diff --git a/src/features/SongLists/SongLists.tsx b/src/features/SongLists/SongLists.tsx index 448fb7b..a4d35ee 100644 --- a/src/features/SongLists/SongLists.tsx +++ b/src/features/SongLists/SongLists.tsx @@ -1,7 +1,7 @@ import React, { useState, useMemo, useCallback } from 'react'; import { IonItem, IonLabel, IonModal, IonHeader, IonToolbar, IonTitle, IonButton, IonIcon, IonChip, IonContent, IonList, IonAccordionGroup, IonAccordion } from '@ionic/react'; import { close, list } from 'ionicons/icons'; -import { InfiniteScrollList, PageHeader, SongItem } from '../../components/common'; +import { InfiniteScrollList, SongItem } from '../../components/common'; import { useSongLists } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectSongList } from '../../redux'; @@ -73,11 +73,6 @@ const SongLists: React.FC = () => { return ( <> - -
items={songLists} diff --git a/src/features/TopPlayed/Top100.tsx b/src/features/TopPlayed/Top100.tsx index 07e78db..d1cf3fb 100644 --- a/src/features/TopPlayed/Top100.tsx +++ b/src/features/TopPlayed/Top100.tsx @@ -4,7 +4,7 @@ import { close, list } from 'ionicons/icons'; import { useTopPlayed } from '../../hooks'; import { useAppSelector } from '../../redux'; import { selectTopPlayed, selectSongsArray } from '../../redux'; -import { InfiniteScrollList, PageHeader, SongItem } from '../../components/common'; +import { InfiniteScrollList, SongItem } from '../../components/common'; import { filterSongs } from '../../utils/dataProcessing'; import { useSongOperations } from '../../hooks'; import { useToast } from '../../hooks'; @@ -97,11 +97,6 @@ const Top100: React.FC = () => { return ( <> - - items={displayItems} isLoading={isLoading} diff --git a/src/utils/routeUtils.ts b/src/utils/routeUtils.ts new file mode 100644 index 0000000..3866668 --- /dev/null +++ b/src/utils/routeUtils.ts @@ -0,0 +1,18 @@ +// Route to title mapping for dynamic navigation +export const getPageTitle = (pathname: string): string => { + const routeMap: { [key: string]: string } = { + '/': 'Search Songs', + '/search': 'Search Songs', + '/queue': 'Queue', + '/singers': 'Singers', + '/artists': 'Artists', + '/top-played': 'Top 100 Played', + '/favorites': 'Favorites', + '/history': 'History', + '/new-songs': 'New Songs', + '/song-lists': 'Song Lists', + '/settings': 'Settings' + }; + + return routeMap[pathname] || 'Search Songs'; +}; \ No newline at end of file