diff --git a/src/components/ui/animated-tooltip.tsx b/src/components/ui/animated-tooltip.tsx index 896b54e5c..05057583e 100644 --- a/src/components/ui/animated-tooltip.tsx +++ b/src/components/ui/animated-tooltip.tsx @@ -8,6 +8,7 @@ import { useMotionValue, useSpring, } from 'framer-motion'; +import { usePathname } from 'next/navigation'; export const AnimatedTooltip = ({ items, @@ -22,6 +23,8 @@ export const AnimatedTooltip = ({ expanded: any; }) => { const [hoveredIndex, setHoveredIndex] = useState(null); + const pathname = usePathname(); + const isCoursesRoute = pathname.includes('courses'); const springConfig = { stiffness: 100, damping: 5 }; const x = useMotionValue(0); // going to set this value on mouse move // rotate the tooltip @@ -36,54 +39,65 @@ export const AnimatedTooltip = ({ ); return ( <> - {items.map((item) => ( -
setHoveredIndex(item.id)} - onMouseLeave={() => setHoveredIndex(null)} - > - {!expanded && ( - - {hoveredIndex === item.id && ( - -
-
-
- {item.name} -
- - )} - - )} - { + const isActive = isCoursesRoute + ? item.name === 'My Courses' + : pathname.startsWith(item.href); + + return ( +
setHoveredIndex(item.id)} + onMouseLeave={() => setHoveredIndex(null)} > - - {expanded &&

{item.name}

} - -
- ))} + {!expanded && ( + + {hoveredIndex === item.id && ( + +
+
+
+ {item.name} +
+ + )} + + )} + + + {expanded &&

{item.name}

} + +
+ ); + })} ); }; diff --git a/tsconfig.json b/tsconfig.json index cec286f06..1f308869a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,14 +16,14 @@ "incremental": true, "plugins": [ { - "name": "next", - }, + "name": "next" + } ], "paths": { "@/*": ["./src/*"], - "@public/*": ["./public/*"], - }, + "@public/*": ["./public/*"] + } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"], + "exclude": ["node_modules"] }