mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
add readOnly prop to JoinedArtists
This commit is contained in:
@@ -4,7 +4,6 @@ import {
|
|||||||
JOINED_ARTISTS_MUTED_PROPS,
|
JOINED_ARTISTS_MUTED_PROPS,
|
||||||
JoinedArtists,
|
JoinedArtists,
|
||||||
} from '/@/renderer/features/albums/components/joined-artists';
|
} from '/@/renderer/features/albums/components/joined-artists';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
|
||||||
|
|
||||||
export const AlbumArtistColumn = ({ isRowHovered, song }: ItemDetailListCellProps) => {
|
export const AlbumArtistColumn = ({ isRowHovered, song }: ItemDetailListCellProps) => {
|
||||||
const name = song.albumArtistName?.trim() ?? '';
|
const name = song.albumArtistName?.trim() ?? '';
|
||||||
@@ -12,19 +11,12 @@ export const AlbumArtistColumn = ({ isRowHovered, song }: ItemDetailListCellProp
|
|||||||
|
|
||||||
if (!hasArtists) return <> </>;
|
if (!hasArtists) return <> </>;
|
||||||
|
|
||||||
if (!isRowHovered) {
|
|
||||||
return (
|
|
||||||
<Text component="span" isMuted size="sm">
|
|
||||||
{name}
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<JoinedArtists
|
<JoinedArtists
|
||||||
artistName={song.albumArtistName ?? ''}
|
artistName={song.albumArtistName ?? ''}
|
||||||
artists={song.albumArtists ?? []}
|
artists={song.albumArtists ?? []}
|
||||||
linkProps={JOINED_ARTISTS_MUTED_PROPS.linkProps}
|
linkProps={JOINED_ARTISTS_MUTED_PROPS.linkProps}
|
||||||
|
readOnly={!isRowHovered}
|
||||||
rootTextProps={JOINED_ARTISTS_MUTED_PROPS.rootTextProps}
|
rootTextProps={JOINED_ARTISTS_MUTED_PROPS.rootTextProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
JOINED_ARTISTS_MUTED_PROPS,
|
JOINED_ARTISTS_MUTED_PROPS,
|
||||||
JoinedArtists,
|
JoinedArtists,
|
||||||
} from '/@/renderer/features/albums/components/joined-artists';
|
} from '/@/renderer/features/albums/components/joined-artists';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
|
||||||
|
|
||||||
export const ArtistColumn = ({ isRowHovered, song }: ItemDetailListCellProps) => {
|
export const ArtistColumn = ({ isRowHovered, song }: ItemDetailListCellProps) => {
|
||||||
const name = song.artistName?.trim() ?? '';
|
const name = song.artistName?.trim() ?? '';
|
||||||
@@ -12,19 +11,12 @@ export const ArtistColumn = ({ isRowHovered, song }: ItemDetailListCellProps) =>
|
|||||||
|
|
||||||
if (!hasArtists) return <> </>;
|
if (!hasArtists) return <> </>;
|
||||||
|
|
||||||
if (!isRowHovered) {
|
|
||||||
return (
|
|
||||||
<Text component="span" isMuted size="sm">
|
|
||||||
{name}
|
|
||||||
</Text>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<JoinedArtists
|
<JoinedArtists
|
||||||
artistName={song.artistName ?? ''}
|
artistName={song.artistName ?? ''}
|
||||||
artists={song.artists ?? []}
|
artists={song.artists ?? []}
|
||||||
linkProps={JOINED_ARTISTS_MUTED_PROPS.linkProps}
|
linkProps={JOINED_ARTISTS_MUTED_PROPS.linkProps}
|
||||||
|
readOnly={!isRowHovered}
|
||||||
rootTextProps={JOINED_ARTISTS_MUTED_PROPS.rootTextProps}
|
rootTextProps={JOINED_ARTISTS_MUTED_PROPS.rootTextProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import { useSettingsStore, useShowRatings } from '/@/renderer/store';
|
|||||||
import { formatDateAbsoluteUTC, formatDurationString } from '/@/renderer/utils';
|
import { formatDateAbsoluteUTC, formatDurationString } from '/@/renderer/utils';
|
||||||
import { ExplicitIndicator } from '/@/shared/components/explicit-indicator/explicit-indicator';
|
import { ExplicitIndicator } from '/@/shared/components/explicit-indicator/explicit-indicator';
|
||||||
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
|
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
|
||||||
import { useDoubleClick } from '/@/shared/hooks/use-double-click';
|
import { useDoubleClick } from '/@/shared/hooks/use-double-click';
|
||||||
import { Album, LibraryItem, Song, SongListSort, SortOrder } from '/@/shared/types/domain-types';
|
import { Album, LibraryItem, Song, SongListSort, SortOrder } from '/@/shared/types/domain-types';
|
||||||
import { ItemListKey, Play, TableColumn } from '/@/shared/types/types';
|
import { ItemListKey, Play, TableColumn } from '/@/shared/types/types';
|
||||||
@@ -456,15 +455,12 @@ const MetadataSection = memo(
|
|||||||
<div className={styles.artist}>
|
<div className={styles.artist}>
|
||||||
{!hasArtist ? (
|
{!hasArtist ? (
|
||||||
<> </>
|
<> </>
|
||||||
) : !isMetadataHovered ? (
|
|
||||||
<Text className={styles.artistPlainText} component="span" isMuted size="sm">
|
|
||||||
{item.albumArtistName ?? ''}
|
|
||||||
</Text>
|
|
||||||
) : (
|
) : (
|
||||||
<JoinedArtists
|
<JoinedArtists
|
||||||
artistName={item.albumArtistName ?? ''}
|
artistName={item.albumArtistName ?? ''}
|
||||||
artists={item.albumArtists ?? []}
|
artists={item.albumArtists ?? []}
|
||||||
linkProps={JOINED_ARTISTS_MUTED_PROPS.linkProps}
|
linkProps={JOINED_ARTISTS_MUTED_PROPS.linkProps}
|
||||||
|
readOnly={!isMetadataHovered}
|
||||||
rootTextProps={JOINED_ARTISTS_MUTED_PROPS.rootTextProps}
|
rootTextProps={JOINED_ARTISTS_MUTED_PROPS.rootTextProps}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ interface JoinedArtistsProps {
|
|||||||
artistName: string;
|
artistName: string;
|
||||||
artists: AlbumArtist[] | RelatedAlbumArtist[] | RelatedArtist[];
|
artists: AlbumArtist[] | RelatedAlbumArtist[] | RelatedArtist[];
|
||||||
linkProps?: Partial<Omit<TextProps, 'children' | 'component' | 'to'>>;
|
linkProps?: Partial<Omit<TextProps, 'children' | 'component' | 'to'>>;
|
||||||
|
readOnly?: boolean;
|
||||||
rootTextProps?: Partial<Omit<TextProps, 'children' | 'component'>>;
|
rootTextProps?: Partial<Omit<TextProps, 'children' | 'component'>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ const JoinedArtistsComponent = ({
|
|||||||
artistName,
|
artistName,
|
||||||
artists,
|
artists,
|
||||||
linkProps,
|
linkProps,
|
||||||
|
readOnly = false,
|
||||||
rootTextProps,
|
rootTextProps,
|
||||||
}: JoinedArtistsProps) => {
|
}: JoinedArtistsProps) => {
|
||||||
const parts: (
|
const parts: (
|
||||||
@@ -116,7 +118,7 @@ const JoinedArtistsComponent = ({
|
|||||||
{artists.map((artist, index) => (
|
{artists.map((artist, index) => (
|
||||||
<Fragment key={artist.id || `artist-${index}`}>
|
<Fragment key={artist.id || `artist-${index}`}>
|
||||||
{index > 0 && ', '}
|
{index > 0 && ', '}
|
||||||
{artist.id ? (
|
{artist.id && !readOnly ? (
|
||||||
<Text
|
<Text
|
||||||
component={Link}
|
component={Link}
|
||||||
fw={500}
|
fw={500}
|
||||||
@@ -129,7 +131,7 @@ const JoinedArtistsComponent = ({
|
|||||||
{artist.name}
|
{artist.name}
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<Text fw={500} {...linkProps}>
|
<Text component="span" fw={500} {...linkProps}>
|
||||||
{artist.name}
|
{artist.name}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@@ -157,7 +159,7 @@ const JoinedArtistsComponent = ({
|
|||||||
|
|
||||||
const { artist, text } = part;
|
const { artist, text } = part;
|
||||||
|
|
||||||
if (artist.id) {
|
if (artist.id && !readOnly) {
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
component={Link}
|
component={Link}
|
||||||
@@ -174,7 +176,7 @@ const JoinedArtistsComponent = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Text fw={500} key={`${artist.name}-${index}`} {...linkProps}>
|
<Text component="span" fw={500} key={`${artist.name}-${index}`} {...linkProps}>
|
||||||
{text}
|
{text}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
@@ -185,7 +187,7 @@ const JoinedArtistsComponent = ({
|
|||||||
{unmatchedArtists.map((artist, index) => (
|
{unmatchedArtists.map((artist, index) => (
|
||||||
<Fragment key={artist.id}>
|
<Fragment key={artist.id}>
|
||||||
{index > 0 && ', '}
|
{index > 0 && ', '}
|
||||||
{artist.id ? (
|
{artist.id && !readOnly ? (
|
||||||
<Text
|
<Text
|
||||||
component={Link}
|
component={Link}
|
||||||
fw={500}
|
fw={500}
|
||||||
@@ -197,6 +199,10 @@ const JoinedArtistsComponent = ({
|
|||||||
>
|
>
|
||||||
{artist.name}
|
{artist.name}
|
||||||
</Text>
|
</Text>
|
||||||
|
) : artist.id ? (
|
||||||
|
<Text component="span" fw={500} {...linkProps}>
|
||||||
|
{artist.name}
|
||||||
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<Text component="span" isMuted>
|
<Text component="span" isMuted>
|
||||||
{artist.name}
|
{artist.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user