diff --git a/front2/src/components/track/DisplayTrack.tsx b/front2/src/components/track/DisplayTrack.tsx index aab4e62..0f30229 100644 --- a/front2/src/components/track/DisplayTrack.tsx +++ b/front2/src/components/track/DisplayTrack.tsx @@ -2,16 +2,24 @@ import { Suspense } from 'react'; import { Flex, Text } from '@chakra-ui/react'; import { LuMusic2, LuPlay } from 'react-icons/lu'; +import { useNavigate } from 'react-router-dom'; import { Track } from '@/back-api'; import { Covers } from '@/components/Cover'; +import { ContextMenu, MenuElement } from '@/components/contextMenu/ContextMenu'; import { DisplayTrackSkeleton } from '@/components/track/DisplayTrackSkeleton'; import { useActivePlaylistService } from '@/service/ActivePlaylist'; export type DisplayTrackProps = { track: Track; + onClick?: () => void; + contextMenu?: MenuElement[]; }; -export const DisplayTrack = ({ track }: DisplayTrackProps) => { +export const DisplayTrack = ({ + track, + onClick, + contextMenu, +}: DisplayTrackProps) => { const { trackActive } = useActivePlaylistService(); return ( @@ -26,6 +34,7 @@ export const DisplayTrack = ({ track }: DisplayTrackProps) => { ) } + onClick={onClick} /> { height="full" paddingLeft="5px" overflowX="hidden" + onClick={onClick} > { [{track.track}] {track.name} + ); }; diff --git a/front2/src/components/track/DisplayTrackFull.tsx b/front2/src/components/track/DisplayTrackFull.tsx index 2157b18..f5c9a70 100644 --- a/front2/src/components/track/DisplayTrackFull.tsx +++ b/front2/src/components/track/DisplayTrackFull.tsx @@ -13,98 +13,99 @@ import { useSpecificGender } from '@/service/Gender'; export type DisplayTrackProps = { track: Track; + onClick?: () => void; }; -export const DisplayTrackFull = ({ track }: DisplayTrackProps) => { +export const DisplayTrackFull = ({ track, onClick }: DisplayTrackProps) => { const { trackActive } = useActivePlaylistService(); const { dataAlbum } = useSpecificAlbum(track?.albumId); const { dataGender } = useSpecificGender(track?.genderId); const { dataArtists } = useSpecificArtists(track?.artists); return ( - }> - - - ) : ( - - ) - } - /> - + + ) : ( + + ) + } + onClick={onClick} + /> + + + {track.name} {track.track && ` [${track.track}]`} + + {dataAlbum && ( - {track.name} {track.track && ` [${track.track}]`} + Album {dataAlbum.name} - {dataAlbum && ( - - Album {dataAlbum.name} - - )} - {dataArtists && ( - - Artist(s): {dataArtists.map((data) => data.name).join(', ')} - - )} - {dataGender && ( - - Gender: {dataGender.name} - - )} - + )} + {dataArtists && ( + + Artist(s): {dataArtists.map((data) => data.name).join(', ')} + + )} + {dataGender && ( + + Gender: {dataGender.name} + + )} - + ); }; diff --git a/front2/src/scene/album/AlbumDetailPage.tsx b/front2/src/scene/album/AlbumDetailPage.tsx index 429d987..6a3e941 100644 --- a/front2/src/scene/album/AlbumDetailPage.tsx +++ b/front2/src/scene/album/AlbumDetailPage.tsx @@ -97,9 +97,11 @@ export const AlbumDetailPage = () => { boxShadow: 'outline-over', bgColor: mode('#FFFFFFF7', '#000000F7'), }} - onClick={() => onSelectItem(data.id)} > - + onSelectItem(data.id)} + /> ))} diff --git a/front2/src/scene/artist/ArtistAlbumDetailPage.tsx b/front2/src/scene/artist/ArtistAlbumDetailPage.tsx index d007df1..b851206 100644 --- a/front2/src/scene/artist/ArtistAlbumDetailPage.tsx +++ b/front2/src/scene/artist/ArtistAlbumDetailPage.tsx @@ -1,12 +1,13 @@ import { Box, Flex, Text } from '@chakra-ui/react'; import { LuDisc3, LuUser } from 'react-icons/lu'; -import { useParams } from 'react-router-dom'; +import { Route, Routes, useNavigate, useParams } from 'react-router-dom'; import { Covers } from '@/components/Cover'; import { EmptyEnd } from '@/components/EmptyEnd'; import { PageLayout } from '@/components/Layout/PageLayout'; import { PageLayoutInfoCenter } from '@/components/Layout/PageLayoutInfoCenter'; import { TopBar } from '@/components/TopBar/TopBar'; +import { TrackEditPopUp } from '@/components/popup/TrackEditPopUp'; import { DisplayTrack } from '@/components/track/DisplayTrack'; import { useActivePlaylistService } from '@/service/ActivePlaylist'; import { useSpecificAlbum } from '@/service/Album'; @@ -23,8 +24,8 @@ export const ArtistAlbumDetailPage = () => { const { dataArtist } = useSpecificArtist(artistIdInt); const { dataAlbum } = useSpecificAlbum(albumIdInt); const { tracksOnAnAlbum } = useTracksOfAnAlbum(albumIdInt); + const navigate = useNavigate(); const onSelectItem = (trackId: number) => { - //navigate(`/artist/${artistIdInt}/album/${albumId}`); let currentPlay = 0; const listTrackId: number[] = []; if (!tracksOnAnAlbum) { @@ -126,13 +127,29 @@ export const ArtistAlbumDetailPage = () => { boxShadow: 'outline-over', bgColor: mode('#FFFFFFF7', '#000000F7'), }} - onClick={() => onSelectItem(data.id)} > - + onSelectItem(data.id)} + contextMenu={[ + { + name: 'Edit', + onClick: () => { + navigate( + `/artist/${artistIdInt}/album/${albumId}/edit/${data.id}` + ); + }, + }, + { name: 'Add Playlist', onClick: () => {} }, + ]} + /> ))} + + } /> + ); diff --git a/front2/src/scene/artist/ArtistRoutes.tsx b/front2/src/scene/artist/ArtistRoutes.tsx index 6cf0235..08a9585 100644 --- a/front2/src/scene/artist/ArtistRoutes.tsx +++ b/front2/src/scene/artist/ArtistRoutes.tsx @@ -12,7 +12,7 @@ export const ArtistRoutes = () => { } /> } /> } /> } /> diff --git a/front2/src/scene/gender/GenderDetailPage.tsx b/front2/src/scene/gender/GenderDetailPage.tsx index e6f2f5c..6804360 100644 --- a/front2/src/scene/gender/GenderDetailPage.tsx +++ b/front2/src/scene/gender/GenderDetailPage.tsx @@ -95,9 +95,11 @@ export const GenderDetailPage = () => { boxShadow: 'outline-over', bgColor: mode('#FFFFFFF7', '#000000F7'), }} - onClick={() => onSelectItem(data.id)} > - + onSelectItem(data.id)} + /> ))} diff --git a/front2/src/scene/track/TracksStartLetterDetailPage.tsx b/front2/src/scene/track/TracksStartLetterDetailPage.tsx index bbf7aa6..e6c7d70 100644 --- a/front2/src/scene/track/TracksStartLetterDetailPage.tsx +++ b/front2/src/scene/track/TracksStartLetterDetailPage.tsx @@ -90,9 +90,11 @@ export const TracksStartLetterDetailPage = () => { boxShadow: 'outline-over', bgColor: mode('#FFFFFFF7', '#000000F7'), }} - onClick={() => onSelectItem(data.id)} > - + onSelectItem(data.id)} + /> ))}