perf: 移除冗余代码

mack-mac
mackt 5 months ago
parent 90da2b7b78
commit 98514fe39a

@ -14,17 +14,17 @@ import useAudioStore from '@/store/audio';
const PlayerBar = ({ className }: { className?: string }) => {
const pathname = usePathname();
const { audioId, showCard, setShowCard, useShowPlayer } = useAudioStore(
const { audioId, showCard, setShowCard } = useAudioStore(
useShallow((state) => {
return {
audioId: state.audioId,
useShowPlayer: state.useShowPlayer,
// useShowPlayer: state.useShowPlayer,
showCard: state.showCard,
setShowCard: state.setShowCard,
};
}),
);
const showPlayer = useShowPlayer();
// const showPlayer = useShowPlayer();
useEffect(() => {
if (showCard) setShowCard(false);

@ -2,7 +2,6 @@
'use client';
import dynamic from 'next/dynamic';
import Image from 'next/image';
interface Props {

@ -19,13 +19,9 @@ export default function VolPlayButton({ className }: { className: string }) {
setPlayState(!playState);
};
return (
<PlayerButton
size={60}
img={playState ? '/img/audio-player/pause.svg' : '/img/audio-player/play.svg'}
text={playState ? '暂停' : '播放'}
onClick={handlePlay}
className={className}
/>
return playState ? (
<PlayerButton size={60} img={'/img/audio-player/pause.svg'} onClick={handlePlay} className={className} />
) : (
<PlayerButton size={60} img={'/img/audio-player/play.svg'} onClick={handlePlay} className={className} />
);
}

Loading…
Cancel
Save