From 43569b25466aa9bcf19f0f78c6ccd0928c98ab05 Mon Sep 17 00:00:00 2001
From: Sophie Zhang <sophie_zhang@brown.edu>
Date: Wed, 10 Apr 2024 15:26:32 -0400
Subject: fix: naming, cleaning

---
 src/client/views/nodes/trails/SlideEffect.tsx | 44 ++++++++++-----------------
 1 file changed, 16 insertions(+), 28 deletions(-)

(limited to 'src/client/views/nodes/trails/SlideEffect.tsx')

diff --git a/src/client/views/nodes/trails/SlideEffect.tsx b/src/client/views/nodes/trails/SlideEffect.tsx
index 7e2985a6a..e3423069b 100644
--- a/src/client/views/nodes/trails/SlideEffect.tsx
+++ b/src/client/views/nodes/trails/SlideEffect.tsx
@@ -1,18 +1,10 @@
-import { Button } from '@mui/material';
 import { useSpring, animated, easings, to } from '@react-spring/web';
 import React, { useEffect, useState } from 'react';
-import { PresEffectDirection } from './PresEnums';
-
-export enum EffectType {
-    ZOOM = 'zoom',
-    FADE = 'fade',
-    BOUNCE = 'bounce',
-    ROTATE = 'rotate',
-}
+import { PresEffect, PresEffectDirection } from './PresEnums';
 
 interface Props {
     dir: PresEffectDirection;
-    effectType: EffectType;
+    presEffect: PresEffect;
     friction: number;
     tension: number;
     mass: number;
@@ -20,7 +12,7 @@ interface Props {
 }
 
 // TODO: add visibility detector when the slide comes into view
-export default function SpringAnimation({ dir, friction, tension, mass, effectType, children }: Props) {
+export default function SpringAnimation({ dir, friction, tension, mass, presEffect: presEffect, children }: Props) {
     const [springs, api] = useSpring(
         () => ({
             from: {
@@ -53,14 +45,12 @@ export default function SpringAnimation({ dir, friction, tension, mass, effectTy
             x: 0,
             y: 0,
             opacity: 1,
-            // opacity: 0,
         },
         to: {
             scale: 1,
             x: 0,
             y: 0,
             opacity: 1,
-            // opacity: 1,
             config: {
                 tension: tension,
                 friction: friction,
@@ -164,36 +154,34 @@ export default function SpringAnimation({ dir, friction, tension, mass, effectTy
         ],
     };
 
-    const handleClick = () => {
-        if (effectType === EffectType.BOUNCE) {
+    const flipConfig = {};
+
+    const startAnimation = () => {
+        if (presEffect === PresEffect.Bounce) {
             api.start(bounceConfig);
-        } else if (effectType === EffectType.ZOOM) {
+        } else if (presEffect === PresEffect.Zoom) {
             api.start(zoomConfig);
-        } else if (effectType === EffectType.ROTATE) {
+        } else if (presEffect === PresEffect.Rotate) {
             api.start(rotateConfig);
-        } else if (effectType === EffectType.FADE) {
+        } else if (presEffect === PresEffect.Fade) {
             api.start(fadeConfig);
         }
     };
 
+    const flipRender = () => {};
+
     useEffect(() => {
+        // TODO: Control start with slide visibility instead
         setTimeout(() => {
-            handleClick();
+            startAnimation();
         }, 200);
     }, []);
 
     return (
-        <div
-        // className="demo"
-        // onPointerEnter={() => {
-        //     handleClick();
-        // }}
-        >
-            {effectType !== EffectType.ROTATE ? (
+        <div>
+            {presEffect !== PresEffect.Rotate ? (
                 <animated.div
                     style={{
-                        // display: 'inline-block',
-                        // transform: 'translate(50px, 50px)',
                         ...springs,
                     }}>
                     {children}
-- 
cgit v1.2.3-70-g09d2

