2022-12-31 18:03:26 -08:00
|
|
|
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
|
|
|
|
|
import { useRef } from 'react';
|
|
|
|
|
import { useParams } from 'react-router';
|
2023-01-02 02:04:23 -08:00
|
|
|
import { PageHeader, ScrollArea } from '/@/renderer/components';
|
|
|
|
|
import { PlaylistDetailContent } from '/@/renderer/features/playlists/components/playlist-detail-content';
|
|
|
|
|
import { PlaylistDetailHeader } from '/@/renderer/features/playlists/components/playlist-detail-header';
|
|
|
|
|
import { usePlaylistDetail } from '/@/renderer/features/playlists/queries/playlist-detail-query';
|
2023-01-01 13:58:05 -08:00
|
|
|
import { AnimatedPage } from '/@/renderer/features/shared';
|
2023-01-02 02:04:23 -08:00
|
|
|
import { useFastAverageColor, useShouldPadTitlebar } from '/@/renderer/hooks';
|
2022-12-31 18:03:26 -08:00
|
|
|
|
|
|
|
|
const PlaylistDetailRoute = () => {
|
2023-01-02 02:04:23 -08:00
|
|
|
const tableRef = useRef<AgGridReactType | null>(null);
|
2022-12-31 18:03:26 -08:00
|
|
|
const { playlistId } = useParams() as { playlistId: string };
|
2023-01-02 02:04:23 -08:00
|
|
|
const padTitlebar = useShouldPadTitlebar();
|
2022-12-31 18:03:26 -08:00
|
|
|
|
2023-01-02 02:04:23 -08:00
|
|
|
const detailQuery = usePlaylistDetail({ id: playlistId });
|
|
|
|
|
const background = useFastAverageColor(detailQuery?.data?.imageUrl, 'dominant');
|
2022-12-31 18:03:26 -08:00
|
|
|
|
2023-01-02 02:04:23 -08:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<PageHeader position="absolute" />
|
|
|
|
|
{background && (
|
|
|
|
|
<AnimatedPage key={`playlist-detail-${playlistId}`}>
|
|
|
|
|
<ScrollArea
|
|
|
|
|
h="100%"
|
|
|
|
|
offsetScrollbars={false}
|
|
|
|
|
styles={{ scrollbar: { marginTop: padTitlebar ? '35px' : 0 } }}
|
|
|
|
|
>
|
|
|
|
|
<PlaylistDetailHeader
|
|
|
|
|
background={background}
|
|
|
|
|
imagePlaceholderUrl={detailQuery?.data?.imageUrl}
|
|
|
|
|
imageUrl={detailQuery?.data?.imageUrl}
|
|
|
|
|
/>
|
|
|
|
|
<PlaylistDetailContent tableRef={tableRef} />
|
|
|
|
|
</ScrollArea>
|
|
|
|
|
</AnimatedPage>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
);
|
2022-12-31 18:03:26 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default PlaylistDetailRoute;
|