Make home page modal play button use default behavior
This commit is contained in:
parent
67b8c7f1c0
commit
46fdacad81
1 changed files with 11 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ import { Badge } from '/@/renderer/components/badge';
|
||||||
import { AppRoute } from '/@/renderer/router/routes';
|
import { AppRoute } from '/@/renderer/router/routes';
|
||||||
import { usePlayQueueAdd } from '/@/renderer/features/player/hooks/use-playqueue-add';
|
import { usePlayQueueAdd } from '/@/renderer/features/player/hooks/use-playqueue-add';
|
||||||
import { Play } from '/@/renderer/types';
|
import { Play } from '/@/renderer/types';
|
||||||
|
import { usePlayButtonBehavior } from '/@/renderer/store';
|
||||||
|
|
||||||
const Carousel = styled(motion.div)`
|
const Carousel = styled(motion.div)`
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -114,6 +115,7 @@ export const FeatureCarousel = ({ data }: FeatureCarouselProps) => {
|
||||||
const handlePlayQueueAdd = usePlayQueueAdd();
|
const handlePlayQueueAdd = usePlayQueueAdd();
|
||||||
const [itemIndex, setItemIndex] = useState(0);
|
const [itemIndex, setItemIndex] = useState(0);
|
||||||
const [direction, setDirection] = useState(0);
|
const [direction, setDirection] = useState(0);
|
||||||
|
const playType = usePlayButtonBehavior();
|
||||||
|
|
||||||
const currentItem = data?.[itemIndex];
|
const currentItem = data?.[itemIndex];
|
||||||
|
|
||||||
|
|
@ -222,11 +224,18 @@ export const FeatureCarousel = ({ data }: FeatureCarouselProps) => {
|
||||||
id: [currentItem.id],
|
id: [currentItem.id],
|
||||||
type: LibraryItem.ALBUM,
|
type: LibraryItem.ALBUM,
|
||||||
},
|
},
|
||||||
playType: Play.NOW,
|
playType,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('player.play', { postProcess: 'titleCase' })}
|
{t(
|
||||||
|
playType === Play.NOW
|
||||||
|
? 'player.play'
|
||||||
|
: playType === Play.NEXT
|
||||||
|
? 'player.addNext'
|
||||||
|
: 'player.addLast',
|
||||||
|
{ postProcess: 'titleCase' },
|
||||||
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
<Group spacing="sm">
|
<Group spacing="sm">
|
||||||
<Button
|
<Button
|
||||||
|
|
|
||||||
Reference in a new issue