[#2] Sidemenu for touchscreen devices
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 5s
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 5s
This commit is contained in:
@@ -106,9 +106,6 @@ export const Buttons = ({
|
|||||||
: 0,
|
: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const printerMenuSpring = useThreeSpring<MeshStandardMaterial>({
|
|
||||||
opacity: currentView === View.PrinterView ? 1 : 0,
|
|
||||||
});
|
|
||||||
const desktopViewSpring = useThreeSpring<BufferGeometry>({
|
const desktopViewSpring = useThreeSpring<BufferGeometry>({
|
||||||
scale: hovered === View.DesktopView ? 1.25 : 1,
|
scale: hovered === View.DesktopView ? 1.25 : 1,
|
||||||
});
|
});
|
||||||
@@ -398,45 +395,6 @@ export const Buttons = ({
|
|||||||
/>
|
/>
|
||||||
</animated.mesh>
|
</animated.mesh>
|
||||||
</group>
|
</group>
|
||||||
{/* Printer Menu */}
|
|
||||||
<group>
|
|
||||||
<Billboard position={[-3.25, 6.65, -2.75]}>
|
|
||||||
<AnimatedText
|
|
||||||
maxWidth={4.5}
|
|
||||||
font="/assets/inter.ttf"
|
|
||||||
fontSize={0.25}
|
|
||||||
outlineWidth={1 / 60}
|
|
||||||
fillOpacity={printerMenuSpring.opacity}
|
|
||||||
outlineOpacity={printerMenuSpring.opacity}
|
|
||||||
>
|
|
||||||
CAD and 3D printing
|
|
||||||
</AnimatedText>
|
|
||||||
</Billboard>
|
|
||||||
<Billboard position={[-2.75, 5.25, -2.25]}>
|
|
||||||
<AnimatedText
|
|
||||||
maxWidth={3}
|
|
||||||
textAlign="center"
|
|
||||||
font="/assets/inter.ttf"
|
|
||||||
fontSize={0.25}
|
|
||||||
outlineWidth={1 / 60}
|
|
||||||
fillOpacity={printerMenuSpring.opacity}
|
|
||||||
outlineOpacity={printerMenuSpring.opacity}
|
|
||||||
>
|
|
||||||
Building with electronics
|
|
||||||
</AnimatedText>
|
|
||||||
</Billboard>
|
|
||||||
<Billboard position={[-5.5, 3.175, -3]}>
|
|
||||||
<AnimatedText
|
|
||||||
font="/assets/inter.ttf"
|
|
||||||
fontSize={0.25}
|
|
||||||
outlineWidth={1 / 60}
|
|
||||||
fillOpacity={printerMenuSpring.opacity}
|
|
||||||
outlineOpacity={printerMenuSpring.opacity}
|
|
||||||
>
|
|
||||||
Gaming
|
|
||||||
</AnimatedText>
|
|
||||||
</Billboard>
|
|
||||||
</group>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { SpotLight } from "three";
|
import { MeshStandardMaterial, SpotLight } from "three";
|
||||||
import {
|
import {
|
||||||
useGLTF,
|
useGLTF,
|
||||||
PerspectiveCamera,
|
PerspectiveCamera,
|
||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
Html,
|
Html,
|
||||||
type PerspectiveCameraProps,
|
type PerspectiveCameraProps,
|
||||||
PerformanceMonitor,
|
PerformanceMonitor,
|
||||||
|
Billboard,
|
||||||
} from "@react-three/drei";
|
} from "@react-three/drei";
|
||||||
import {
|
import {
|
||||||
animated as threeAnimated,
|
animated as threeAnimated,
|
||||||
@@ -29,6 +30,7 @@ import {
|
|||||||
} from "react";
|
} from "react";
|
||||||
import round from "lodash/round";
|
import round from "lodash/round";
|
||||||
import Stack from "@/util/stack";
|
import Stack from "@/util/stack";
|
||||||
|
import isMobile from "@/util/isMobile";
|
||||||
import { Canvas } from "@react-three/fiber";
|
import { Canvas } from "@react-three/fiber";
|
||||||
import { mdiArrowLeftBold } from "@mdi/js";
|
import { mdiArrowLeftBold } from "@mdi/js";
|
||||||
import { Icon } from "@mdi/react";
|
import { Icon } from "@mdi/react";
|
||||||
@@ -45,7 +47,9 @@ import { isWebGL2Available } from "@react-three/drei";
|
|||||||
import { useWindowSize } from "../hooks/useWindowSize";
|
import { useWindowSize } from "../hooks/useWindowSize";
|
||||||
import { Info } from "../util/Info";
|
import { Info } from "../util/Info";
|
||||||
import { Loader } from "../ui/Loader";
|
import { Loader } from "../ui/Loader";
|
||||||
|
import { MobileMenu } from "../ui/MobileMenu";
|
||||||
|
|
||||||
|
const AnimatedText = threeAnimated(Text);
|
||||||
const AnimatedCam = threeAnimated(PerspectiveCamera);
|
const AnimatedCam = threeAnimated(PerspectiveCamera);
|
||||||
const AnimatedButton = webAnimated.button as React.ComponentType<
|
const AnimatedButton = webAnimated.button as React.ComponentType<
|
||||||
React.ButtonHTMLAttributes<HTMLButtonElement> & { children?: React.ReactNode }
|
React.ButtonHTMLAttributes<HTMLButtonElement> & { children?: React.ReactNode }
|
||||||
@@ -55,6 +59,7 @@ export function Scene(props: JSX.IntrinsicElements["group"]) {
|
|||||||
const { nodes, materials } = useGLTF("/scene.glb") as unknown as GLTFResult;
|
const { nodes, materials } = useGLTF("/scene.glb") as unknown as GLTFResult;
|
||||||
const { width, height } = useWindowSize();
|
const { width, height } = useWindowSize();
|
||||||
const config = useConfig();
|
const config = useConfig();
|
||||||
|
const mobile = isMobile();
|
||||||
|
|
||||||
// States
|
// States
|
||||||
const [fps, setFps] = useState(0);
|
const [fps, setFps] = useState(0);
|
||||||
@@ -116,6 +121,10 @@ export function Scene(props: JSX.IntrinsicElements["group"]) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const printerMenuSpring = useThreeSpring<MeshStandardMaterial>({
|
||||||
|
opacity: currentView === View.PrinterView ? 1 : 0,
|
||||||
|
});
|
||||||
|
|
||||||
const { backScale, backOpacity } = useWebSpring({
|
const { backScale, backOpacity } = useWebSpring({
|
||||||
backScale: backHovered ? 1.25 : 1,
|
backScale: backHovered ? 1.25 : 1,
|
||||||
backOpacity: menuTraversal.size() > 1 ? 1 : 0,
|
backOpacity: menuTraversal.size() > 1 ? 1 : 0,
|
||||||
@@ -130,30 +139,41 @@ export function Scene(props: JSX.IntrinsicElements["group"]) {
|
|||||||
<>
|
<>
|
||||||
<Loader />
|
<Loader />
|
||||||
<div className="pointer-events-none fixed z-[999999999] size-full">
|
<div className="pointer-events-none fixed z-[999999999] size-full">
|
||||||
<AnimatedButton
|
{mobile ? (
|
||||||
style={{
|
<MobileMenu
|
||||||
transform: backScale.to(
|
menuTraversal={menuTraversal}
|
||||||
(s) => `scale(${s})`
|
setMenuTraversal={setMenuTraversal}
|
||||||
) as unknown as string,
|
pendingView={pendingView}
|
||||||
opacity: backOpacity as unknown as number,
|
setPendingView={setPendingView}
|
||||||
pointerEvents: menuTraversal.size() > 1 ? "auto" : "none",
|
goPreviousView={goPreviousView}
|
||||||
cursor: backHovered ? "pointer" : "auto",
|
currentView={currentView}
|
||||||
}}
|
|
||||||
className="m-4"
|
|
||||||
onMouseEnter={() => setBackHovered(true)}
|
|
||||||
onMouseLeave={() => setBackHovered(false)}
|
|
||||||
onClick={() => {
|
|
||||||
setBackClicked(true);
|
|
||||||
goPreviousView();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
path={mdiArrowLeftBold}
|
|
||||||
size={2}
|
|
||||||
color="white"
|
|
||||||
className="stroke-[0.75] stroke-black"
|
|
||||||
/>
|
/>
|
||||||
</AnimatedButton>
|
) : (
|
||||||
|
<AnimatedButton
|
||||||
|
style={{
|
||||||
|
transform: backScale.to(
|
||||||
|
(s) => `scale(${s})`
|
||||||
|
) as unknown as string,
|
||||||
|
opacity: backOpacity as unknown as number,
|
||||||
|
pointerEvents: menuTraversal.size() > 1 ? "auto" : "none",
|
||||||
|
cursor: backHovered ? "pointer" : "auto",
|
||||||
|
}}
|
||||||
|
className="m-2"
|
||||||
|
onMouseEnter={() => setBackHovered(true)}
|
||||||
|
onMouseLeave={() => setBackHovered(false)}
|
||||||
|
onClick={() => {
|
||||||
|
setBackClicked(true);
|
||||||
|
goPreviousView();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
path={mdiArrowLeftBold}
|
||||||
|
size={2}
|
||||||
|
color="white"
|
||||||
|
className="stroke-[0.75] stroke-black"
|
||||||
|
/>
|
||||||
|
</AnimatedButton>
|
||||||
|
)}
|
||||||
<div className="min-w-12 text-white bottom-0 right-0 absolute m-3 p-1 text-xs text-right text-stroke-2 text-stroke-black paint-sfm">
|
<div className="min-w-12 text-white bottom-0 right-0 absolute m-3 p-1 text-xs text-right text-stroke-2 text-stroke-black paint-sfm">
|
||||||
<Info />
|
<Info />
|
||||||
{fps > 0 && (
|
{fps > 0 && (
|
||||||
@@ -179,14 +199,16 @@ export function Scene(props: JSX.IntrinsicElements["group"]) {
|
|||||||
>
|
>
|
||||||
<Environment preset="apartment" />
|
<Environment preset="apartment" />
|
||||||
<AnimatedCam makeDefault {...cameraSpring} />
|
<AnimatedCam makeDefault {...cameraSpring} />
|
||||||
<Buttons
|
{!mobile && (
|
||||||
menuTraversal={menuTraversal}
|
<Buttons
|
||||||
setMenuTraversal={setMenuTraversal}
|
menuTraversal={menuTraversal}
|
||||||
pendingView={pendingView}
|
setMenuTraversal={setMenuTraversal}
|
||||||
setPendingView={setPendingView}
|
pendingView={pendingView}
|
||||||
goPreviousView={goPreviousView}
|
setPendingView={setPendingView}
|
||||||
currentView={currentView}
|
goPreviousView={goPreviousView}
|
||||||
/>
|
currentView={currentView}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<group>
|
<group>
|
||||||
<primitive
|
<primitive
|
||||||
object={spotlight}
|
object={spotlight}
|
||||||
@@ -359,6 +381,44 @@ export function Scene(props: JSX.IntrinsicElements["group"]) {
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
<StaticMeshes nodes={nodes} materials={materials} />
|
<StaticMeshes nodes={nodes} materials={materials} />
|
||||||
|
<group>
|
||||||
|
<Billboard position={[-3.25, 6.65, -2.75]}>
|
||||||
|
<AnimatedText
|
||||||
|
maxWidth={4.5}
|
||||||
|
font="/assets/inter.ttf"
|
||||||
|
fontSize={0.25}
|
||||||
|
outlineWidth={1 / 60}
|
||||||
|
fillOpacity={printerMenuSpring.opacity}
|
||||||
|
outlineOpacity={printerMenuSpring.opacity}
|
||||||
|
>
|
||||||
|
CAD and 3D printing
|
||||||
|
</AnimatedText>
|
||||||
|
</Billboard>
|
||||||
|
<Billboard position={[-2.75, 5.25, -2.25]}>
|
||||||
|
<AnimatedText
|
||||||
|
maxWidth={3}
|
||||||
|
textAlign="center"
|
||||||
|
font="/assets/inter.ttf"
|
||||||
|
fontSize={0.25}
|
||||||
|
outlineWidth={1 / 60}
|
||||||
|
fillOpacity={printerMenuSpring.opacity}
|
||||||
|
outlineOpacity={printerMenuSpring.opacity}
|
||||||
|
>
|
||||||
|
Building with electronics
|
||||||
|
</AnimatedText>
|
||||||
|
</Billboard>
|
||||||
|
<Billboard position={[-5.5, 3.175, -3]}>
|
||||||
|
<AnimatedText
|
||||||
|
font="/assets/inter.ttf"
|
||||||
|
fontSize={0.25}
|
||||||
|
outlineWidth={1 / 60}
|
||||||
|
fillOpacity={printerMenuSpring.opacity}
|
||||||
|
outlineOpacity={printerMenuSpring.opacity}
|
||||||
|
>
|
||||||
|
Gaming
|
||||||
|
</AnimatedText>
|
||||||
|
</Billboard>
|
||||||
|
</group>
|
||||||
</PerformanceMonitor>
|
</PerformanceMonitor>
|
||||||
</group>
|
</group>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|||||||
@@ -2,88 +2,89 @@
|
|||||||
|
|
||||||
import { useProgress } from "@react-three/drei";
|
import { useProgress } from "@react-three/drei";
|
||||||
import { animated, useSpring, useTransition } from "@react-spring/web";
|
import { animated, useSpring, useTransition } from "@react-spring/web";
|
||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
export const Loader = ({ minDuration = 750, fadeMs = 600 }) => {
|
export const Loader = ({ minDuration = 750, fadeMs = 600 }) => {
|
||||||
const { progress } = useProgress();
|
const [barDone, setBarDone] = useState(false);
|
||||||
const [loadedAt, setLoadedAt] = useState<number | null>(null);
|
const barStyles = useSpring({
|
||||||
|
|
||||||
const maxSeen = useRef(0);
|
|
||||||
if (progress > maxSeen.current) maxSeen.current = progress;
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (maxSeen.current === 100 && loadedAt === null) setLoadedAt(Date.now());
|
|
||||||
}, [loadedAt]);
|
|
||||||
|
|
||||||
const visible =
|
|
||||||
loadedAt === null || Date.now() - loadedAt < minDuration + fadeMs;
|
|
||||||
|
|
||||||
const barSpring = useSpring({
|
|
||||||
from: { width: "0%" },
|
from: { width: "0%" },
|
||||||
to: { width: "100%" },
|
to: { width: "100%" },
|
||||||
config: { duration: minDuration },
|
config: { duration: minDuration },
|
||||||
|
onRest: () => setBarDone(true),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { progress } = useProgress();
|
||||||
|
const [assetsDone, setAssetsDone] = useState(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (progress === 100) setAssetsDone(true);
|
||||||
|
}, [progress]);
|
||||||
|
|
||||||
|
const [visible, setVisible] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (barDone && assetsDone) {
|
||||||
|
const id = setTimeout(() => setVisible(false), fadeMs);
|
||||||
|
return () => clearTimeout(id);
|
||||||
|
}
|
||||||
|
}, [barDone, assetsDone, fadeMs]);
|
||||||
|
|
||||||
const overlay = useTransition(visible, {
|
const overlay = useTransition(visible, {
|
||||||
from: { opacity: 1 },
|
from: { opacity: 1 },
|
||||||
enter: { opacity: 1 },
|
|
||||||
leave: { opacity: 0 },
|
leave: { opacity: 0 },
|
||||||
config: { duration: fadeMs, easing: (t) => Math.pow(t, 2) },
|
config: { duration: fadeMs, easing: (t) => t * t },
|
||||||
});
|
});
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
overlay(
|
overlay(
|
||||||
(styles, show) =>
|
(styles, show) =>
|
||||||
show && (
|
show && (
|
||||||
// @ts-expect-error children not typed bug
|
<div>
|
||||||
<animated.div
|
{/* @ts-expect-error children not typed bug */}
|
||||||
style={{
|
<animated.div
|
||||||
...styles,
|
|
||||||
position: "fixed",
|
|
||||||
inset: 0,
|
|
||||||
background: "#1b1b1b",
|
|
||||||
zIndex: 999999999,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
gap: "1.5rem",
|
|
||||||
fontSize: "2.25rem",
|
|
||||||
color: "white",
|
|
||||||
pointerEvents: "none",
|
|
||||||
paddingTop: "2.5rem",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<p>Loading…</p>
|
|
||||||
|
|
||||||
<div
|
|
||||||
style={{
|
style={{
|
||||||
width: 192,
|
...styles,
|
||||||
height: 16,
|
position: "fixed",
|
||||||
background: "#4b4b4b",
|
inset: 0,
|
||||||
borderRadius: 8,
|
background: "#1b1b1b",
|
||||||
overflow: "hidden",
|
zIndex: 1e9,
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
gap: "1.5rem",
|
||||||
|
fontSize: "2.25rem",
|
||||||
|
color: "#fff",
|
||||||
|
pointerEvents: "none",
|
||||||
|
paddingTop: "2.5rem",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* @ts-expect-error children not typed bug */}
|
<p>Loading…</p>
|
||||||
<animated.div
|
|
||||||
|
<div
|
||||||
style={{
|
style={{
|
||||||
...barSpring,
|
width: 192,
|
||||||
height: "100%",
|
height: 16,
|
||||||
background: "#ffffff",
|
background: "#4b4b4b",
|
||||||
|
borderRadius: 8,
|
||||||
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* @ts-expect-error children not typed bug */}
|
{/* @ts-expect-error children not typed bug */}
|
||||||
<animated.div className="text-[#1b1b1b] text-xs justify-center flex items-center h-full">
|
<animated.div
|
||||||
{barSpring.width.to((w) => {
|
style={{ ...barStyles, height: "100%", background: "#fff" }}
|
||||||
const p = parseInt(w) || 0;
|
>
|
||||||
return `${p > 5 ? p : ""}`;
|
{/* @ts-expect-error children not typed bug */}
|
||||||
})}
|
<animated.div className="text-[#1b1b1b] text-xs flex h-full items-center justify-center">
|
||||||
|
{barStyles.width.to((w) => {
|
||||||
|
const p = parseInt(w) || 0;
|
||||||
|
return p > 5 ? p : "";
|
||||||
|
})}
|
||||||
|
</animated.div>
|
||||||
</animated.div>
|
</animated.div>
|
||||||
</animated.div>
|
</div>
|
||||||
</div>
|
</animated.div>
|
||||||
</animated.div>
|
</div>
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
document.body
|
document.body
|
||||||
|
|||||||
113
src/components/ui/MobileMenu.tsx
Normal file
113
src/components/ui/MobileMenu.tsx
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
import type Stack from "@/util/stack";
|
||||||
|
import {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useState,
|
||||||
|
type Dispatch,
|
||||||
|
type SetStateAction,
|
||||||
|
} from "react";
|
||||||
|
import { View, viewToHash } from "../scene/consts";
|
||||||
|
import { animated, useSpring } from "@react-spring/web";
|
||||||
|
import Icon from "@mdi/react";
|
||||||
|
import { mdiMenu } from "@mdi/js";
|
||||||
|
|
||||||
|
interface MobileMenuProps {
|
||||||
|
menuTraversal: Stack<View>;
|
||||||
|
setMenuTraversal: Dispatch<SetStateAction<Stack<View>>>;
|
||||||
|
pendingView: View | null;
|
||||||
|
setPendingView: Dispatch<SetStateAction<View | null>>;
|
||||||
|
goPreviousView(): void;
|
||||||
|
currentView: View;
|
||||||
|
}
|
||||||
|
|
||||||
|
const AnimatedButton = animated.button as React.ComponentType<
|
||||||
|
React.ButtonHTMLAttributes<HTMLButtonElement> & { children?: React.ReactNode }
|
||||||
|
>;
|
||||||
|
|
||||||
|
export const MobileMenu = ({
|
||||||
|
menuTraversal,
|
||||||
|
setMenuTraversal,
|
||||||
|
pendingView,
|
||||||
|
setPendingView,
|
||||||
|
goPreviousView,
|
||||||
|
currentView,
|
||||||
|
}: MobileMenuProps) => {
|
||||||
|
const [menuOpen, setMenuOpen] = useState(false);
|
||||||
|
|
||||||
|
const goToView = useCallback(
|
||||||
|
(view: View) => {
|
||||||
|
setMenuTraversal((prev) => {
|
||||||
|
const next = prev.clone();
|
||||||
|
next.push(view);
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
setPendingView(view);
|
||||||
|
},
|
||||||
|
[setMenuTraversal, setPendingView]
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const onPop = () => {
|
||||||
|
goPreviousView();
|
||||||
|
};
|
||||||
|
window.addEventListener("popstate", onPop);
|
||||||
|
return () => window.removeEventListener("popstate", onPop);
|
||||||
|
}, [goPreviousView]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (pendingView === null) return;
|
||||||
|
window.history.pushState(
|
||||||
|
{ depth: menuTraversal.size() },
|
||||||
|
"",
|
||||||
|
viewToHash[pendingView] ? `#${viewToHash[pendingView]}` : "/"
|
||||||
|
);
|
||||||
|
setPendingView(null);
|
||||||
|
}, [menuTraversal, pendingView, setPendingView]);
|
||||||
|
|
||||||
|
const slideProps = useSpring({
|
||||||
|
x: menuOpen ? 0 : -128,
|
||||||
|
config: { tension: 200, friction: 20 },
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="pointer-events-auto">
|
||||||
|
<AnimatedButton
|
||||||
|
className="m-2"
|
||||||
|
onClick={() => setMenuOpen((prev) => !prev)}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
path={mdiMenu}
|
||||||
|
size={1.5}
|
||||||
|
color="white"
|
||||||
|
className="stroke-[0.75] stroke-black"
|
||||||
|
/>
|
||||||
|
</AnimatedButton>
|
||||||
|
{/* @ts-expect-error children not typed bug */}
|
||||||
|
<animated.div
|
||||||
|
style={{
|
||||||
|
transform: slideProps.x.to((x) => `translateX(${x}%)`),
|
||||||
|
}}
|
||||||
|
className="text-white flex flex-col w-min gap-2 text-stroke-2 text-stroke-black paint-sfm ml-2"
|
||||||
|
>
|
||||||
|
{[
|
||||||
|
{ label: "Home", view: View.MainView },
|
||||||
|
{ label: "Projects", view: View.PCView },
|
||||||
|
{ label: "Socials", view: View.CellphoneView },
|
||||||
|
{ label: "Resume", view: View.ResumeView },
|
||||||
|
{ label: "Hobbies", view: View.PrinterView },
|
||||||
|
{ label: "Credits", view: View.CreditsView },
|
||||||
|
].map(({ label, view }) => (
|
||||||
|
<button
|
||||||
|
key={view}
|
||||||
|
className={`${
|
||||||
|
currentView === view ? "bg-neutral-700/50" : "bg-neutral-500/50"
|
||||||
|
} px-2 py-1 transition-all duration-300 hover:bg-neutral-700/50 hover:scale-110 rounded`}
|
||||||
|
onClick={() => goToView(view)}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</animated.div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
8
src/types/scene.d.ts
vendored
8
src/types/scene.d.ts
vendored
@@ -26,10 +26,6 @@ export type GLTFResult = GLTF & {
|
|||||||
PenBody: Mesh;
|
PenBody: Mesh;
|
||||||
PenTip: Mesh;
|
PenTip: Mesh;
|
||||||
CellphoneMesh: Mesh;
|
CellphoneMesh: Mesh;
|
||||||
Top: Mesh;
|
|
||||||
OfficePhoneBody: Mesh;
|
|
||||||
Screen: Mesh;
|
|
||||||
Buttons: Mesh;
|
|
||||||
Handle: Mesh;
|
Handle: Mesh;
|
||||||
HeadphonesBody: Mesh;
|
HeadphonesBody: Mesh;
|
||||||
HeadphonesAccent: Mesh;
|
HeadphonesAccent: Mesh;
|
||||||
@@ -74,10 +70,6 @@ export type GLTFResult = GLTF & {
|
|||||||
PenBodyMaterial: MeshStandardMaterial;
|
PenBodyMaterial: MeshStandardMaterial;
|
||||||
TipMaterial: MeshStandardMaterial;
|
TipMaterial: MeshStandardMaterial;
|
||||||
CellphoneMaterial: MeshStandardMaterial;
|
CellphoneMaterial: MeshStandardMaterial;
|
||||||
TopMaterial: MeshStandardMaterial;
|
|
||||||
OfficePhoneBodyMaterial: MeshStandardMaterial;
|
|
||||||
ScreenMaterial: MeshStandardMaterial;
|
|
||||||
HandleAndButtonsMaterial: MeshStandardMaterial;
|
|
||||||
HeadphonesBodyMaterial: MeshStandardMaterial;
|
HeadphonesBodyMaterial: MeshStandardMaterial;
|
||||||
HeadphonesAccentMaterial: MeshStandardMaterial;
|
HeadphonesAccentMaterial: MeshStandardMaterial;
|
||||||
CoverMaterial: MeshStandardMaterial;
|
CoverMaterial: MeshStandardMaterial;
|
||||||
|
|||||||
5
src/util/isMobile.ts
Normal file
5
src/util/isMobile.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export default function isMobile(): boolean {
|
||||||
|
return typeof window === "undefined"
|
||||||
|
? false
|
||||||
|
: window.matchMedia?.("(pointer: coarse)").matches;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user