mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
- Remove unused BevyScene
and related dependencies.
- Refactor `InstallButton` and relocate it to `install/`. - Update `Toolbar` imports to reflect the new `InstallButton` structure. - Introduce `handleInstall` functionality for PWA installation prompt handling.
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
import { Box, useBreakpointValue } from '@chakra-ui/react';
|
||||
import React, { memo, useEffect, useMemo } from 'react';
|
||||
|
||||
export interface BevySceneProps {
|
||||
speed?: number;
|
||||
intensity?: number; // 0-1 when visible
|
||||
glow?: boolean;
|
||||
visible?: boolean; // NEW — defaults to true
|
||||
}
|
||||
|
||||
const BevySceneInner: React.FC<BevySceneProps> = ({
|
||||
speed = 1,
|
||||
intensity = 1,
|
||||
glow = false,
|
||||
visible,
|
||||
}) => {
|
||||
const maxWidth = useBreakpointValue({ base: 640, md: 720 }, { ssr: true });
|
||||
|
||||
/* initialise once */
|
||||
useEffect(() => {
|
||||
let dispose: (() => void) | void;
|
||||
(async () => {
|
||||
const { default: init } = await import(/* webpackIgnore: true */ '/public/yachtpit.js');
|
||||
dispose = await init(); // zero-arg, uses #yachtpit-canvas
|
||||
})();
|
||||
return () => {
|
||||
if (typeof dispose === 'function') dispose();
|
||||
};
|
||||
}, []);
|
||||
|
||||
/* memoised styles */
|
||||
const wrapperStyles = useMemo(
|
||||
() => ({
|
||||
position: 'absolute' as const,
|
||||
inset: 0,
|
||||
zIndex: 1,
|
||||
maxWidth: maxWidth,
|
||||
opacity: visible ? Math.min(Math.max(intensity, 0), 1) : 0,
|
||||
filter: glow ? 'blur(1px)' : 'none',
|
||||
transition: `opacity ${speed}s ease-in-out`,
|
||||
display: visible ? 'block' : 'none', // optional: reclaim hit-testing entirely
|
||||
}),
|
||||
[visible, intensity, glow, speed],
|
||||
);
|
||||
|
||||
return (
|
||||
<Box as="div" sx={wrapperStyles}>
|
||||
<canvas
|
||||
id="yachtpit-canvas"
|
||||
width={useBreakpointValue({ base: 640, md: 1280 }, { ssr: true })}
|
||||
height={useBreakpointValue({ base: 360, md: 720 }, { ssr: true })}
|
||||
aria-hidden
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export const BevyScene = memo(BevySceneInner);
|
Reference in New Issue
Block a user