minor artist count fixes

This commit is contained in:
Kendall Garner 2025-05-07 19:53:23 -07:00
parent f03d88cd8c
commit 781d8055b5
No known key found for this signature in database
GPG key ID: 9355F387FE765C94
6 changed files with 47 additions and 18 deletions

View file

@ -2,6 +2,7 @@
import { useCallback, useState, Fragment, useRef } from 'react';
import { ActionIcon, Group, Kbd, ScrollArea } from '@mantine/core';
import { useDisclosure, useDebouncedValue } from '@mantine/hooks';
import { useTranslation } from 'react-i18next';
import { RiSearchLine, RiCloseFill } from 'react-icons/ri';
import { generatePath, useNavigate } from 'react-router';
import styled from 'styled-components';
@ -37,6 +38,7 @@ export const CommandPalette = ({ modalProps }: CommandPaletteProps) => {
const activePage = pages[pages.length - 1];
const isHome = activePage === CommandPalettePages.HOME;
const searchInputRef = useRef<HTMLInputElement>(null);
const { t } = useTranslation();
const popPage = useCallback(() => {
setPages((pages) => {
@ -187,13 +189,17 @@ export const CommandPalette = ({ modalProps }: CommandPaletteProps) => {
}}
>
<LibraryCommandItem
disabled={artist?.albumCount === 0}
handlePlayQueueAdd={handlePlayQueueAdd}
id={artist.id}
imageUrl={artist.imageUrl}
itemType={LibraryItem.ALBUM_ARTIST}
subtitle={
(artist?.albumCount || 0) > 0
? `${artist.albumCount} albums`
artist?.albumCount !== undefined &&
artist?.albumCount !== null
? t('entity.albumWithCount', {
count: artist.albumCount,
})
: undefined
}
title={artist.name}

View file

@ -53,6 +53,7 @@ const StyledImage = styled.img`
const ActionsContainer = styled(Flex)``;
interface LibraryCommandItemProps {
disabled?: boolean;
handlePlayQueueAdd?: (options: PlayQueueAddOptions) => void;
id: string;
imageUrl: string | null;
@ -62,6 +63,7 @@ interface LibraryCommandItemProps {
}
export const LibraryCommandItem = ({
disabled,
id,
imageUrl,
subtitle,
@ -154,6 +156,7 @@ export const LibraryCommandItem = ({
>
<Button
compact
disabled={disabled}
size="md"
tooltip={{
label: t('player.play', { postProcess: 'sentenceCase' }),
@ -166,6 +169,7 @@ export const LibraryCommandItem = ({
</Button>
<Button
compact
disabled={disabled}
size="md"
tooltip={{
label: t('player.addLast', { postProcess: 'sentenceCase' }),
@ -179,6 +183,7 @@ export const LibraryCommandItem = ({
</Button>
<Button
compact
disabled={disabled}
size="md"
tooltip={{
label: t('player.addNext', { postProcess: 'sentenceCase' }),