Skip to content

Commit

Permalink
fix typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
arianecrestani committed Jul 13, 2023
1 parent fe30174 commit 3ef7ee3
Show file tree
Hide file tree
Showing 311 changed files with 4,085 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/codac-community/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions packages/codac-graphql-types/src/__generated__/schema.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/codac-ui/src/3d-libraries/particles/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="react" />
export declare const ParticlesComp: ({ type }: {
type: string;
}) => import("react").JSX.Element;
//# sourceMappingURL=index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions packages/codac-ui/src/3d-libraries/particles/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"use client";
import { Suspense, useCallback } from "react";
import Particles from "react-particles";
import { loadFull } from "tsparticles";
import { confetti } from "./options/confetti";
import { snow } from "./options/snow";
import { triangles } from "./options/tiangles";
var ParticulesOptions;
(function (ParticulesOptions) {
ParticulesOptions[ParticulesOptions["snow"] = 0] = "snow";
ParticulesOptions[ParticulesOptions["confetti"] = 1] = "confetti";
ParticulesOptions[ParticulesOptions["triangles"] = 2] = "triangles";
})(ParticulesOptions || (ParticulesOptions = {}));
const getOptions = (type) => {
switch (type) {
case "snow":
return snow;
case "confetti":
return confetti;
case "triangles":
return triangles;
default:
return triangles;
}
};
export const ParticlesComp = ({ type }) => {
const particlesInit = useCallback(async (engine) => {
// you can initiate the tsParticles instance (engine) here, adding custom shapes or presets
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
// starting from v2 you can add only the features you need reducing the bundle size
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
await loadFull(engine);
// await loadConfig(config)
}, []);
const particlesLoaded = useCallback(async (container) => {
// await console.log(container);
}, []);
return (<Suspense fallback={<div>Loading...</div>}>
{/* @ts-expect-error Async Server Component */}
<Particles init={particlesInit} loaded={particlesLoaded} options={getOptions(type)}/>
</Suspense>);
};
10 changes: 7 additions & 3 deletions packages/codac-ui/src/3d-libraries/particles/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client";
import { useCallback } from "react";
import { Suspense, useCallback } from "react";
import Particles from "react-particles";
import { loadFull } from "tsparticles";
import { IOptions, type ISourceOptions, MoveDirection, OutMode } from "tsparticles-engine";
Expand Down Expand Up @@ -40,6 +40,10 @@ export const ParticlesComp = ({ type }: { type: string }) => {
const particlesLoaded = useCallback(async (container: any) => {
// await console.log(container);
}, []);

return <Particles init={particlesInit} loaded={particlesLoaded} options={getOptions(type)} />;
return (
<Suspense fallback={<div>Loading...</div>}>
{/* @ts-expect-error Async Server Component */}
<Particles init={particlesInit} loaded={particlesLoaded} options={getOptions(type)} />
</Suspense>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { ISourceOptions } from "tsparticles-engine";
export declare const confetti: ISourceOptions;
//# sourceMappingURL=confetti.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 131 additions & 0 deletions packages/codac-ui/src/3d-libraries/particles/options/confetti.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
export const confetti = {
// "background": {
// "color": {
// "value": "#000000"
// }
// },
fullScreen: {
enable: true,
zIndex: 999,
},
particles: {
color: {
value: ["#1E00FF", "#FF0061", "#E1FF00", "#00FF9E"],
animation: {
enable: true,
speed: 30,
},
},
move: {
decay: 0.1,
direction: "top",
enable: true,
gravity: {
acceleration: 9.81,
enable: true,
maxSpeed: 200,
},
outModes: {
top: "none",
default: "destroy",
},
speed: {
min: 50,
max: 150,
},
},
number: {
value: 0,
limit: 300,
},
opacity: {
value: 1,
animation: {
enable: false,
startValue: "max",
destroy: "min",
speed: 0.3,
sync: true,
},
},
rotate: {
value: {
min: 0,
max: 360,
},
direction: "random",
move: true,
animation: {
enable: true,
speed: 60,
},
},
tilt: {
direction: "random",
enable: true,
move: true,
value: {
min: 0,
max: 360,
},
animation: {
enable: true,
speed: 60,
},
},
shape: {
type: ["circle", "square", "polygon"],
options: {
polygon: [
{
sides: 5,
},
{
sides: 6,
},
],
},
},
size: {
value: 3,
},
roll: {
darken: {
enable: true,
value: 30,
},
enlighten: {
enable: true,
value: 30,
},
enable: true,
speed: {
min: 15,
max: 25,
},
},
wobble: {
distance: 30,
enable: true,
move: true,
speed: {
min: -15,
max: 15,
},
},
},
emitters: {
position: {
x: 50,
y: 100,
},
size: {
width: 0,
height: 0,
},
rate: {
quantity: 10,
delay: 0.1,
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { type ISourceOptions } from "tsparticles-engine";
export declare const snow: ISourceOptions;
//# sourceMappingURL=snow.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions packages/codac-ui/src/3d-libraries/particles/options/snow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const snow = {
background: {
// color: "#333",
},
particles: {
move: {
direction: "bottom",
enable: true,
random: false,
straight: false,
},
opacity: {
value: { min: 0.1, max: 0.5 },
},
size: {
value: { min: 1, max: 10 },
},
wobble: {
distance: 20,
enable: true,
speed: {
min: -5,
max: 5,
},
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { ISourceOptions } from "tsparticles-engine";
export declare const triangles: ISourceOptions;
//# sourceMappingURL=tiangles.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions packages/codac-ui/src/3d-libraries/particles/options/tiangles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export const triangles = {
background: {
// color: "#000000",
},
fullScreen: {
enable: true,
zIndex: -1,
},
particles: {
color: {
value: "#00897D",
},
links: {
distance: 125,
enable: true,
triangles: {
enable: true,
opacity: 0.01,
},
},
move: {
enable: true,
speed: 1,
},
size: {
value: 1,
},
shape: {
type: "triangles",
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="react" />
export declare const EffectScene: () => import("react").JSX.Element;
//# sourceMappingURL=EffectScene.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions packages/codac-ui/src/3d-libraries/three/effect/EffectScene.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { OrbitControls } from "@react-three/drei";
import { Canvas } from "@react-three/fiber";
// import { Bloom, EffectComposer, Grid, Noise } from "@react-three/postprocessing";
export const EffectScene = () => {
return (<Canvas className="h-screen w-screen" gl={{ alpha: false }}>
<OrbitControls></OrbitControls>
<mesh>
<torusBufferGeometry></torusBufferGeometry>
<meshStandardMaterial></meshStandardMaterial>
</mesh>

<spotLight></spotLight>
<ambientLight></ambientLight>

{/* <EffectComposer>
<Bloom luminanceThreshold={0} luminanceSmoothing={0.9} height={300} />
<Noise opacity={0.02} />
<Grid scale={0.8}></Grid>
</EffectComposer> */}
</Canvas>);
};
3 changes: 3 additions & 0 deletions packages/codac-ui/src/3d-libraries/three/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./effect/EffectScene";
export * from "./khmer-blood";
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions packages/codac-ui/src/3d-libraries/three/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/codac-ui/src/3d-libraries/three/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use client";
export * from "./effect/EffectScene";
export * from "./khmer-blood";
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// <reference types="react" />
declare const Spaceship: () => import("react").JSX.Element;
export { Spaceship };
//# sourceMappingURL=Spaceship.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3ef7ee3

Please sign in to comment.