2025-05-20 19:23:36 -07:00
|
|
|
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
|
2022-12-19 15:59:14 -08:00
|
|
|
import type { ICellRendererParams } from '@ag-grid-community/core';
|
2025-05-18 14:03:18 -07:00
|
|
|
|
|
|
|
|
import React from 'react';
|
2022-12-19 15:59:14 -08:00
|
|
|
import { generatePath } from 'react-router';
|
|
|
|
|
import { Link } from 'react-router-dom';
|
2025-05-18 14:03:18 -07:00
|
|
|
|
2022-12-19 15:59:14 -08:00
|
|
|
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
|
|
|
|
|
import { AppRoute } from '/@/renderer/router/routes';
|
2025-06-24 00:04:36 -07:00
|
|
|
import { Separator } from '/@/shared/components/separator/separator';
|
|
|
|
|
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
|
|
|
|
|
import { Text } from '/@/shared/components/text/text';
|
2022-12-19 15:59:14 -08:00
|
|
|
|
2025-05-18 14:03:18 -07:00
|
|
|
export const AlbumArtistCell = ({ data, value }: ICellRendererParams) => {
|
2023-07-01 19:10:05 -07:00
|
|
|
if (value === undefined) {
|
|
|
|
|
return (
|
2025-06-24 00:04:36 -07:00
|
|
|
<CellContainer position="left">
|
2023-07-01 19:10:05 -07:00
|
|
|
<Skeleton
|
|
|
|
|
height="1rem"
|
|
|
|
|
width="80%"
|
|
|
|
|
/>
|
|
|
|
|
</CellContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-12-20 04:25:51 -08:00
|
|
|
|
2023-07-01 19:10:05 -07:00
|
|
|
return (
|
2025-06-24 00:04:36 -07:00
|
|
|
<CellContainer position="left">
|
2023-07-01 19:10:05 -07:00
|
|
|
<Text
|
2025-06-24 00:04:36 -07:00
|
|
|
isMuted
|
2023-06-11 23:27:50 -07:00
|
|
|
overflow="hidden"
|
|
|
|
|
size="md"
|
2023-07-01 19:10:05 -07:00
|
|
|
>
|
2025-05-18 14:03:18 -07:00
|
|
|
{value?.map((item: AlbumArtist | Artist, index: number) => (
|
2023-07-01 19:10:05 -07:00
|
|
|
<React.Fragment key={`row-${item.id}-${data.uniqueId}`}>
|
2024-04-14 21:58:25 -07:00
|
|
|
{index > 0 && <Separator />}
|
2023-07-01 19:10:05 -07:00
|
|
|
{item.id ? (
|
|
|
|
|
<Text
|
|
|
|
|
component={Link}
|
2025-06-24 00:04:36 -07:00
|
|
|
isLink
|
|
|
|
|
isMuted
|
2023-07-01 19:10:05 -07:00
|
|
|
overflow="hidden"
|
|
|
|
|
size="md"
|
|
|
|
|
to={generatePath(AppRoute.LIBRARY_ALBUM_ARTISTS_DETAIL, {
|
|
|
|
|
albumArtistId: item.id,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{item.name || '—'}
|
|
|
|
|
</Text>
|
|
|
|
|
) : (
|
|
|
|
|
<Text
|
2025-06-24 00:04:36 -07:00
|
|
|
isMuted
|
2023-07-01 19:10:05 -07:00
|
|
|
overflow="hidden"
|
|
|
|
|
size="md"
|
|
|
|
|
>
|
|
|
|
|
{item.name || '—'}
|
|
|
|
|
</Text>
|
|
|
|
|
)}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
))}
|
|
|
|
|
</Text>
|
|
|
|
|
</CellContainer>
|
|
|
|
|
);
|
2022-12-19 15:59:14 -08:00
|
|
|
};
|