diff --git a/.gitignore b/.gitignore index 4d4bf6a..4cae14d 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ yarn-error.log* *.tsbuildinfo next-env.d.ts -bun.lockb \ No newline at end of file +/bun.lockb +bun.lockb diff --git a/bun.lockb b/bun.lockb index b9c4b89..64b91c2 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index bbadcfe..7cc20c8 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,13 @@ "lint": "next lint" }, "dependencies": { - "@react-three/drei": "^9.92.5", + "@react-three/drei": "^9.92.6", + "@react-three/fiber": "^8.15.12", "@reduxjs/toolkit": "^2.0.1", "@splinetool/r3f-spline": "^1.0.2", "@splinetool/react-spline": "^2.2.6", - "@splinetool/runtime": "^1.0.4", + "@splinetool/runtime": "^1.0.16", + "@tweenjs/tween.js": "^21.0.0", "framer-motion": "^10.16.16", "jsonwebtoken": "^9.0.2", "locomotive-scroll": "^5.0.0-beta.11", @@ -34,12 +36,12 @@ "@types/react": "^18", "@types/react-dom": "^18", "autoprefixer": "^10.4.16", - "daisyui": "^4.4.22", + "daisyui": "^4.4.23", "eslint": "^8", "eslint-config-next": "14.0.4", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.1.0", + "eslint-plugin-prettier": "^5.1.1", "postcss": "^8", "prettier": "^3.1.1", "tailwindcss": "^3.4.0", diff --git a/src/app/3dtest/page.tsx b/src/app/3dtest/page.tsx new file mode 100644 index 0000000..58e0ca7 --- /dev/null +++ b/src/app/3dtest/page.tsx @@ -0,0 +1,8 @@ +import Scene from "@/components/3d/Scene"; +import React from "react"; + +function page() { + return ; +} + +export default page; diff --git a/src/app/[companyId]/dashboard/page.tsx b/src/app/[companyId]/dashboard/page.tsx new file mode 100644 index 0000000..d4d1955 --- /dev/null +++ b/src/app/[companyId]/dashboard/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function page() { + return
Dashbaord
; +} + +export default page; diff --git a/src/app/[companyId]/login/page.tsx b/src/app/[companyId]/login/page.tsx new file mode 100644 index 0000000..aae4c9a --- /dev/null +++ b/src/app/[companyId]/login/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function page() { + return
Login
; +} + +export default page; diff --git a/src/app/[companyId]/settings/page.tsx b/src/app/[companyId]/settings/page.tsx new file mode 100644 index 0000000..453e0f0 --- /dev/null +++ b/src/app/[companyId]/settings/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function page() { + return
Settings
; +} + +export default page; diff --git a/src/app/[companyId]/signup/page.tsx b/src/app/[companyId]/signup/page.tsx new file mode 100644 index 0000000..66874b2 --- /dev/null +++ b/src/app/[companyId]/signup/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function page() { + return
Signup
; +} + +export default page; diff --git a/src/app/reset/page.tsx b/src/app/reset/page.tsx new file mode 100644 index 0000000..3531826 --- /dev/null +++ b/src/app/reset/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function Reset() { + return
Reset Password
; +} + +export default Reset; diff --git a/src/app/setup/page.tsx b/src/app/setup/page.tsx new file mode 100644 index 0000000..e1f8697 --- /dev/null +++ b/src/app/setup/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function Setup() { + return
Setup
; +} + +export default Setup; diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx new file mode 100644 index 0000000..0284c87 --- /dev/null +++ b/src/app/signup/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function Signup() { + return
Signup
; +} + +export default Signup; diff --git a/src/assets/globals.scss b/src/assets/globals.scss index d3b2435..8996cc1 100644 --- a/src/assets/globals.scss +++ b/src/assets/globals.scss @@ -26,6 +26,10 @@ section { max-width: 100%; } +canvas { + min-height: 100vh; +} + .landingGradient { width: 70vh; height: 70vh; diff --git a/src/components/3d/Scene.tsx b/src/components/3d/Scene.tsx new file mode 100644 index 0000000..f8931c5 --- /dev/null +++ b/src/components/3d/Scene.tsx @@ -0,0 +1,15 @@ +"use client"; +import { Canvas } from "@react-three/fiber"; +import Sphere from "./Sphere"; + +function Scene() { + return ( + + + + + + ); +} + +export default Scene; diff --git a/src/components/3d/Sphere.tsx b/src/components/3d/Sphere.tsx new file mode 100644 index 0000000..63abc8c --- /dev/null +++ b/src/components/3d/Sphere.tsx @@ -0,0 +1,91 @@ +import { shaderMaterial } from "@react-three/drei"; +import { extend, useFrame, useThree } from "@react-three/fiber"; +import React, { useEffect } from "react"; +import * as THREE from "three"; +import { fragmentShader } from "./fragmentShader"; +import { vertexShader } from "./vertexShader"; +// @ts-ignore +import * as TWEEN from "@tweenjs/tween.js"; + +function Sphere() { + const meshRef = React.useRef(); + const start = React.useRef(Date.now()); + const uniforms = React.useRef( + THREE.UniformsUtils.merge([THREE.UniformsLib["lights"], THREE.ShaderLib.phong.uniforms, { time: { value: 0 } }]) + ); + const { camera, size } = useThree(); + camera.position.setZ(42); + camera.position.setX(40); + camera.position.setY(25); + + useFrame(() => { + const elapsed = Date.now() - start.current; + uniforms.current.time.value = 0.00005 * elapsed; + meshRef.current.rotation.z += 0.001; + TWEEN.update(); + }); + + React.useEffect(() => { + const handleResize = () => { + const windowWidth = window.innerWidth; + camera.updateProjectionMatrix(); + + if (windowWidth <= 696) { + meshRef.current?.position.set(14, 10, 0); + } else if (windowWidth <= 1024) { + meshRef.current?.position.set(18, 14, 0); + } else { + meshRef.current?.position.set(22, 16, 0); + } + }; + + window.addEventListener("resize", handleResize); + handleResize(); + + return () => { + TWEEN.removeAll(); + window.removeEventListener("resize", handleResize); + }; + }, [camera, size]); + + useEffect(() => { + const onCanvasMouseMove = (event: MouseEvent) => { + const position = { + x: event.clientX / size.width, + y: event.clientY / size.height + }; + + const targetRotation = { + x: position.y / 2, + y: position.x / 2 + }; + + // Tween update for smooth transition + if (meshRef.current) { + TWEEN.removeAll(); + new TWEEN.Tween(meshRef.current.rotation) + .to({ x: targetRotation.x, y: targetRotation.y }, 2000) + .easing(TWEEN.Easing.Quartic.Out) + .start(); + } + }; + + window.addEventListener("mousemove", onCanvasMouseMove); + + return () => { + window.removeEventListener("mousemove", onCanvasMouseMove); + }; + }, [size]); + + const CustomShaderMaterial = shaderMaterial(uniforms.current, vertexShader, fragmentShader); + + extend({ CustomShaderMaterial }); + return ( + + + + + ); +} + +export default Sphere; diff --git a/src/components/3d/fragmentShader.js b/src/components/3d/fragmentShader.js new file mode 100644 index 0000000..8cbea52 --- /dev/null +++ b/src/components/3d/fragmentShader.js @@ -0,0 +1,73 @@ +export const fragmentShader = ` +#define PHONG + +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +uniform float time; +varying vec2 vUv; +varying vec3 newPosition; +varying float noise; +varying vec3 vNormal; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + #include + + vec3 color = vec3(vUv * (0.3 - 2.0 * noise), 1); + vec3 targetColor = vec3(69.0/255.0, 134.0/255.0, 230.0/255.0); + vec4 diffuseColor = vec4(targetColor, 1.0); // Use targetColor for the RGB components + vec3 finalColors = vec3(color.b * 2.0, color.r, color.r); + ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0)); + vec3 totalEmissiveRadiance = emissive; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + + #include + #include + #include + #include + #include + + gl_FragColor = vec4(outgoingLight, diffuseColor.a); +} +`; diff --git a/src/components/3d/vertexShader.js b/src/components/3d/vertexShader.js new file mode 100644 index 0000000..7b47db9 --- /dev/null +++ b/src/components/3d/vertexShader.js @@ -0,0 +1,212 @@ +export const vertexShader = ` + vec3 mod289(vec3 x) + { + return x - floor(x * (1.0 / 289.0)) * 289.0; + } + vec4 mod289(vec4 x) + { + return x - floor(x * (1.0 / 289.0)) * 289.0; + } + vec4 permute(vec4 x) + { + return mod289(((x * 34.0) + 1.0) * x); + } + vec4 taylorInvSqrt(vec4 r) + { + return 1.79284291400159 - 0.85373472095314 * r; + } + vec3 fade(vec3 t) { + return t*t*t*(t*(t*6.0-15.0)+10.0); + } + + // Classic Perlin noise + float cnoise(vec3 P) + { + vec3 Pi0 = floor(P); // Integer part for indexing + vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1 + Pi0 = mod289(Pi0); + Pi1 = mod289(Pi1); + vec3 Pf0 = fract(P); // Fractional part for interpolation + vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0 + vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); + vec4 iy = vec4(Pi0.yy, Pi1.yy); + vec4 iz0 = Pi0.zzzz; + vec4 iz1 = Pi1.zzzz; + vec4 ixy = permute(permute(ix) + iy); + vec4 ixy0 = permute(ixy + iz0); + vec4 ixy1 = permute(ixy + iz1); + vec4 gx0 = ixy0 * (1.0 / 7.0); + vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5; + gx0 = fract(gx0); + vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); + vec4 sz0 = step(gz0, vec4(0.0)); + gx0 -= sz0 * (step(0.0, gx0) - 0.5); + gy0 -= sz0 * (step(0.0, gy0) - 0.5); + vec4 gx1 = ixy1 * (1.0 / 7.0); + vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5; + gx1 = fract(gx1); + vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); + vec4 sz1 = step(gz1, vec4(0.0)); + gx1 -= sz1 * (step(0.0, gx1) - 0.5); + gy1 -= sz1 * (step(0.0, gy1) - 0.5); + vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); + vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); + vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); + vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); + vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); + vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); + vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); + vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); + vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + g000 *= norm0.x; + g010 *= norm0.y; + g100 *= norm0.z; + g110 *= norm0.w; + vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + g001 *= norm1.x; + g011 *= norm1.y; + g101 *= norm1.z; + g111 *= norm1.w; + float n000 = dot(g000, Pf0); + float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); + float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); + float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); + float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); + float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); + float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); + float n111 = dot(g111, Pf1); + vec3 fade_xyz = fade(Pf0); + vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); + vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); + float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); + return 2.2 * n_xyz; + } + + // Classic Perlin noise, periodic variant + float pnoise(vec3 P, vec3 rep) + { + vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period + vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period + Pi0 = mod289(Pi0); + Pi1 = mod289(Pi1); + vec3 Pf0 = fract(P); // Fractional part for interpolation + vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0 + vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); + vec4 iy = vec4(Pi0.yy, Pi1.yy); + vec4 iz0 = Pi0.zzzz; + vec4 iz1 = Pi1.zzzz; + vec4 ixy = permute(permute(ix) + iy); + vec4 ixy0 = permute(ixy + iz0); + vec4 ixy1 = permute(ixy + iz1); + vec4 gx0 = ixy0 * (1.0 / 7.0); + vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5; + gx0 = fract(gx0); + vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); + vec4 sz0 = step(gz0, vec4(0.0)); + gx0 -= sz0 * (step(0.0, gx0) - 0.5); + gy0 -= sz0 * (step(0.0, gy0) - 0.5); + vec4 gx1 = ixy1 * (1.0 / 7.0); + vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5; + gx1 = fract(gx1); + vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); + vec4 sz1 = step(gz1, vec4(0.0)); + gx1 -= sz1 * (step(0.0, gx1) - 0.5); + gy1 -= sz1 * (step(0.0, gy1) - 0.5); + vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); + vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); + vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); + vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); + vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); + vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); + vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); + vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); + vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + g000 *= norm0.x; + g010 *= norm0.y; + g100 *= norm0.z; + g110 *= norm0.w; + vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + g001 *= norm1.x; + g011 *= norm1.y; + g101 *= norm1.z; + g111 *= norm1.w; + float n000 = dot(g000, Pf0); + float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); + float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); + float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); + float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); + float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); + float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); + float n111 = dot(g111, Pf1); + vec3 fade_xyz = fade(Pf0); + vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); + vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); + float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); + return 2.2 * n_xyz; + } + + float turbulence(vec3 p) { + float w = 100.0; + float t = -.5; + for (float f = 1.0 ; f <= 10.0 ; f++) { + float power = pow(2.0, f); + t += abs(pnoise(vec3(power * p), vec3(10.0, 10.0, 10.0)) / power); + } + return t; + } + + // START + uniform float time; + varying vec2 vUv; + varying vec3 vNormal; + varying float noise; + + #define PHONG + + varying vec3 vViewPosition; + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + void main() { + #include + #include + #include + #include + #include + #include + #include + #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED + vNormal = normal; + #endif + #include + #include + #include + #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include + #include + + vUv = uv; + + noise = turbulence(0.01 * position + normal + time * 0.8); + vec3 displacement = vec3((position.x) * noise, position.y * noise, position.z * noise); + gl_Position = projectionMatrix * modelViewMatrix * vec4((position + normal) + displacement, 1.0); + } +`; diff --git a/src/components/Features.tsx b/src/components/Features.tsx index e054e67..116de6b 100644 --- a/src/components/Features.tsx +++ b/src/components/Features.tsx @@ -3,7 +3,8 @@ import { stylesWithCssVar } from "@/utils/motion"; import { useScroll, useTransform, motion } from "framer-motion"; import React from "react"; import { Suspense, useRef } from "react"; -const Spline = React.lazy(() => import("@splinetool/react-spline")); +import Scene from "./3d/Scene"; +/* const Spline = React.lazy(() => import("@splinetool/react-spline")); */ export const Features = () => { const targetRef = useRef(null); @@ -27,7 +28,8 @@ export const Features = () => {
- + {/* */} + ; + } + } +}