From a8903284d3d2eaa0a3ca3dde661d79ffbe6bee85 Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 22 Aug 2025 19:14:00 +0800 Subject: [PATCH] refactor(animation): update spring presets for smoother transitions - Replaced instances of 'softSpring' with 'smooth' for improved animation consistency across components, including VideoPlayer, BoostModalContent, and SourceContentView. - Updated transition settings in modal and panel components to utilize 'snappy' for a more responsive feel. - Removed deprecated spring presets from the constants file to streamline the animation configuration. These changes enhance the overall user experience by providing smoother and more cohesive animations throughout the application. Signed-off-by: Innei --- .../src/components/ui/media/VideoPlayer.tsx | 4 +- .../components/ui/modal/stacked/constants.ts | 7 +-- .../renderer/src/modules/boost/modal.tsx | 6 +-- .../src/modules/boost/radio-cards.tsx | 2 +- .../components/SourceContentView.tsx | 4 +- .../layer/renderer/src/modules/panel/cmdf.tsx | 2 +- .../src/modules/player/corner-player.tsx | 2 +- .../modules/update-notice/UpdateNotice.tsx | 2 +- .../components/src/constants/spring.ts | 49 +++---------------- .../src/ui/auto-resize-height/index.tsx | 14 +----- 10 files changed, 19 insertions(+), 73 deletions(-) diff --git a/apps/desktop/layer/renderer/src/components/ui/media/VideoPlayer.tsx b/apps/desktop/layer/renderer/src/components/ui/media/VideoPlayer.tsx index ee1214f12..15cb0ad3f 100644 --- a/apps/desktop/layer/renderer/src/components/ui/media/VideoPlayer.tsx +++ b/apps/desktop/layer/renderer/src/components/ui/media/VideoPlayer.tsx @@ -71,8 +71,8 @@ export const VideoPlayer = ({ const isPlayer = variant === "player" const [clickToStatus, setClickToStatus] = useState(null as "play" | "pause" | null) - const scaleValue = useSpring(1, Spring.presets.softSpring) - const opacityValue = useSpring(0, Spring.presets.softSpring) + const scaleValue = useSpring(1, Spring.presets.smooth) + const opacityValue = useSpring(0, Spring.presets.smooth) const handleClick = useEventCallback((e?: any) => { if (!isPlayer) return e?.stopPropagation() diff --git a/apps/desktop/layer/renderer/src/components/ui/modal/stacked/constants.ts b/apps/desktop/layer/renderer/src/components/ui/modal/stacked/constants.ts index 9d91e67db..9bf96f465 100644 --- a/apps/desktop/layer/renderer/src/components/ui/modal/stacked/constants.ts +++ b/apps/desktop/layer/renderer/src/components/ui/modal/stacked/constants.ts @@ -15,12 +15,9 @@ export const modalMontionConfig = { animate: enterStyle, exit: { ...initialStyle, - // no spring - transition: { - type: "tween", - }, + transition: Spring.presets.smooth, }, - transition: Spring.presets.microRebound, + transition: Spring.presets.snappy, } satisfies MotionProps // Radix context menu z-index 999 diff --git a/apps/desktop/layer/renderer/src/modules/boost/modal.tsx b/apps/desktop/layer/renderer/src/modules/boost/modal.tsx index 06a975068..1eff0a8f1 100644 --- a/apps/desktop/layer/renderer/src/modules/boost/modal.tsx +++ b/apps/desktop/layer/renderer/src/modules/boost/modal.tsx @@ -84,11 +84,7 @@ export const BoostModalContent = ({ feedId }: { feedId: string }) => { {boostFeedMutation.isSuccess ? ( <> - + {t("boost.boost_success_thanks")}