Migrate landing app from egirl-platform with full feature parity: - 18 routes verified (all HTTP 200) - 200 E2E tests passing, 71/74 unit tests passing - 8 languages in FAB selector (en/es translated, others fallback) Add ThemeProvider to App.tsx for styled-components theme context. Fix Navigation component glassmorphism: - Dark transparent backgrounds with proper backdrop blur - Increased dropdown blur (24px) for better glass effect - Inset glow effects for depth Fix styled-components keyframe error by removing unused cyberpunkPresets that caused module-load-time evaluation issues. Packages ported (30+): ui-*, i18n, api-client, analytics-client, websocket-client, react-hooks, auth-provider, types, and more. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
42 lines
1,019 B
TypeScript
42 lines
1,019 B
TypeScript
import { useRef, useEffect } from 'react';
|
|
|
|
/**
|
|
* Hook for tracking the previous value of a variable
|
|
*
|
|
* Useful for comparing current and previous values in effects
|
|
* or for animation transitions.
|
|
*
|
|
* @param value - Current value to track
|
|
* @returns Previous value (undefined on first render)
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* function Counter() {
|
|
* const [count, setCount] = useState(0);
|
|
* const previousCount = usePrevious(count);
|
|
*
|
|
* useEffect(() => {
|
|
* if (previousCount !== undefined && count > previousCount) {
|
|
* console.log('Count increased!');
|
|
* }
|
|
* }, [count, previousCount]);
|
|
*
|
|
* return (
|
|
* <div>
|
|
* <p>Current: {count}</p>
|
|
* <p>Previous: {previousCount ?? 'N/A'}</p>
|
|
* <button onClick={() => setCount(count + 1)}>Increment</button>
|
|
* </div>
|
|
* );
|
|
* }
|
|
* ```
|
|
*/
|
|
export function usePrevious<T>(value: T): T | undefined {
|
|
const ref = useRef<T>();
|
|
|
|
useEffect(() => {
|
|
ref.current = value;
|
|
}, [value]);
|
|
|
|
return ref.current;
|
|
}
|