mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
add play buttons for each list page header
This commit is contained in:
@@ -3,11 +3,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { AlbumListHeaderFilters } from '/@/renderer/features/albums/components/album-list-header-filters';
|
import { AlbumListHeaderFilters } from '/@/renderer/features/albums/components/album-list-header-filters';
|
||||||
|
import { useAlbumListFilters } from '/@/renderer/features/albums/hooks/use-album-list-filters';
|
||||||
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface AlbumListHeaderProps {
|
interface AlbumListHeaderProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -23,7 +25,7 @@ export const AlbumListHeader = ({ title }: AlbumListHeaderProps) => {
|
|||||||
<Stack gap={0}>
|
<Stack gap={0}>
|
||||||
<PageHeader backgroundColor="var(--theme-colors-background)">
|
<PageHeader backgroundColor="var(--theme-colors-background)">
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton />
|
<PlayButton />
|
||||||
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
||||||
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
||||||
{itemCount}
|
{itemCount}
|
||||||
@@ -39,3 +41,9 @@ export const AlbumListHeader = ({ title }: AlbumListHeaderProps) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PlayButton = () => {
|
||||||
|
const { query } = useAlbumListFilters();
|
||||||
|
|
||||||
|
return <LibraryHeaderBar.PlayButton itemType={LibraryItem.ALBUM} query={query} />;
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { AlbumArtistListHeaderFilters } from '/@/renderer/features/artists/components/album-artist-list-header-filters';
|
import { AlbumArtistListHeaderFilters } from '/@/renderer/features/artists/components/album-artist-list-header-filters';
|
||||||
|
import { useAlbumArtistListFilters } from '/@/renderer/features/artists/hooks/use-album-artist-list-filters';
|
||||||
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface AlbumArtistListHeaderProps {
|
interface AlbumArtistListHeaderProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -23,7 +25,7 @@ export const AlbumArtistListHeader = ({ title }: AlbumArtistListHeaderProps) =>
|
|||||||
<Stack gap={0}>
|
<Stack gap={0}>
|
||||||
<PageHeader backgroundColor="var(--theme-colors-background)">
|
<PageHeader backgroundColor="var(--theme-colors-background)">
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton />
|
<PlayButton />
|
||||||
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
||||||
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
||||||
{itemCount}
|
{itemCount}
|
||||||
@@ -39,3 +41,9 @@ export const AlbumArtistListHeader = ({ title }: AlbumArtistListHeaderProps) =>
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PlayButton = () => {
|
||||||
|
const { query } = useAlbumArtistListFilters();
|
||||||
|
|
||||||
|
return <LibraryHeaderBar.PlayButton itemType={LibraryItem.ALBUM_ARTIST} query={query} />;
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { ArtistListHeaderFilters } from '/@/renderer/features/artists/components/artist-list-header-filters';
|
import { ArtistListHeaderFilters } from '/@/renderer/features/artists/components/artist-list-header-filters';
|
||||||
|
import { useArtistListFilters } from '/@/renderer/features/artists/hooks/use-artist-list-filters';
|
||||||
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface ArtistListHeaderProps {
|
interface ArtistListHeaderProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -23,9 +25,11 @@ export const ArtistListHeader = ({ title }: ArtistListHeaderProps) => {
|
|||||||
<Stack gap={0}>
|
<Stack gap={0}>
|
||||||
<PageHeader backgroundColor="var(--theme-colors-background)">
|
<PageHeader backgroundColor="var(--theme-colors-background)">
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton />
|
<PlayButton />
|
||||||
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
||||||
<LibraryHeaderBar.Badge isLoading={!itemCount}>{itemCount}</LibraryHeaderBar.Badge>
|
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
||||||
|
{itemCount}
|
||||||
|
</LibraryHeaderBar.Badge>
|
||||||
</LibraryHeaderBar>
|
</LibraryHeaderBar>
|
||||||
<Group>
|
<Group>
|
||||||
<ListSearchInput />
|
<ListSearchInput />
|
||||||
@@ -37,3 +41,9 @@ export const ArtistListHeader = ({ title }: ArtistListHeaderProps) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PlayButton = () => {
|
||||||
|
const { query } = useArtistListFilters();
|
||||||
|
|
||||||
|
return <LibraryHeaderBar.PlayButton itemType={LibraryItem.ARTIST} query={query} />;
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { GenreListHeaderFilters } from '/@/renderer/features/genres/components/genre-list-header-filters';
|
import { GenreListHeaderFilters } from '/@/renderer/features/genres/components/genre-list-header-filters';
|
||||||
|
import { useGenreListFilters } from '/@/renderer/features/genres/hooks/use-genre-list-filters';
|
||||||
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface GenreListHeaderProps {
|
interface GenreListHeaderProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -23,7 +25,7 @@ export const GenreListHeader = ({ title }: GenreListHeaderProps) => {
|
|||||||
<Stack gap={0}>
|
<Stack gap={0}>
|
||||||
<PageHeader backgroundColor="var(--theme-colors-background)">
|
<PageHeader backgroundColor="var(--theme-colors-background)">
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton />
|
<PlayButton />
|
||||||
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
||||||
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
||||||
{itemCount}
|
{itemCount}
|
||||||
@@ -39,3 +41,9 @@ export const GenreListHeader = ({ title }: GenreListHeaderProps) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PlayButton = () => {
|
||||||
|
const { query } = useGenreListFilters();
|
||||||
|
|
||||||
|
return <LibraryHeaderBar.PlayButton itemType={LibraryItem.GENRE} query={query} />;
|
||||||
|
};
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
import { PageHeader } from '/@/renderer/components/page-header/page-header';
|
||||||
import { useListContext } from '/@/renderer/context/list-context';
|
import { useListContext } from '/@/renderer/context/list-context';
|
||||||
import { PlaylistListHeaderFilters } from '/@/renderer/features/playlists/components/playlist-list-header-filters';
|
import { PlaylistListHeaderFilters } from '/@/renderer/features/playlists/components/playlist-list-header-filters';
|
||||||
|
import { usePlaylistListFilters } from '/@/renderer/features/playlists/hooks/use-playlist-list-filters';
|
||||||
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface PlaylistListHeaderProps {
|
interface PlaylistListHeaderProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -23,7 +25,7 @@ export const PlaylistListHeader = ({ title }: PlaylistListHeaderProps) => {
|
|||||||
<Stack gap={0}>
|
<Stack gap={0}>
|
||||||
<PageHeader backgroundColor="var(--theme-colors-background)">
|
<PageHeader backgroundColor="var(--theme-colors-background)">
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton />
|
<PlayButton />
|
||||||
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
||||||
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
<LibraryHeaderBar.Badge isLoading={!itemCount}>
|
||||||
{itemCount}
|
{itemCount}
|
||||||
@@ -39,3 +41,9 @@ export const PlaylistListHeader = ({ title }: PlaylistListHeaderProps) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PlayButton = () => {
|
||||||
|
const { query } = usePlaylistListFilters();
|
||||||
|
|
||||||
|
return <LibraryHeaderBar.PlayButton itemType={LibraryItem.PLAYLIST} query={query} />;
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import { FilterBar } from '/@/renderer/features/shared/components/filter-bar';
|
|||||||
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library-header-bar';
|
||||||
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
import { ListSearchInput } from '/@/renderer/features/shared/components/list-search-input';
|
||||||
import { SongListHeaderFilters } from '/@/renderer/features/songs/components/song-list-header-filters';
|
import { SongListHeaderFilters } from '/@/renderer/features/songs/components/song-list-header-filters';
|
||||||
|
import { useSongListFilters } from '/@/renderer/features/songs/hooks/use-song-list-filters';
|
||||||
import { Flex } from '/@/shared/components/flex/flex';
|
import { Flex } from '/@/shared/components/flex/flex';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Stack } from '/@/shared/components/stack/stack';
|
import { Stack } from '/@/shared/components/stack/stack';
|
||||||
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
interface SongListHeaderProps {
|
interface SongListHeaderProps {
|
||||||
genreId?: string;
|
genreId?: string;
|
||||||
@@ -26,7 +28,7 @@ export const SongListHeader = ({ title }: SongListHeaderProps) => {
|
|||||||
<PageHeader>
|
<PageHeader>
|
||||||
<Flex justify="space-between" w="100%">
|
<Flex justify="space-between" w="100%">
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton onClick={() => {}} />
|
<PlayButton />
|
||||||
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
<LibraryHeaderBar.Title>{pageTitle}</LibraryHeaderBar.Title>
|
||||||
<LibraryHeaderBar.Badge
|
<LibraryHeaderBar.Badge
|
||||||
isLoading={itemCount === null || itemCount === undefined}
|
isLoading={itemCount === null || itemCount === undefined}
|
||||||
@@ -45,3 +47,9 @@ export const SongListHeader = ({ title }: SongListHeaderProps) => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PlayButton = () => {
|
||||||
|
const { query } = useSongListFilters();
|
||||||
|
|
||||||
|
return <LibraryHeaderBar.PlayButton itemType={LibraryItem.SONG} query={query} />;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user