diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json old mode 100755 new mode 100644 index a8ee4330a..8e8a9fe63 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -1131,6 +1131,7 @@ "label": { "actions": "$t(common.action, {\"count\": 2})", "album": "$t(entity.album, {\"count\": 1})", + "albumGroup": "album group", "albumCount": "$t(entity.album, {\"count\": 2})", "albumArtist": "$t(entity.albumArtist, {\"count\": 1})", "artist": "$t(entity.artist, {\"count\": 1})", diff --git a/src/renderer/components/item-list/helpers/use-grid-rows.ts b/src/renderer/components/item-list/helpers/use-grid-rows.ts index 4a9c05188..ca1160f6b 100644 --- a/src/renderer/components/item-list/helpers/use-grid-rows.ts +++ b/src/renderer/components/item-list/helpers/use-grid-rows.ts @@ -49,6 +49,7 @@ const getRowIdFromTableColumn = (tableColumn: TableColumn): null | string => { [TableColumn.ALBUM]: 'album', [TableColumn.ALBUM_ARTIST]: 'albumArtists', [TableColumn.ALBUM_COUNT]: 'albumCount', + [TableColumn.ALBUM_GROUP]: null, [TableColumn.ARTIST]: 'artists', [TableColumn.BIOGRAPHY]: null, [TableColumn.BIT_DEPTH]: 'bitDepth', diff --git a/src/renderer/components/item-list/item-table-list/album-group-header.module.css b/src/renderer/components/item-list/item-table-list/album-group-header.module.css new file mode 100644 index 000000000..90203d8b2 --- /dev/null +++ b/src/renderer/components/item-list/item-table-list/album-group-header.module.css @@ -0,0 +1,33 @@ +.container { + display: flex; + gap: var(--theme-spacing-sm); + width: 100%; + height: 100%; + padding: 0 var(--theme-spacing-xs); +} + +.image-container { + position: relative; + box-sizing: border-box; + flex-shrink: 0; + height: 100%; + aspect-ratio: 1; + padding-top: calc(var(--theme-spacing-xs) * 0.5); +} + +.info { + display: flex; + flex-direction: column; + min-width: 0; + padding: 0; + overflow: hidden; +} + +.album-name { + font-size: var(--theme-font-size-sm); +} + +.artist-name { + font-size: var(--theme-font-size-xs); + opacity: 0.7; +} diff --git a/src/renderer/components/item-list/item-table-list/album-group-header.tsx b/src/renderer/components/item-list/item-table-list/album-group-header.tsx new file mode 100644 index 000000000..9ca91f9f8 --- /dev/null +++ b/src/renderer/components/item-list/item-table-list/album-group-header.tsx @@ -0,0 +1,79 @@ +import { ReactElement, useState } from 'react'; + +import imageColumnStyles from '../item-detail-list/columns/image-column.module.css'; +import styles from './album-group-header.module.css'; +import { TableItemSize } from './item-table-list'; + +import { ItemImage } from '/@/renderer/components/item-image/item-image'; +import { PlayButton } from '/@/renderer/features/shared/components/play-button'; +import { + LONG_PRESS_PLAY_BEHAVIOR, + PlayTooltip, +} from '/@/renderer/features/shared/components/play-button-group'; +import { usePlayButtonBehavior } from '/@/renderer/store'; +import { LibraryItem, Song } from '/@/shared/types/domain-types'; +import { Play } from '/@/shared/types/types'; + +interface AlbumGroupHeaderProps { + groupRowCount?: number; + onPlay?: (playType: Play) => void; + size?: 'compact' | 'large' | 'normal'; + song: Song | undefined; +} + +export const AlbumGroupHeader = ({ + groupRowCount, + onPlay, + size = 'normal', + song, +}: AlbumGroupHeaderProps): ReactElement => { + const [isHovered, setIsHovered] = useState(false); + const playButtonBehavior = usePlayButtonBehavior(); + const rowHeight = { + compact: TableItemSize.COMPACT, + large: TableItemSize.LARGE, + normal: TableItemSize.DEFAULT, + }[size]; + const infoHeight = groupRowCount !== undefined ? groupRowCount * rowHeight : undefined; + + return ( +