mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
add context to item list table
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
TableColumnContainer,
|
||||
TableColumnTextContainer,
|
||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||
import { useIsActiveRow } from '/@/renderer/components/item-list/item-table-list/item-table-list-context';
|
||||
import { ItemListItem } from '/@/renderer/components/item-list/types';
|
||||
import { usePlayerStatus } from '/@/renderer/store';
|
||||
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||
@@ -87,9 +88,7 @@ const DefaultRowIndexColumn = (props: ItemTableListInnerColumn) => {
|
||||
const QueueSongRowIndexColumn = (props: ItemTableListInnerColumn) => {
|
||||
const status = usePlayerStatus();
|
||||
const song = props.data[props.rowIndex] as QueueSong;
|
||||
const isActive =
|
||||
!!props.activeRowId &&
|
||||
(props.activeRowId === song?.id || props.activeRowId === song?._uniqueId);
|
||||
const isActive = useIsActiveRow(song?.id, song?._uniqueId);
|
||||
|
||||
const isActiveAndPlaying = isActive && status === PlayerStatus.PLAYING;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
ItemTableListInnerColumn,
|
||||
TableColumnContainer,
|
||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||
import { useIsActiveRow } from '/@/renderer/components/item-list/item-table-list/item-table-list-context';
|
||||
import { Text } from '/@/shared/components/text/text';
|
||||
import { LibraryItem, QueueSong } from '/@/shared/types/domain-types';
|
||||
|
||||
@@ -75,9 +76,7 @@ function QueueSongTitleColumn(props: ItemTableListInnerColumn) {
|
||||
];
|
||||
|
||||
const song = props.data[props.rowIndex] as QueueSong;
|
||||
const isActive =
|
||||
!!props.activeRowId &&
|
||||
(props.activeRowId === song?.id || props.activeRowId === song?._uniqueId);
|
||||
const isActive = useIsActiveRow(song?.id, song?._uniqueId);
|
||||
|
||||
if (typeof row === 'string') {
|
||||
const path = getTitlePath(props.itemType, (props.data[props.rowIndex] as any).id as string);
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
ItemTableListInnerColumn,
|
||||
TableColumnContainer,
|
||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||
import { useIsActiveRow } from '/@/renderer/components/item-list/item-table-list/item-table-list-context';
|
||||
import { JoinedArtists } from '/@/renderer/features/albums/components/joined-artists';
|
||||
import { PlayButton } from '/@/renderer/features/shared/components/play-button';
|
||||
import {
|
||||
@@ -162,9 +163,7 @@ export const QueueSongTitleCombinedColumn = (props: ItemTableListInnerColumn) =>
|
||||
const internalState = (props as any).internalState;
|
||||
const playButtonBehavior = usePlayButtonBehavior();
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const isActive =
|
||||
!!props.activeRowId &&
|
||||
(props.activeRowId === song?.id || props.activeRowId === song?._uniqueId);
|
||||
const isActive = useIsActiveRow(song?.id, song?._uniqueId);
|
||||
|
||||
const handlePlay = (playType: Play, event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
if (!item) {
|
||||
|
||||
Reference in New Issue
Block a user