mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-17 08:54:27 +02:00
temp
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
|||||||
ItemListStateActions,
|
ItemListStateActions,
|
||||||
ItemListStateItem,
|
ItemListStateItem,
|
||||||
useItemListState,
|
useItemListState,
|
||||||
|
useItemSelectionState,
|
||||||
} from '/@/renderer/components/item-list/helpers/item-list-state';
|
} from '/@/renderer/components/item-list/helpers/item-list-state';
|
||||||
import { ItemListItem } from '/@/renderer/components/item-list/types';
|
import { ItemListItem } from '/@/renderer/components/item-list/types';
|
||||||
import { albumQueries } from '/@/renderer/features/albums/api/album-api';
|
import { albumQueries } from '/@/renderer/features/albums/api/album-api';
|
||||||
@@ -29,6 +30,7 @@ import { LibraryItem, Song } from '/@/shared/types/domain-types';
|
|||||||
import { DragOperation, DragTarget, DragTargetMap } from '/@/shared/types/drag-and-drop';
|
import { DragOperation, DragTarget, DragTargetMap } from '/@/shared/types/drag-and-drop';
|
||||||
|
|
||||||
interface AlbumTracksTableProps {
|
interface AlbumTracksTableProps {
|
||||||
|
internalState?: ItemListStateActions;
|
||||||
isDark?: boolean;
|
isDark?: boolean;
|
||||||
serverId: string;
|
serverId: string;
|
||||||
songs?: Array<{
|
songs?: Array<{
|
||||||
@@ -54,7 +56,7 @@ interface TrackRowProps {
|
|||||||
|
|
||||||
const TrackRow = ({ controls, internalState, serverId, song }: TrackRowProps) => {
|
const TrackRow = ({ controls, internalState, serverId, song }: TrackRowProps) => {
|
||||||
const rowId = internalState.extractRowId(song);
|
const rowId = internalState.extractRowId(song);
|
||||||
const isSelected = rowId ? internalState.isSelected(rowId) : false;
|
const isSelected = useItemSelectionState(internalState, rowId);
|
||||||
|
|
||||||
const songWithMetadata = {
|
const songWithMetadata = {
|
||||||
...song,
|
...song,
|
||||||
@@ -132,7 +134,12 @@ const TrackRow = ({ controls, internalState, serverId, song }: TrackRowProps) =>
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const AlbumTracksTable = ({ isDark, serverId, songs }: AlbumTracksTableProps) => {
|
const AlbumTracksTable = ({
|
||||||
|
internalState: parentInternalState,
|
||||||
|
isDark,
|
||||||
|
serverId,
|
||||||
|
songs,
|
||||||
|
}: AlbumTracksTableProps) => {
|
||||||
const getDataFn = useCallback(() => songs || [], [songs]);
|
const getDataFn = useCallback(() => songs || [], [songs]);
|
||||||
|
|
||||||
const extractRowId = useCallback((item: unknown) => {
|
const extractRowId = useCallback((item: unknown) => {
|
||||||
@@ -142,7 +149,9 @@ const AlbumTracksTable = ({ isDark, serverId, songs }: AlbumTracksTableProps) =>
|
|||||||
return undefined;
|
return undefined;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const internalState = useItemListState(getDataFn, extractRowId);
|
// Use parent internalState if available, otherwise create a local one
|
||||||
|
const localInternalState = useItemListState(getDataFn, extractRowId);
|
||||||
|
const internalState = parentInternalState || localInternalState;
|
||||||
|
|
||||||
const controls = useDefaultItemListControls();
|
const controls = useDefaultItemListControls();
|
||||||
|
|
||||||
@@ -253,6 +262,7 @@ export const ExpandedAlbumListItem = ({ internalState, item }: ExpandedAlbumList
|
|||||||
</Group>
|
</Group>
|
||||||
</div>
|
</div>
|
||||||
<AlbumTracksTable
|
<AlbumTracksTable
|
||||||
|
internalState={internalState}
|
||||||
isDark={color.isDark}
|
isDark={color.isDark}
|
||||||
serverId={item._serverId}
|
serverId={item._serverId}
|
||||||
songs={data?.songs}
|
songs={data?.songs}
|
||||||
|
|||||||
Reference in New Issue
Block a user