Reduce size of song imageUrl

- Increase efficiency of loading times for song lists
This commit is contained in:
jeffvli 2023-01-06 01:03:58 -08:00
parent ab031820f6
commit 1b379882f5
3 changed files with 11 additions and 5 deletions

View file

@ -80,6 +80,12 @@ export const Sidebar = () => {
const sidebar = useSidebarStore();
const { setSidebar } = useAppStoreActions();
const imageUrl = useCurrentSong()?.imageUrl;
const upsizedImageUrl = imageUrl
?.replace(/size=\d+/, 'size=300')
.replace(/width=\d+/, 'width=300')
.replace(/height=\d+/, 'height=300');
const showImage = sidebar.image;
const handlePlayQueueAdd = usePlayQueueAdd();
const playButtonBehavior = usePlayButtonBehavior();
@ -335,10 +341,10 @@ export const Sidebar = () => {
to={AppRoute.NOW_PLAYING}
transition={{ duration: 0.3, ease: 'easeInOut' }}
>
{imageUrl ? (
{upsizedImageUrl ? (
<SidebarImage
loading="eager"
src={imageUrl}
src={upsizedImageUrl}
/>
) : (
<Center sx={{ background: 'var(--placeholder-bg)', height: '100%' }}>