diff --git a/src/components/common/ListItem.tsx b/src/components/common/ListItem.tsx index 16eaf01..b187f96 100644 --- a/src/components/common/ListItem.tsx +++ b/src/components/common/ListItem.tsx @@ -1,7 +1,6 @@ -import React, { forwardRef, useMemo } from 'react'; +import React, { forwardRef } from 'react'; import { IonItem, IonLabel, IonIcon } from '@ionic/react'; import { chevronForward } from 'ionicons/icons'; -import type { Song } from '../../types'; import { NumberDisplay } from './NumberDisplay'; // Generic ListItem interface for different types of data @@ -22,27 +21,6 @@ interface GenericListItemProps { showSeparator?: boolean; } -// Song-specific ListItem interface -interface SongListItemProps { - song: Song; - onClick?: () => void; - showPath?: boolean; - showCount?: boolean; - showChevron?: boolean; - className?: string; - children?: React.ReactNode; -} - -// Utility function to extract filename from path -const extractFilename = (path: string): string => { - if (!path) return ''; - - // Handle different path separators (Windows backslash, Unix forward slash) - const normalizedPath = path.replace(/\\/g, '/'); - const parts = normalizedPath.split('/'); - return parts[parts.length - 1] || ''; -}; - // Generic ListItem component for different types of data export const ListItem = React.memo(forwardRef(({ primaryText, @@ -104,89 +82,6 @@ export const ListItem = React.memo(forwardRef(({ - song, - onClick, - showPath = false, - showCount = false, - showChevron = false, - className = '', - children -}, ref) => { - // Memoize the filename extraction - const filename = useMemo(() => extractFilename(song.path), [song.path]); - - return ( - - -
- {song.title} -
-
- {song.artist} -
- {/* Show filename if showPath is true */} - {showPath && song.path && ( -
- {filename} -
- )} - {/* Show play count if showCount is true */} - {showCount && song.count && ( -
- Played {song.count} times -
- )} -
- - {children} - - {showChevron && ( - - )} -
- ); -})); - ListItem.displayName = 'ListItem'; -SongListItem.displayName = 'SongListItem'; export default ListItem; \ No newline at end of file