mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-19 18:04:22 +02:00
fix sidebar image animate out
This commit is contained in:
@@ -59,6 +59,7 @@ export const Sidebar = () => {
|
|||||||
|
|
||||||
const { sidebarItems } = useGeneralSettings();
|
const { sidebarItems } = useGeneralSettings();
|
||||||
const { windowBarStyle } = useWindowSettings();
|
const { windowBarStyle } = useWindowSettings();
|
||||||
|
const showImage = useAppStore((state) => state.sidebar.image);
|
||||||
|
|
||||||
const sidebarItemsWithRoute: SidebarItemType[] = useMemo(() => {
|
const sidebarItemsWithRoute: SidebarItemType[] = useMemo(() => {
|
||||||
if (!sidebarItems) return [];
|
if (!sidebarItems) return [];
|
||||||
@@ -131,17 +132,18 @@ export const Sidebar = () => {
|
|||||||
)}
|
)}
|
||||||
</Accordion>
|
</Accordion>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
<motion.div className={styles.serverSelectorWrapper} layout>
|
<AnimatePresence initial={false} mode="popLayout">
|
||||||
|
<motion.div className={styles.serverSelectorWrapper} key="server-selector" layout>
|
||||||
<ServerSelector />
|
<ServerSelector />
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<SidebarImage />
|
{showImage && <SidebarImage />}
|
||||||
|
</AnimatePresence>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const SidebarImage = () => {
|
const SidebarImage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const showImage = useAppStore((state) => state.sidebar.image);
|
|
||||||
const leftWidth = useAppStore((state) => state.sidebar.leftWidth);
|
const leftWidth = useAppStore((state) => state.sidebar.leftWidth);
|
||||||
const { setSideBar } = useAppStoreActions();
|
const { setSideBar } = useAppStoreActions();
|
||||||
const currentSong = usePlayerSong();
|
const currentSong = usePlayerSong();
|
||||||
@@ -176,8 +178,6 @@ const SidebarImage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence initial={false} mode="popLayout">
|
|
||||||
{showImage && (
|
|
||||||
<motion.div
|
<motion.div
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
className={styles.imageContainer}
|
className={styles.imageContainer}
|
||||||
@@ -201,11 +201,7 @@ const SidebarImage = () => {
|
|||||||
openDelay={500}
|
openDelay={500}
|
||||||
>
|
>
|
||||||
{upsizedImageUrl ? (
|
{upsizedImageUrl ? (
|
||||||
<img
|
<img className={styles.sidebarImage} loading="eager" src={upsizedImageUrl} />
|
||||||
className={styles.sidebarImage}
|
|
||||||
loading="eager"
|
|
||||||
src={upsizedImageUrl}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<ImageUnloader />
|
<ImageUnloader />
|
||||||
)}
|
)}
|
||||||
@@ -235,7 +231,5 @@ const SidebarImage = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)}
|
|
||||||
</AnimatePresence>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user