{children}
diff --git a/src/renderer/components/switch/index.tsx b/src/renderer/components/switch/index.tsx
index 08e0d36f..c23d6307 100644
--- a/src/renderer/components/switch/index.tsx
+++ b/src/renderer/components/switch/index.tsx
@@ -1,4 +1,5 @@
import type { SwitchProps as MantineSwitchProps } from '@mantine/core';
+
import { Switch as MantineSwitch } from '@mantine/core';
import styled from 'styled-components';
diff --git a/src/renderer/components/tabs/index.tsx b/src/renderer/components/tabs/index.tsx
index 7790b346..9efc96cc 100644
--- a/src/renderer/components/tabs/index.tsx
+++ b/src/renderer/components/tabs/index.tsx
@@ -1,5 +1,5 @@
+import { Tabs as MantineTabs, TabsProps as MantineTabsProps, TabsPanelProps } from '@mantine/core';
import { Suspense } from 'react';
-import { TabsPanelProps, TabsProps as MantineTabsProps, Tabs as MantineTabs } from '@mantine/core';
import styled from 'styled-components';
type TabsProps = MantineTabsProps;
diff --git a/src/renderer/components/text-title/index.tsx b/src/renderer/components/text-title/index.tsx
index 3820d125..01f77183 100644
--- a/src/renderer/components/text-title/index.tsx
+++ b/src/renderer/components/text-title/index.tsx
@@ -1,10 +1,12 @@
-import type { ComponentPropsWithoutRef, ReactNode } from 'react';
import type { TitleProps as MantineTitleProps } from '@mantine/core';
+import type { ComponentPropsWithoutRef, ReactNode } from 'react';
+
import { createPolymorphicComponent, Title as MantineHeader } from '@mantine/core';
import styled from 'styled-components';
+
import { textEllipsis } from '/@/renderer/styles';
-type MantineTextTitleDivProps = MantineTitleProps & ComponentPropsWithoutRef<'div'>;
+type MantineTextTitleDivProps = ComponentPropsWithoutRef<'div'> & MantineTitleProps;
interface TextTitleProps extends MantineTextTitleDivProps {
$link?: boolean;
@@ -30,7 +32,7 @@ const StyledTextTitle = styled(MantineHeader)
`
}
`;
-const _TextTitle = ({ children, $secondary, overflow, $noSelect, ...rest }: TextTitleProps) => {
+const _TextTitle = ({ $noSelect, $secondary, children, overflow, ...rest }: TextTitleProps) => {
return (
(_TextTitle);
-
-_TextTitle.defaultProps = {
- $link: false,
- $noSelect: false,
- $secondary: false,
- overflow: 'visible',
- to: '',
- weight: 400,
-};
diff --git a/src/renderer/components/text/index.tsx b/src/renderer/components/text/index.tsx
index 5788de8b..368f0293 100644
--- a/src/renderer/components/text/index.tsx
+++ b/src/renderer/components/text/index.tsx
@@ -1,11 +1,13 @@
-import type { ComponentPropsWithoutRef, ReactNode } from 'react';
+import type { Font } from '/@/renderer/styles';
import type { TextProps as MantineTextProps } from '@mantine/core';
+import type { ComponentPropsWithoutRef, ReactNode } from 'react';
+
import { createPolymorphicComponent, Text as MantineText } from '@mantine/core';
import styled from 'styled-components';
-import type { Font } from '/@/renderer/styles';
+
import { textEllipsis } from '/@/renderer/styles';
-type MantineTextDivProps = MantineTextProps & ComponentPropsWithoutRef<'div'>;
+type MantineTextDivProps = ComponentPropsWithoutRef<'div'> & MantineTextProps;
interface TextProps extends MantineTextDivProps {
$link?: boolean;
@@ -32,7 +34,7 @@ const StyledText = styled(MantineText)`
}
`;
-export const _Text = ({ children, $secondary, overflow, font, $noSelect, ...rest }: TextProps) => {
+export const _Text = ({ $noSelect, $secondary, children, font, overflow, ...rest }: TextProps) => {
return (
(_Text);
-
-_Text.defaultProps = {
- $link: false,
- $noSelect: false,
- $secondary: false,
- font: undefined,
- overflow: 'visible',
- to: '',
- weight: 400,
-};
diff --git a/src/renderer/components/toast/index.tsx b/src/renderer/components/toast/index.tsx
index d732868a..c4a6f74f 100644
--- a/src/renderer/components/toast/index.tsx
+++ b/src/renderer/components/toast/index.tsx
@@ -1,14 +1,15 @@
import type { NotificationProps as MantineNotificationProps } from '@mantine/notifications';
+
import {
- showNotification,
- updateNotification,
- hideNotification,
cleanNotifications,
cleanNotificationsQueue,
+ hideNotification,
+ showNotification,
+ updateNotification,
} from '@mantine/notifications';
interface NotificationProps extends MantineNotificationProps {
- type?: 'success' | 'error' | 'warning' | 'info';
+ type?: 'error' | 'info' | 'success' | 'warning';
}
const showToast = ({ type, ...props }: NotificationProps) => {
diff --git a/src/renderer/components/tooltip/index.tsx b/src/renderer/components/tooltip/index.tsx
index cd4e90a5..c0817816 100644
--- a/src/renderer/components/tooltip/index.tsx
+++ b/src/renderer/components/tooltip/index.tsx
@@ -1,4 +1,5 @@
import type { TooltipProps } from '@mantine/core';
+
import { Tooltip as MantineTooltip } from '@mantine/core';
import styled from 'styled-components';
@@ -12,7 +13,6 @@ export const Tooltip = ({ children, ...rest }: TooltipProps) => {
return (
{
duration: 250,
transition: 'fade',
}}
+ withinPortal
{...rest}
>
{children}
);
};
-
-Tooltip.defaultProps = {
- openDelay: 0,
- position: 'top',
- withArrow: true,
- withinPortal: true,
-};
diff --git a/src/renderer/components/virtual-grid/grid-card/default-card.tsx b/src/renderer/components/virtual-grid/grid-card/default-card.tsx
index 6c2dffcc..fee72a0c 100644
--- a/src/renderer/components/virtual-grid/grid-card/default-card.tsx
+++ b/src/renderer/components/virtual-grid/grid-card/default-card.tsx
@@ -1,14 +1,22 @@
import { Center, Stack } from '@mantine/core';
-import { RiAlbumFill, RiUserVoiceFill, RiPlayListFill } from 'react-icons/ri';
+import { RiAlbumFill, RiPlayListFill, RiUserVoiceFill } from 'react-icons/ri';
import { generatePath, useNavigate } from 'react-router-dom';
import { SimpleImg } from 'react-simple-img';
import { ListChildComponentProps } from 'react-window';
import styled from 'styled-components';
-import { Album, AlbumArtist, Artist, LibraryItem, Playlist, Song } from '/@/renderer/api/types';
+
import { CardRows } from '/@/renderer/components/card';
import { Skeleton } from '/@/renderer/components/skeleton';
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
-import { CardRow, PlayQueueAddOptions, Play, CardRoute } from '/@/renderer/types';
+import {
+ Album,
+ AlbumArtist,
+ Artist,
+ LibraryItem,
+ Playlist,
+ Song,
+} from '/@/shared/types/domain-types';
+import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
interface BaseGridCardProps {
columnIndex: number;
@@ -131,17 +139,17 @@ const DetailContainer = styled.div`
`;
export const DefaultCard = ({
- listChildProps,
- data,
columnIndex,
controls,
+ data,
isHidden,
+ listChildProps,
}: BaseGridCardProps) => {
const navigate = useNavigate();
if (data) {
const path = generatePath(
- controls.route.route,
+ controls.route.route as string,
controls.route.slugs?.reduce((acc, slug) => {
return {
...acc,
@@ -156,10 +164,10 @@ export const DefaultCard = ({
case LibraryItem.ALBUM:
Placeholder = RiAlbumFill;
break;
- case LibraryItem.ARTIST:
+ case LibraryItem.ALBUM_ARTIST:
Placeholder = RiUserVoiceFill;
break;
- case LibraryItem.ALBUM_ARTIST:
+ case LibraryItem.ARTIST:
Placeholder = RiUserVoiceFill;
break;
case LibraryItem.PLAYLIST:
@@ -172,8 +180,8 @@ export const DefaultCard = ({
return (
navigate(path)}
>
@@ -221,25 +229,25 @@ export const DefaultCard = ({
return (
{(controls?.cardRows || []).map((row, index) => (
))}
diff --git a/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx b/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx
index 81564d20..8b085d43 100644
--- a/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx
+++ b/src/renderer/components/virtual-grid/grid-card/grid-card-controls.tsx
@@ -1,20 +1,21 @@
-import React, { MouseEvent, useState } from 'react';
import type { UnstyledButtonProps } from '@mantine/core';
-import { RiPlayFill, RiHeartFill, RiHeartLine, RiMoreFill } from 'react-icons/ri';
+
+import React, { MouseEvent, useState } from 'react';
+import { RiHeartFill, RiHeartLine, RiMoreFill, RiPlayFill } from 'react-icons/ri';
import styled from 'styled-components';
+
import { _Button } from '/@/renderer/components/button';
-import type { PlayQueueAddOptions } from '/@/renderer/types';
-import { Play } from '/@/renderer/types';
-import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
-import { LibraryItem } from '/@/renderer/api/types';
-import { useHandleGridContextMenu } from '/@/renderer/features/context-menu/hooks/use-handle-context-menu';
import {
- PLAYLIST_CONTEXT_MENU_ITEMS,
ALBUM_CONTEXT_MENU_ITEMS,
ARTIST_CONTEXT_MENU_ITEMS,
-} from '../../../features/context-menu/context-menu-items';
+ PLAYLIST_CONTEXT_MENU_ITEMS,
+} from '/@/renderer/features/context-menu/context-menu-items';
+import { useHandleGridContextMenu } from '/@/renderer/features/context-menu/hooks/use-handle-context-menu';
+import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
+import { LibraryItem } from '/@/shared/types/domain-types';
+import { Play, PlayQueueAddOptions } from '/@/shared/types/types';
-type PlayButtonType = UnstyledButtonProps & React.ComponentPropsWithoutRef<'button'>;
+type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
const PlayButton = styled.button`
position: absolute;
@@ -108,10 +109,10 @@ const FavoriteWrapper = styled.span<{ isFavorite: boolean }>`
`;
export const GridCardControls = ({
+ handleFavorite,
+ handlePlayQueueAdd,
itemData,
itemType,
- handlePlayQueueAdd,
- handleFavorite,
resetInfiniteLoaderCache,
}: {
handleFavorite: (options: {
@@ -178,9 +179,9 @@ export const GridCardControls = ({
{itemType !== LibraryItem.PLAYLIST && (
handleFavorites(e, itemData?.serverId)}
p={5}
variant="subtle"
- onClick={(e) => handleFavorites(e, itemData?.serverId)}
>
{isFavorite ? (
@@ -196,13 +197,13 @@ export const GridCardControls = ({
)}
{
e.preventDefault();
e.stopPropagation();
handleContextMenu(e, [itemData]);
}}
+ p={5}
+ variant="subtle"
>
{
const {
- columnCount,
- itemCount,
cardRows,
- itemData,
- itemType,
- itemGap,
- playButtonBehavior,
- handlePlayQueueAdd,
- handleFavorite,
- route,
+ columnCount,
display,
+ handleFavorite,
+ handlePlayQueueAdd,
+ itemCount,
+ itemData,
+ itemGap,
+ itemType,
+ playButtonBehavior,
resetInfiniteLoaderCache,
+ route,
} = data as GridCardData;
- const cards = [];
+ const cards: React.ReactNode[] = [];
const startIndex = index * columnCount;
const stopIndex = Math.min(itemCount - 1, startIndex + columnCount - 1);
@@ -35,10 +37,9 @@ export const GridCard = memo(({ data, index, style }: ListChildComponentProps) =
for (let i = startIndex; i <= stopIndex + columnCountToAdd; i += 1) {
cards.push(
[],
handleFavorite,
handlePlayQueueAdd,
itemGap,
@@ -49,6 +50,7 @@ export const GridCard = memo(({ data, index, style }: ListChildComponentProps) =
}}
data={itemData[i]}
isHidden={i > stopIndex}
+ key={`card-${i}-${index}`}
listChildProps={{ index }}
/>,
);
diff --git a/src/renderer/components/virtual-grid/grid-card/poster-card.tsx b/src/renderer/components/virtual-grid/grid-card/poster-card.tsx
index bf3f56e1..96cc152c 100644
--- a/src/renderer/components/virtual-grid/grid-card/poster-card.tsx
+++ b/src/renderer/components/virtual-grid/grid-card/poster-card.tsx
@@ -4,11 +4,19 @@ import { generatePath, useNavigate } from 'react-router-dom';
import { SimpleImg } from 'react-simple-img';
import { ListChildComponentProps } from 'react-window';
import styled from 'styled-components';
-import { Album, AlbumArtist, Artist, LibraryItem, Playlist, Song } from '/@/renderer/api/types';
+
import { CardRows } from '/@/renderer/components/card';
import { Skeleton } from '/@/renderer/components/skeleton';
import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/grid-card-controls';
-import { CardRow, PlayQueueAddOptions, Play, CardRoute } from '/@/renderer/types';
+import {
+ Album,
+ AlbumArtist,
+ Artist,
+ LibraryItem,
+ Playlist,
+ Song,
+} from '/@/shared/types/domain-types';
+import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
interface BaseGridCardProps {
columnIndex: number;
@@ -119,17 +127,17 @@ const DetailContainer = styled.div`
`;
export const PosterCard = ({
- listChildProps,
- data,
columnIndex,
controls,
+ data,
isHidden,
+ listChildProps,
}: BaseGridCardProps) => {
const navigate = useNavigate();
if (data) {
const path = generatePath(
- controls.route.route,
+ controls.route.route as string,
controls.route.slugs?.reduce((acc, slug) => {
return {
...acc,
@@ -144,10 +152,10 @@ export const PosterCard = ({
case LibraryItem.ALBUM:
Placeholder = RiAlbumFill;
break;
- case LibraryItem.ARTIST:
+ case LibraryItem.ALBUM_ARTIST:
Placeholder = RiUserVoiceFill;
break;
- case LibraryItem.ALBUM_ARTIST:
+ case LibraryItem.ARTIST:
Placeholder = RiUserVoiceFill;
break;
case LibraryItem.PLAYLIST:
@@ -160,8 +168,8 @@ export const PosterCard = ({
return (
navigate(path)}>
@@ -207,13 +215,13 @@ export const PosterCard = ({
return (
@@ -221,10 +229,10 @@ export const PosterCard = ({
{(controls?.cardRows || []).map((row, index) => (
))}
diff --git a/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx b/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx
index 8d7f85fe..f6d39623 100644
--- a/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx
+++ b/src/renderer/components/virtual-grid/virtual-grid-wrapper.tsx
@@ -1,12 +1,19 @@
+import type {
+ CardRoute,
+ CardRow,
+ ListDisplayType,
+ PlayQueueAddOptions,
+} from '/@/shared/types/types';
import type { Ref } from 'react';
+import type { FixedSizeListProps } from 'react-window';
+
import debounce from 'lodash/debounce';
import memoize from 'memoize-one';
-import type { FixedSizeListProps } from 'react-window';
import { FixedSizeList } from 'react-window';
import styled from 'styled-components';
+
import { GridCard } from '/@/renderer/components/virtual-grid/grid-card';
-import type { CardRow, ListDisplayType, CardRoute, PlayQueueAddOptions } from '/@/renderer/types';
-import { Album, AlbumArtist, Artist, LibraryItem } from '/@/renderer/api/types';
+import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types';
const createItemData = memoize(
(
@@ -43,27 +50,27 @@ const createItemData = memoize(
const createScrollHandler = memoize((onScroll) => debounce(onScroll, 250));
export const VirtualGridWrapper = ({
- refInstance,
cardRows,
- itemGap,
- itemType,
- itemWidth,
- display,
- itemHeight,
- itemCount,
columnCount,
- rowCount,
- initialScrollOffset,
+ display,
handleFavorite,
handlePlayQueueAdd,
- itemData,
- route,
- onScroll,
height,
- width,
+ initialScrollOffset,
+ itemCount,
+ itemData,
+ itemGap,
+ itemHeight,
+ itemType,
+ itemWidth,
+ onScroll,
+ refInstance,
resetInfiniteLoaderCache,
+ route,
+ rowCount,
+ width,
...rest
-}: Omit & {
+}: Omit & {
cardRows: CardRow[];
columnCount: number;
display: ListDisplayType;
@@ -112,19 +119,15 @@ export const VirtualGridWrapper = ({
itemCount={rowCount}
itemData={memoizedItemData}
itemSize={itemHeight}
+ onScroll={memoizedOnScroll}
overscanCount={5}
width={(width && Number(width)) || 0}
- onScroll={memoizedOnScroll}
>
{GridCard}
);
};
-VirtualGridWrapper.defaultProps = {
- route: undefined,
-};
-
export const VirtualGridContainer = styled.div`
display: flex;
flex-direction: column;
diff --git a/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx b/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx
index 611e7907..4263439d 100644
--- a/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx
+++ b/src/renderer/components/virtual-grid/virtual-infinite-grid.tsx
@@ -1,21 +1,21 @@
+import type { CardRoute, CardRow, PlayQueueAddOptions } from '/@/shared/types/types';
+import type { FixedSizeListProps } from 'react-window';
+
+import debounce from 'lodash/debounce';
import {
- useState,
- useRef,
- useMemo,
- useCallback,
forwardRef,
Ref,
+ useCallback,
useImperativeHandle,
+ useMemo,
+ useRef,
+ useState,
} from 'react';
-import debounce from 'lodash/debounce';
-import type { FixedSizeListProps } from 'react-window';
import InfiniteLoader from 'react-window-infinite-loader';
-import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper';
-import type { CardRoute, CardRow, PlayQueueAddOptions } from '/@/renderer/types';
-import { ListDisplayType } from '/@/renderer/types';
-import { AnyLibraryItem, Genre, LibraryItem } from '/@/renderer/api/types';
-type LibraryItemOrGenre = AnyLibraryItem | Genre;
+import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper';
+import { AnyLibraryItem, Genre, LibraryItem } from '/@/shared/types/domain-types';
+import { ListDisplayType } from '/@/shared/types/types';
export type VirtualInfiniteGridRef = {
resetLoadMoreItemsCache: () => void;
@@ -24,8 +24,10 @@ export type VirtualInfiniteGridRef = {
updateItemData: (rule: (item: LibraryItemOrGenre) => LibraryItemOrGenre) => void;
};
+type LibraryItemOrGenre = AnyLibraryItem | Genre;
+
interface VirtualGridProps
- extends Omit {
+ extends Omit {
cardRows: CardRow[];
display?: ListDisplayType;
fetchFn: (options: { columnCount: number; skip: number; take: number }) => Promise;
@@ -49,22 +51,22 @@ interface VirtualGridProps
export const VirtualInfiniteGrid = forwardRef(
(
{
+ cardRows,
+ display,
+ fetchFn,
+ fetchInitialData,
+ handleFavorite,
+ handlePlayQueueAdd,
+ height,
+ initialScrollOffset,
itemCount,
itemGap,
itemSize,
itemType,
- cardRows,
- route,
- onScroll,
- display,
- handlePlayQueueAdd,
- minimumBatchSize,
- fetchFn,
- fetchInitialData,
loading,
- initialScrollOffset,
- handleFavorite,
- height,
+ minimumBatchSize,
+ onScroll,
+ route,
width,
}: VirtualGridProps,
ref: Ref,
@@ -78,7 +80,7 @@ export const VirtualInfiniteGrid = forwardRef(
fetchInitialData?.() || [],
);
- const { itemHeight, rowCount, columnCount } = useMemo(() => {
+ const { columnCount, itemHeight, rowCount } = useMemo(() => {
const itemsPerRow = width ? Math.floor(width / (itemSize + itemGap * 2)) : 5;
const widthPerItem = Number(width) / itemsPerRow;
const itemHeight = widthPerItem + cardRows.length * 26;
@@ -165,11 +167,11 @@ export const VirtualInfiniteGrid = forwardRef(
return (
<>
isItemLoaded(index)}
itemCount={itemCount || 0}
loadMoreItems={debouncedLoadMoreItems}
minimumBatchSize={minimumBatchSize}
+ ref={loader}
threshold={30}
>
{({ onItemsRendered, ref: infiniteLoaderRef }) => (
@@ -187,6 +189,8 @@ export const VirtualInfiniteGrid = forwardRef(
itemHeight={itemHeight}
itemType={itemType}
itemWidth={itemSize}
+ onItemsRendered={onItemsRendered}
+ onScroll={onScroll}
refInstance={(list) => {
infiniteLoaderRef(list);
listRef.current = list;
@@ -200,8 +204,6 @@ export const VirtualInfiniteGrid = forwardRef(
route={route}
rowCount={rowCount}
width={width}
- onItemsRendered={onItemsRendered}
- onScroll={onScroll}
/>
)}
@@ -209,9 +211,3 @@ export const VirtualInfiniteGrid = forwardRef(
);
},
);
-
-VirtualInfiniteGrid.defaultProps = {
- display: ListDisplayType.CARD,
- minimumBatchSize: 20,
- route: undefined,
-};
diff --git a/src/renderer/components/virtual-table/cells/actions-cell.tsx b/src/renderer/components/virtual-table/cells/actions-cell.tsx
index 225f16a8..48e73d28 100644
--- a/src/renderer/components/virtual-table/cells/actions-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/actions-cell.tsx
@@ -1,19 +1,21 @@
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { RiMoreFill } from 'react-icons/ri';
+
import { Button } from '/@/renderer/components/button';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
-export const ActionsCell = ({ context, api }: ICellRendererParams) => {
+export const ActionsCell = ({ api, context }: ICellRendererParams) => {
return (
diff --git a/src/renderer/components/virtual-table/cells/album-artist-cell.tsx b/src/renderer/components/virtual-table/cells/album-artist-cell.tsx
index ea9a49f0..702b97e9 100644
--- a/src/renderer/components/virtual-table/cells/album-artist-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/album-artist-cell.tsx
@@ -1,15 +1,17 @@
-import React from 'react';
+import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import type { ICellRendererParams } from '@ag-grid-community/core';
+
+import React from 'react';
import { generatePath } from 'react-router';
import { Link } from 'react-router-dom';
-import type { AlbumArtist, Artist } from '/@/renderer/api/types';
+
+import { Separator } from '/@/renderer/components/separator';
+import { Skeleton } from '/@/renderer/components/skeleton';
import { Text } from '/@/renderer/components/text';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
import { AppRoute } from '/@/renderer/router/routes';
-import { Skeleton } from '/@/renderer/components/skeleton';
-import { Separator } from '/@/renderer/components/separator';
-export const AlbumArtistCell = ({ value, data }: ICellRendererParams) => {
+export const AlbumArtistCell = ({ data, value }: ICellRendererParams) => {
if (value === undefined) {
return (
@@ -28,7 +30,7 @@ export const AlbumArtistCell = ({ value, data }: ICellRendererParams) => {
overflow="hidden"
size="md"
>
- {value?.map((item: Artist | AlbumArtist, index: number) => (
+ {value?.map((item: AlbumArtist | Artist, index: number) => (
{index > 0 && }
{item.id ? (
diff --git a/src/renderer/components/virtual-table/cells/artist-cell.tsx b/src/renderer/components/virtual-table/cells/artist-cell.tsx
index 82a3e6ff..7a0766c1 100644
--- a/src/renderer/components/virtual-table/cells/artist-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/artist-cell.tsx
@@ -1,15 +1,17 @@
-import React from 'react';
+import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import type { ICellRendererParams } from '@ag-grid-community/core';
+
+import React from 'react';
import { generatePath } from 'react-router';
import { Link } from 'react-router-dom';
-import type { AlbumArtist, Artist } from '/@/renderer/api/types';
+
+import { Separator } from '/@/renderer/components/separator';
+import { Skeleton } from '/@/renderer/components/skeleton';
import { Text } from '/@/renderer/components/text';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
import { AppRoute } from '/@/renderer/router/routes';
-import { Skeleton } from '/@/renderer/components/skeleton';
-import { Separator } from '/@/renderer/components/separator';
-export const ArtistCell = ({ value, data }: ICellRendererParams) => {
+export const ArtistCell = ({ data, value }: ICellRendererParams) => {
if (value === undefined) {
return (
@@ -28,7 +30,7 @@ export const ArtistCell = ({ value, data }: ICellRendererParams) => {
overflow="hidden"
size="md"
>
- {value?.map((item: Artist | AlbumArtist, index: number) => (
+ {value?.map((item: AlbumArtist | Artist, index: number) => (
{index > 0 && }
{item.id ? (
diff --git a/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx b/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx
index c12b9704..7d1d146b 100644
--- a/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx
+++ b/src/renderer/components/virtual-table/cells/combined-title-cell-controls.tsx
@@ -1,13 +1,15 @@
-import React, { MouseEvent } from 'react';
import type { UnstyledButtonProps } from '@mantine/core';
+
+import React, { MouseEvent } from 'react';
import { RiPlayFill } from 'react-icons/ri';
import styled from 'styled-components';
-import { Play } from '/@/renderer/types';
-import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
-import { LibraryItem } from '/@/renderer/api/types';
-import { usePlayQueueAdd } from '/@/renderer/features/player';
-type PlayButtonType = UnstyledButtonProps & React.ComponentPropsWithoutRef<'button'>;
+import { usePlayQueueAdd } from '/@/renderer/features/player';
+import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
+import { LibraryItem } from '/@/shared/types/domain-types';
+import { Play } from '/@/shared/types/types';
+
+type PlayButtonType = React.ComponentPropsWithoutRef<'button'> & UnstyledButtonProps;
const PlayButton = styled.button`
position: absolute;
@@ -50,9 +52,9 @@ const ListConverControlsContainer = styled.div`
`;
export const ListCoverControls = ({
+ context,
itemData,
itemType,
- context,
uniqueId,
}: {
context: Record;
diff --git a/src/renderer/components/virtual-table/cells/combined-title-cell.tsx b/src/renderer/components/virtual-table/cells/combined-title-cell.tsx
index c04af2cc..cff81551 100644
--- a/src/renderer/components/virtual-table/cells/combined-title-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/combined-title-cell.tsx
@@ -1,18 +1,20 @@
-import React, { useMemo } from 'react';
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { Center } from '@mantine/core';
import { motion } from 'framer-motion';
+import React, { useMemo } from 'react';
import { RiAlbumFill } from 'react-icons/ri';
import { generatePath } from 'react-router';
import { Link } from 'react-router-dom';
import { SimpleImg } from 'react-simple-img';
import styled from 'styled-components';
-import { AlbumArtist, Artist } from '/@/renderer/api/types';
-import { Text } from '/@/renderer/components/text';
-import { AppRoute } from '/@/renderer/router/routes';
+
import { Skeleton } from '/@/renderer/components/skeleton';
-import { SEPARATOR_STRING } from '/@/renderer/api/utils';
+import { Text } from '/@/renderer/components/text';
import { ListCoverControls } from '/@/renderer/components/virtual-table/cells/combined-title-cell-controls';
+import { AppRoute } from '/@/renderer/router/routes';
+import { SEPARATOR_STRING } from '/@/shared/api/utils';
+import { AlbumArtist, Artist } from '/@/shared/types/domain-types';
const CellContainer = styled(motion.div)<{ height: number }>`
display: grid;
@@ -61,11 +63,11 @@ const StyledImage = styled(SimpleImg)`
`;
export const CombinedTitleCell = ({
- value,
- rowIndex,
- node,
context,
data,
+ node,
+ rowIndex,
+ value,
}: ICellRendererParams) => {
const artists = useMemo(() => {
if (!value) return null;
@@ -141,7 +143,7 @@ export const CombinedTitleCell = ({
size="md"
>
{artists?.length ? (
- artists.map((artist: Artist | AlbumArtist, index: number) => (
+ artists.map((artist: AlbumArtist | Artist, index: number) => (
{index > 0 ? SEPARATOR_STRING : null}
{artist.id ? (
diff --git a/src/renderer/components/virtual-table/cells/favorite-cell.tsx b/src/renderer/components/virtual-table/cells/favorite-cell.tsx
index c64cce27..1039b96a 100644
--- a/src/renderer/components/virtual-table/cells/favorite-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/favorite-cell.tsx
@@ -1,11 +1,12 @@
-/* eslint-disable import/no-cycle */
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { RiHeartFill, RiHeartLine } from 'react-icons/ri';
+
import { Button } from '/@/renderer/components/button';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
import { useCreateFavorite, useDeleteFavorite } from '/@/renderer/features/shared';
-export const FavoriteCell = ({ value, data, node }: ICellRendererParams) => {
+export const FavoriteCell = ({ data, node, value }: ICellRendererParams) => {
const createMutation = useCreateFavorite({});
const deleteMutation = useDeleteFavorite({});
@@ -49,6 +50,7 @@ export const FavoriteCell = ({ value, data, node }: ICellRendererParams) => {
diff --git a/src/renderer/components/virtual-table/cells/full-width-disc-cell.tsx b/src/renderer/components/virtual-table/cells/full-width-disc-cell.tsx
index 9ad46dcc..6c7ca970 100644
--- a/src/renderer/components/virtual-table/cells/full-width-disc-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/full-width-disc-cell.tsx
@@ -1,11 +1,12 @@
-import { useState } from 'react';
import { ICellRendererParams } from '@ag-grid-community/core';
import { Group } from '@mantine/core';
+import { useState } from 'react';
import { RiCheckboxBlankLine, RiCheckboxLine } from 'react-icons/ri';
import styled from 'styled-components';
+
import { Button } from '/@/renderer/components/button';
import { Paper } from '/@/renderer/components/paper';
-import { getNodesByDiscNumber, setNodeSelection } from '../utils';
+import { getNodesByDiscNumber, setNodeSelection } from '/@/renderer/components/virtual-table/utils';
const Container = styled(Paper)`
display: flex;
@@ -14,7 +15,7 @@ const Container = styled(Paper)`
border: 1px solid transparent;
`;
-export const FullWidthDiscCell = ({ node, data, api }: ICellRendererParams) => {
+export const FullWidthDiscCell = ({ api, data, node }: ICellRendererParams) => {
const [isSelected, setIsSelected] = useState(false);
const handleToggleDiscNodes = () => {
@@ -38,9 +39,9 @@ export const FullWidthDiscCell = ({ node, data, api }: ICellRendererParams) => {
: }
+ onClick={handleToggleDiscNodes}
size="md"
variant="subtle"
- onClick={handleToggleDiscNodes}
>
{data.name}
diff --git a/src/renderer/components/virtual-table/cells/generic-cell.tsx b/src/renderer/components/virtual-table/cells/generic-cell.tsx
index 917b42d8..82ac41a6 100644
--- a/src/renderer/components/virtual-table/cells/generic-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/generic-cell.tsx
@@ -1,10 +1,12 @@
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { Link } from 'react-router-dom';
import styled from 'styled-components';
+
import { Skeleton } from '/@/renderer/components/skeleton';
import { Text } from '/@/renderer/components/text';
-export const CellContainer = styled.div<{ $position?: 'left' | 'center' | 'right' }>`
+export const CellContainer = styled.div<{ $position?: 'center' | 'left' | 'right' }>`
display: flex;
align-items: center;
justify-content: ${(props) =>
@@ -22,13 +24,13 @@ type Options = {
array?: boolean;
isArray?: boolean;
isLink?: boolean;
- position?: 'left' | 'center' | 'right';
+ position?: 'center' | 'left' | 'right';
primary?: boolean;
};
export const GenericCell = (
{ value, valueFormatted }: ICellRendererParams,
- { position, primary, isLink }: Options,
+ { isLink, position, primary }: Options,
) => {
const displayedValue = valueFormatted || value;
@@ -69,7 +71,3 @@ export const GenericCell = (
);
};
-
-GenericCell.defaultProps = {
- position: undefined,
-};
diff --git a/src/renderer/components/virtual-table/cells/genre-cell.tsx b/src/renderer/components/virtual-table/cells/genre-cell.tsx
index 9990f2e4..93a48e48 100644
--- a/src/renderer/components/virtual-table/cells/genre-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/genre-cell.tsx
@@ -1,13 +1,15 @@
-import React from 'react';
+import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import type { ICellRendererParams } from '@ag-grid-community/core';
+
+import React from 'react';
import { generatePath, Link } from 'react-router-dom';
-import type { AlbumArtist, Artist } from '/@/renderer/api/types';
+
+import { Separator } from '/@/renderer/components/separator';
import { Text } from '/@/renderer/components/text';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
-import { Separator } from '/@/renderer/components/separator';
import { useGenreRoute } from '/@/renderer/hooks/use-genre-route';
-export const GenreCell = ({ value, data }: ICellRendererParams) => {
+export const GenreCell = ({ data, value }: ICellRendererParams) => {
const genrePath = useGenreRoute();
return (
@@ -16,7 +18,7 @@ export const GenreCell = ({ value, data }: ICellRendererParams) => {
overflow="hidden"
size="md"
>
- {value?.map((item: Artist | AlbumArtist, index: number) => (
+ {value?.map((item: AlbumArtist | Artist, index: number) => (
{index > 0 && }
{
diff --git a/src/renderer/components/virtual-table/cells/rating-cell.tsx b/src/renderer/components/virtual-table/cells/rating-cell.tsx
index 5663cf50..f1d1648f 100644
--- a/src/renderer/components/virtual-table/cells/rating-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/rating-cell.tsx
@@ -1,10 +1,10 @@
-/* eslint-disable import/no-cycle */
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { Rating } from '/@/renderer/components/rating';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
import { useSetRating } from '/@/renderer/features/shared';
-export const RatingCell = ({ value, node }: ICellRendererParams) => {
+export const RatingCell = ({ node, value }: ICellRendererParams) => {
const updateRatingMutation = useSetRating({});
const handleUpdateRating = (rating: number) => {
@@ -27,9 +27,9 @@ export const RatingCell = ({ value, node }: ICellRendererParams) => {
return (
);
diff --git a/src/renderer/components/virtual-table/cells/row-index-cell.tsx b/src/renderer/components/virtual-table/cells/row-index-cell.tsx
index 9307e788..bd18de2a 100644
--- a/src/renderer/components/virtual-table/cells/row-index-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/row-index-cell.tsx
@@ -1,4 +1,5 @@
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { Text } from '/@/renderer/components/text';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
@@ -132,7 +133,7 @@ const StaticSvg = () => {
);
};
-export const RowIndexCell = ({ value, eGridCell }: ICellRendererParams) => {
+export const RowIndexCell = ({ eGridCell, value }: ICellRendererParams) => {
const classList = eGridCell.classList;
// const isFocused = classList.contains('focused');
const isPlaying = classList.contains('playing');
diff --git a/src/renderer/components/virtual-table/cells/title-cell.tsx b/src/renderer/components/virtual-table/cells/title-cell.tsx
index 46e2c796..f48a89b8 100644
--- a/src/renderer/components/virtual-table/cells/title-cell.tsx
+++ b/src/renderer/components/virtual-table/cells/title-cell.tsx
@@ -1,4 +1,5 @@
import type { ICellRendererParams } from '@ag-grid-community/core';
+
import { Skeleton } from '/@/renderer/components/skeleton';
import { Text } from '/@/renderer/components/text';
import { CellContainer } from '/@/renderer/components/virtual-table/cells/generic-cell';
diff --git a/src/renderer/components/virtual-table/headers/duration-header.tsx b/src/renderer/components/virtual-table/headers/duration-header.tsx
index 3963e10d..bfc36d60 100644
--- a/src/renderer/components/virtual-table/headers/duration-header.tsx
+++ b/src/renderer/components/virtual-table/headers/duration-header.tsx
@@ -1,4 +1,5 @@
import type { IHeaderParams } from '@ag-grid-community/core';
+
import { FiClock } from 'react-icons/fi';
export interface ICustomHeaderParams extends IHeaderParams {
diff --git a/src/renderer/components/virtual-table/headers/generic-table-header.tsx b/src/renderer/components/virtual-table/headers/generic-table-header.tsx
index 47361306..34fde0ee 100644
--- a/src/renderer/components/virtual-table/headers/generic-table-header.tsx
+++ b/src/renderer/components/virtual-table/headers/generic-table-header.tsx
@@ -1,19 +1,21 @@
-import type { ReactNode } from 'react';
import type { IHeaderParams } from '@ag-grid-community/core';
+import type { ReactNode } from 'react';
+
import { AiOutlineNumber } from 'react-icons/ai';
import { FiClock } from 'react-icons/fi';
import { RiHeartLine, RiMoreFill, RiStarLine } from 'react-icons/ri';
import styled from 'styled-components';
-import { _Text } from '/@/renderer/components/text';
-type Presets = 'duration' | 'rowIndex' | 'userFavorite' | 'userRating' | 'actions';
+import { _Text } from '/@/renderer/components/text';
type Options = {
children?: ReactNode;
- position?: 'left' | 'center' | 'right';
+ position?: 'center' | 'left' | 'right';
preset?: Presets;
};
+type Presets = 'actions' | 'duration' | 'rowIndex' | 'userFavorite' | 'userRating';
+
export const HeaderWrapper = styled.div<{ $position: Options['position'] }>`
display: flex;
justify-content: ${(props) =>
@@ -77,7 +79,7 @@ const headerPresets = {
export const GenericTableHeader = (
{ displayName }: IHeaderParams,
- { preset, children, position }: Options,
+ { children, position, preset }: Options,
) => {
if (preset) {
return {headerPresets[preset]};
@@ -95,8 +97,3 @@ export const GenericTableHeader = (
);
};
-
-GenericTableHeader.defaultProps = {
- position: 'left',
- preset: undefined,
-};
diff --git a/src/renderer/components/virtual-table/hooks/use-click-outside-deselect.tsx b/src/renderer/components/virtual-table/hooks/use-click-outside-deselect.tsx
index 1a8f959a..b67b20f9 100644
--- a/src/renderer/components/virtual-table/hooks/use-click-outside-deselect.tsx
+++ b/src/renderer/components/virtual-table/hooks/use-click-outside-deselect.tsx
@@ -1,6 +1,7 @@
-import { MutableRefObject } from 'react';
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
+
import { useClickOutside } from '@mantine/hooks';
+import { MutableRefObject } from 'react';
export const useClickOutsideDeselect = (tableRef: MutableRefObject) => {
const handleDeselect = () => {
diff --git a/src/renderer/components/virtual-table/hooks/use-current-song-row-styles.ts b/src/renderer/components/virtual-table/hooks/use-current-song-row-styles.ts
index fba985f0..b2782b57 100644
--- a/src/renderer/components/virtual-table/hooks/use-current-song-row-styles.ts
+++ b/src/renderer/components/virtual-table/hooks/use-current-song-row-styles.ts
@@ -1,10 +1,12 @@
-import { MutableRefObject, useEffect, useMemo, useRef } from 'react';
-import { RowClassRules, RowNode } from '@ag-grid-community/core';
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
-import { Song } from '/@/renderer/api/types';
+
+import { RowClassRules, RowNode } from '@ag-grid-community/core';
+import { MutableRefObject, useEffect, useMemo, useRef } from 'react';
+
import { useAppFocus } from '/@/renderer/hooks';
import { useCurrentSong, usePlayerStore } from '/@/renderer/store';
-import { PlayerStatus } from '/@/renderer/types';
+import { Song } from '/@/shared/types/domain-types';
+import { PlayerStatus } from '/@/shared/types/types';
interface UseCurrentSongRowStylesProps {
tableRef: MutableRefObject;
diff --git a/src/renderer/components/virtual-table/hooks/use-fixed-table-header.tsx b/src/renderer/components/virtual-table/hooks/use-fixed-table-header.tsx
index 4edeb66f..6c3529b2 100644
--- a/src/renderer/components/virtual-table/hooks/use-fixed-table-header.tsx
+++ b/src/renderer/components/virtual-table/hooks/use-fixed-table-header.tsx
@@ -1,7 +1,8 @@
import { useInView } from 'framer-motion';
import { useEffect, useRef } from 'react';
+
import { useWindowSettings } from '/@/renderer/store/settings.store';
-import { Platform } from '/@/renderer/types';
+import { Platform } from '/@/shared/types/types';
export const useFixedTableHeader = ({ enabled }: { enabled: boolean }) => {
const tableHeaderRef = useRef(null);
diff --git a/src/renderer/components/virtual-table/hooks/use-virtual-table.ts b/src/renderer/components/virtual-table/hooks/use-virtual-table.ts
index e7e1be84..543a5e3f 100644
--- a/src/renderer/components/virtual-table/hooks/use-virtual-table.ts
+++ b/src/renderer/components/virtual-table/hooks/use-virtual-table.ts
@@ -1,4 +1,5 @@
-import { MutableRefObject, useCallback, useMemo } from 'react';
+import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
+
import {
BodyScrollEvent,
ColDef,
@@ -8,26 +9,27 @@ import {
PaginationChangedEvent,
RowDoubleClickedEvent,
} from '@ag-grid-community/core';
-import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
import { QueryKey, useQueryClient } from '@tanstack/react-query';
import debounce from 'lodash/debounce';
import orderBy from 'lodash/orderBy';
+import { MutableRefObject, useCallback, useMemo } from 'react';
import { generatePath, useNavigate } from 'react-router';
+import { useSearchParams } from 'react-router-dom';
+
import { api } from '/@/renderer/api';
-import { QueryPagination, queryKeys } from '/@/renderer/api/query-keys';
+import { queryKeys, QueryPagination } from '/@/renderer/api/query-keys';
+import { getColumnDefs, VirtualTableProps } from '/@/renderer/components/virtual-table';
+import { SetContextMenuItems, useHandleTableContextMenu } from '/@/renderer/features/context-menu';
+import { AppRoute } from '/@/renderer/router/routes';
+import { PersistedTableColumn, useListStoreActions } from '/@/renderer/store';
+import { ListKey, useListStoreByKey } from '/@/renderer/store/list.store';
import {
BasePaginatedResponse,
BaseQuery,
LibraryItem,
ServerListItem,
-} from '/@/renderer/api/types';
-import { getColumnDefs, VirtualTableProps } from '/@/renderer/components/virtual-table';
-import { SetContextMenuItems, useHandleTableContextMenu } from '/@/renderer/features/context-menu';
-import { AppRoute } from '/@/renderer/router/routes';
-import { useListStoreActions } from '/@/renderer/store';
-import { ListDisplayType, TablePagination } from '/@/renderer/types';
-import { useSearchParams } from 'react-router-dom';
-import { ListKey, useListStoreByKey } from '../../../store/list.store';
+} from '/@/shared/types/domain-types';
+import { ListDisplayType, TablePagination } from '/@/shared/types/types';
export type AgGridFetchFn = (
args: { filter: TFilter; limit: number; startIndex: number },
@@ -44,24 +46,24 @@ interface UseAgGridProps {
itemCount?: number;
itemType: LibraryItem;
pageKey: string;
- server: ServerListItem | null;
+ server: null | ServerListItem;
tableRef: MutableRefObject;
}
const BLOCK_SIZE = 500;
export const useVirtualTable = >({
- server,
- tableRef,
- pageKey,
- itemType,
+ columnType,
contextMenu,
- itemCount,
customFilters,
- isSearchParams,
isClientSide,
isClientSideSort,
- columnType,
+ isSearchParams,
+ itemCount,
+ itemType,
+ pageKey,
+ server,
+ tableRef,
}: UseAgGridProps) => {
const queryClient = useQueryClient();
const navigate = useNavigate();
@@ -292,7 +294,7 @@ export const useVirtualTable = >({
if (!columnsOrder) return;
const columnsInSettings = properties.table.columns;
- const updatedColumns = [];
+ const updatedColumns: PersistedTableColumn[] = [];
for (const column of columnsOrder) {
const columnInSettings = columnsInSettings.find(
(c) => c.column === column.getColDef().colId,
diff --git a/src/renderer/components/virtual-table/index.tsx b/src/renderer/components/virtual-table/index.tsx
index 42717eec..da50f408 100644
--- a/src/renderer/components/virtual-table/index.tsx
+++ b/src/renderer/components/virtual-table/index.tsx
@@ -1,58 +1,60 @@
-import { Ref, forwardRef, useRef, useEffect, useCallback, useMemo } from 'react';
import type {
- ICellRendererParams,
- ValueGetterParams,
- IHeaderParams,
- ValueFormatterParams,
ColDef,
ColumnMovedEvent,
- NewColumnsLoadedEvent,
GridReadyEvent,
GridSizeChangedEvent,
+ ICellRendererParams,
+ IHeaderParams,
ModelUpdatedEvent,
+ NewColumnsLoadedEvent,
+ ValueFormatterParams,
+ ValueGetterParams,
} from '@ag-grid-community/core';
import type { AgGridReactProps } from '@ag-grid-community/react';
-import { AgGridReact } from '@ag-grid-community/react';
import type { AgGridReact as AgGridReactType } from '@ag-grid-community/react/lib/agGridReact';
+
+import { AgGridReact } from '@ag-grid-community/react';
import { useClickOutside, useMergedRef } from '@mantine/hooks';
import formatDuration from 'format-duration';
import { AnimatePresence } from 'framer-motion';
+import { forwardRef, Ref, useCallback, useEffect, useMemo, useRef } from 'react';
import { generatePath } from 'react-router';
import styled from 'styled-components';
+
+import i18n from '/@/i18n/i18n';
+import { ActionsCell } from '/@/renderer/components/virtual-table/cells/actions-cell';
import { AlbumArtistCell } from '/@/renderer/components/virtual-table/cells/album-artist-cell';
import { ArtistCell } from '/@/renderer/components/virtual-table/cells/artist-cell';
import { CombinedTitleCell } from '/@/renderer/components/virtual-table/cells/combined-title-cell';
+import { FavoriteCell } from '/@/renderer/components/virtual-table/cells/favorite-cell';
import { GenericCell } from '/@/renderer/components/virtual-table/cells/generic-cell';
import { GenreCell } from '/@/renderer/components/virtual-table/cells/genre-cell';
+import { NoteCell } from '/@/renderer/components/virtual-table/cells/note-cell';
+import { RatingCell } from '/@/renderer/components/virtual-table/cells/rating-cell';
+import { RowIndexCell } from '/@/renderer/components/virtual-table/cells/row-index-cell';
+import { TitleCell } from '/@/renderer/components/virtual-table/cells/title-cell';
import { GenericTableHeader } from '/@/renderer/components/virtual-table/headers/generic-table-header';
+import { useFixedTableHeader } from '/@/renderer/components/virtual-table/hooks/use-fixed-table-header';
+import { TablePagination } from '/@/renderer/components/virtual-table/table-pagination';
+import { useTableChange } from '/@/renderer/hooks/use-song-change';
import { AppRoute } from '/@/renderer/router/routes';
import { PersistedTableColumn } from '/@/renderer/store/settings.store';
-import {
- PlayerStatus,
- TableColumn,
- TablePagination as TablePaginationType,
-} from '/@/renderer/types';
-import { FavoriteCell } from '/@/renderer/components/virtual-table/cells/favorite-cell';
-import { RatingCell } from '/@/renderer/components/virtual-table/cells/rating-cell';
-import { TablePagination } from '/@/renderer/components/virtual-table/table-pagination';
-import { ActionsCell } from '/@/renderer/components/virtual-table/cells/actions-cell';
-import { TitleCell } from '/@/renderer/components/virtual-table/cells/title-cell';
-import { useFixedTableHeader } from '/@/renderer/components/virtual-table/hooks/use-fixed-table-header';
-import { NoteCell } from '/@/renderer/components/virtual-table/cells/note-cell';
-import { RowIndexCell } from '/@/renderer/components/virtual-table/cells/row-index-cell';
-import i18n from '/@/i18n/i18n';
import {
formatDateAbsolute,
formatDateAbsoluteUTC,
formatDateRelative,
formatSizeString,
} from '/@/renderer/utils/format';
-import { useTableChange } from '/@/renderer/hooks/use-song-change';
+import {
+ PlayerStatus,
+ TableColumn,
+ TablePagination as TablePaginationType,
+} from '/@/shared/types/types';
+export * from './hooks/use-click-outside-deselect';
+export * from './hooks/use-fixed-table-header';
export * from './table-config-dropdown';
export * from './table-pagination';
-export * from './hooks/use-fixed-table-header';
-export * from './hooks/use-click-outside-deselect';
export * from './utils';
const TableWrapper = styled.div`
@@ -491,16 +493,16 @@ export const VirtualTable = forwardRef(
(
{
autoFitColumns,
- deselectOnClickOutside,
autoHeight,
- stickyHeader,
- transparentHeader,
+ deselectOnClickOutside,
onColumnMoved,
- onNewColumnsLoaded,
onGridReady,
onGridSizeChanged,
+ onNewColumnsLoaded,
paginationProps,
shouldUpdateSong,
+ stickyHeader,
+ transparentHeader,
...rest
}: VirtualTableProps,
ref: Ref,
@@ -584,7 +586,7 @@ export const VirtualTable = forwardRef(
[autoFitColumns],
);
- const { tableHeaderRef, tableContainerRef } = useFixedTableHeader({
+ const { tableContainerRef, tableHeaderRef } = useFixedTableHeader({
enabled: stickyHeader || false,
});
@@ -592,32 +594,32 @@ export const VirtualTable = forwardRef(
return (