mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-09 20:29:36 +02:00
reimplement fullscreen player
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
.queue-container {
|
.queue-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
:global(.ag-header) {
|
:global(.ag-header) {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -46,6 +49,8 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto minmax(0, 1fr);
|
grid-template-rows: auto minmax(0, 1fr);
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import { useLocation } from 'react-router';
|
|||||||
|
|
||||||
import styles from './full-screen-player.module.css';
|
import styles from './full-screen-player.module.css';
|
||||||
|
|
||||||
|
import { SONG_TABLE_COLUMNS } from '/@/renderer/components/item-list/item-table-list/default-columns';
|
||||||
import { FullScreenPlayerImage } from '/@/renderer/features/player/components/full-screen-player-image';
|
import { FullScreenPlayerImage } from '/@/renderer/features/player/components/full-screen-player-image';
|
||||||
import { FullScreenPlayerQueue } from '/@/renderer/features/player/components/full-screen-player-queue';
|
import { FullScreenPlayerQueue } from '/@/renderer/features/player/components/full-screen-player-queue';
|
||||||
|
import { ListConfigMenu } from '/@/renderer/features/shared/components/list-config-menu';
|
||||||
import { useFastAverageColor } from '/@/renderer/hooks';
|
import { useFastAverageColor } from '/@/renderer/hooks';
|
||||||
import {
|
import {
|
||||||
useFullScreenPlayerStore,
|
useFullScreenPlayerStore,
|
||||||
@@ -27,7 +29,7 @@ import { Select } from '/@/shared/components/select/select';
|
|||||||
import { Slider } from '/@/shared/components/slider/slider';
|
import { Slider } from '/@/shared/components/slider/slider';
|
||||||
import { Switch } from '/@/shared/components/switch/switch';
|
import { Switch } from '/@/shared/components/switch/switch';
|
||||||
import { useHotkeys } from '/@/shared/hooks/use-hotkeys';
|
import { useHotkeys } from '/@/shared/hooks/use-hotkeys';
|
||||||
import { Platform } from '/@/shared/types/types';
|
import { ItemListKey, ListDisplayType, Platform } from '/@/shared/types/types';
|
||||||
|
|
||||||
const mainBackground = 'var(--theme-colors-background)';
|
const mainBackground = 'var(--theme-colors-background)';
|
||||||
|
|
||||||
@@ -85,7 +87,7 @@ const Controls = ({ isPageHovered }: ControlsProps) => {
|
|||||||
<Popover position="bottom-start">
|
<Popover position="bottom-start">
|
||||||
<Popover.Target>
|
<Popover.Target>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
icon="settings"
|
icon="settings2"
|
||||||
iconProps={{ size: 'lg' }}
|
iconProps={{ size: 'lg' }}
|
||||||
tooltip={{ label: t('common.configure', { postProcess: 'titleCase' }) }}
|
tooltip={{ label: t('common.configure', { postProcess: 'titleCase' }) }}
|
||||||
variant={isPageHovered ? 'default' : 'subtle'}
|
variant={isPageHovered ? 'default' : 'subtle'}
|
||||||
@@ -349,6 +351,20 @@ const Controls = ({ isPageHovered }: ControlsProps) => {
|
|||||||
<Divider my="sm" />
|
<Divider my="sm" />
|
||||||
</Popover.Dropdown>
|
</Popover.Dropdown>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
<ListConfigMenu
|
||||||
|
buttonProps={{
|
||||||
|
variant: isPageHovered ? 'default' : 'subtle',
|
||||||
|
}}
|
||||||
|
displayTypes={[{ hidden: true, value: ListDisplayType.GRID }]}
|
||||||
|
listKey={ItemListKey.FULL_SCREEN}
|
||||||
|
optionsConfig={{
|
||||||
|
table: {
|
||||||
|
itemsPerPage: { hidden: true },
|
||||||
|
pagination: { hidden: true },
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
tableColumnsData={SONG_TABLE_COLUMNS}
|
||||||
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { GridConfig } from '/@/renderer/features/shared/components/grid-config';
|
|||||||
import { SettingsButton } from '/@/renderer/features/shared/components/settings-button';
|
import { SettingsButton } from '/@/renderer/features/shared/components/settings-button';
|
||||||
import { TableConfig } from '/@/renderer/features/shared/components/table-config';
|
import { TableConfig } from '/@/renderer/features/shared/components/table-config';
|
||||||
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store';
|
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store';
|
||||||
|
import { ActionIconProps } from '/@/shared/components/action-icon/action-icon';
|
||||||
import { Divider } from '/@/shared/components/divider/divider';
|
import { Divider } from '/@/shared/components/divider/divider';
|
||||||
import { Group } from '/@/shared/components/group/group';
|
import { Group } from '/@/shared/components/group/group';
|
||||||
import { Icon } from '/@/shared/components/icon/icon';
|
import { Icon } from '/@/shared/components/icon/icon';
|
||||||
@@ -99,6 +100,7 @@ export interface ListConfigMenuOptionsConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ListConfigMenuProps {
|
interface ListConfigMenuProps {
|
||||||
|
buttonProps?: ActionIconProps;
|
||||||
displayTypes?: ListConfigMenuDisplayTypeConfig[];
|
displayTypes?: ListConfigMenuDisplayTypeConfig[];
|
||||||
listKey: ItemListKey;
|
listKey: ItemListKey;
|
||||||
optionsConfig?: ListConfigMenuOptionsConfig;
|
optionsConfig?: ListConfigMenuOptionsConfig;
|
||||||
@@ -138,7 +140,7 @@ export const ListConfigMenu = (props: ListConfigMenuProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SettingsButton onClick={handlers.toggle} />
|
<SettingsButton {...props.buttonProps} onClick={handlers.toggle} />
|
||||||
<Modal
|
<Modal
|
||||||
handlers={handlers}
|
handlers={handlers}
|
||||||
opened={isOpen}
|
opened={isOpen}
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { useRef } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
|
|
||||||
import { ItemListHandle } from '/@/renderer/components/item-list/types';
|
import { useItemListColumnReorder } from '/@/renderer/components/item-list/helpers/use-item-list-column-reorder';
|
||||||
|
import { useItemListColumnResize } from '/@/renderer/components/item-list/helpers/use-item-list-column-resize';
|
||||||
|
import { ItemTableList } from '/@/renderer/components/item-list/item-table-list/item-table-list';
|
||||||
|
import { ItemTableListColumn } from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||||
import { ErrorFallback } from '/@/renderer/features/action-required/components/error-fallback';
|
import { ErrorFallback } from '/@/renderer/features/action-required/components/error-fallback';
|
||||||
import { songsQueries } from '/@/renderer/features/songs/api/songs-api';
|
import { songsQueries } from '/@/renderer/features/songs/api/songs-api';
|
||||||
|
import { useListSettings } from '/@/renderer/store';
|
||||||
import { Spinner } from '/@/shared/components/spinner/spinner';
|
import { Spinner } from '/@/shared/components/spinner/spinner';
|
||||||
import { Song } from '/@/shared/types/domain-types';
|
import { LibraryItem, Song } from '/@/shared/types/domain-types';
|
||||||
|
import { ItemListKey } from '/@/shared/types/types';
|
||||||
|
|
||||||
export type SimilarSongsListProps = {
|
export type SimilarSongsListProps = {
|
||||||
count?: number;
|
count?: number;
|
||||||
@@ -14,10 +19,7 @@ export type SimilarSongsListProps = {
|
|||||||
song: Song;
|
song: Song;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SimilarSongsList = ({ count, fullScreen, song }: SimilarSongsListProps) => {
|
export const SimilarSongsList = ({ count, song }: SimilarSongsListProps) => {
|
||||||
const tableRef = useRef<ItemListHandle | null>(null);
|
|
||||||
// const tableConfig = useTableSettings(fullScreen ? 'fullScreen' : 'songs');
|
|
||||||
|
|
||||||
const songQuery = useQuery(
|
const songQuery = useQuery(
|
||||||
songsQueries.similar({
|
songsQueries.similar({
|
||||||
options: {
|
options: {
|
||||||
@@ -32,16 +34,44 @@ export const SimilarSongsList = ({ count, fullScreen, song }: SimilarSongsListPr
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// const columnDefs = useMemo(
|
const { table } = useListSettings(ItemListKey.SONG);
|
||||||
// () => getColumnDefs(tableConfig.columns, false, 'generic'),
|
const { table: fullScreenTable } = useListSettings(ItemListKey.FULL_SCREEN);
|
||||||
// [tableConfig.columns],
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const onCellContextMenu = useHandleTableContextMenu(LibraryItem.SONG, SONG_CONTEXT_MENU_ITEMS);
|
const { handleColumnReordered } = useItemListColumnReorder({
|
||||||
|
itemListKey: ItemListKey.SONG,
|
||||||
|
});
|
||||||
|
|
||||||
return songQuery.isLoading ? (
|
const { handleColumnResized } = useItemListColumnResize({
|
||||||
<Spinner container size={25} />
|
itemListKey: ItemListKey.SONG,
|
||||||
) : (
|
});
|
||||||
<ErrorBoundary FallbackComponent={ErrorFallback}></ErrorBoundary>
|
|
||||||
|
const tableData = useMemo(() => {
|
||||||
|
return songQuery.data || [];
|
||||||
|
}, [songQuery.data]);
|
||||||
|
|
||||||
|
if (songQuery.isLoading || songQuery.isRefetching) {
|
||||||
|
return <Spinner container size={25} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ErrorBoundary FallbackComponent={ErrorFallback}>
|
||||||
|
<ItemTableList
|
||||||
|
autoFitColumns={table?.autoFitColumns}
|
||||||
|
CellComponent={ItemTableListColumn}
|
||||||
|
columns={table?.columns || []}
|
||||||
|
data={tableData}
|
||||||
|
enableAlternateRowColors={fullScreenTable?.enableAlternateRowColors}
|
||||||
|
enableExpansion={false}
|
||||||
|
enableHeader
|
||||||
|
enableHorizontalBorders={fullScreenTable?.enableHorizontalBorders}
|
||||||
|
enableRowHoverHighlight={fullScreenTable?.enableRowHoverHighlight}
|
||||||
|
enableSelection
|
||||||
|
enableVerticalBorders={fullScreenTable?.enableVerticalBorders}
|
||||||
|
itemType={LibraryItem.SONG}
|
||||||
|
onColumnReordered={handleColumnReordered}
|
||||||
|
onColumnResized={handleColumnResized}
|
||||||
|
size={table?.size}
|
||||||
|
/>
|
||||||
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ import {
|
|||||||
LuRotateCw,
|
LuRotateCw,
|
||||||
LuSave,
|
LuSave,
|
||||||
LuSearch,
|
LuSearch,
|
||||||
|
LuSettings,
|
||||||
LuSettings2,
|
LuSettings2,
|
||||||
LuShare2,
|
LuShare2,
|
||||||
LuShieldAlert,
|
LuShieldAlert,
|
||||||
@@ -207,6 +208,7 @@ export const AppIcon = {
|
|||||||
search: LuSearch,
|
search: LuSearch,
|
||||||
server: LuHardDrive,
|
server: LuHardDrive,
|
||||||
settings: LuSettings2,
|
settings: LuSettings2,
|
||||||
|
settings2: LuSettings,
|
||||||
share: LuShare2,
|
share: LuShare2,
|
||||||
signIn: LuLogIn,
|
signIn: LuLogIn,
|
||||||
signOut: LuLogOut,
|
signOut: LuLogOut,
|
||||||
|
|||||||
Reference in New Issue
Block a user