From 7e4449182326f4be33788cad0b92473e5da3e28a Mon Sep 17 00:00:00 2001 From: bhushan6 Date: Sat, 29 Apr 2023 21:56:09 +0530 Subject: [PATCH] removed: liveblock --- src/App.js | 34 +++++++--------------------------- src/components/BrickCursor.jsx | 2 -- src/components/InfoPanel.jsx | 8 +++----- src/components/Scene.jsx | 6 ------ src/store/index.js | 31 ------------------------------- 5 files changed, 10 insertions(+), 71 deletions(-) diff --git a/src/App.js b/src/App.js index b9e209e..4dded16 100644 --- a/src/App.js +++ b/src/App.js @@ -1,21 +1,20 @@ import "./App.css"; import { OrbitControls } from "@react-three/drei"; import { Canvas } from "@react-three/fiber"; -import { Suspense, useEffect } from "react"; +import { Suspense } from "react"; import { LinearToneMapping } from "three"; import { InfoPanel, Scene } from "./components"; -import useStore from "./store"; const LegoRoom = () => { return ( <> { }; function App() { - // const enterRoom = useStore((state) => state.liveblocks.enterRoom); - // const leaveRoom = useStore((state) => state.liveblocks.leaveRoom); - // const isLoading = useStore((state) => state.liveblocks.isStorageLoading); - - // useEffect(() => { - // enterRoom("lego-demo-room"); - // return () => { - // leaveRoom("lego-demo-room"); - // }; - // }, [enterRoom, leaveRoom]); - - // if (isLoading) { - // return ( - // <> - //

Loading.....

- // - // ); - // } - return (
diff --git a/src/components/BrickCursor.jsx b/src/components/BrickCursor.jsx index 3481813..12196df 100644 --- a/src/components/BrickCursor.jsx +++ b/src/components/BrickCursor.jsx @@ -64,8 +64,6 @@ export const BrickCursor = forwardRef( 0, (offsetZ * width) / dimensions.z, ]} - castShadow={true} - receiveShadow={true} > { - const clearBricks = useStore((state) => state.clearBricks); - return (
{ width: "200px", }} > - {/* Use panel on right top corner to customize the Lego Bricks Properties */} - + Use panel on right top corner to customize the Lego Bricks Properties Use +
+ "AWSD" to chnage the anchor points of bricks
); }; diff --git a/src/components/Scene.jsx b/src/components/Scene.jsx index 12048ac..4373bc4 100644 --- a/src/components/Scene.jsx +++ b/src/components/Scene.jsx @@ -8,15 +8,10 @@ import { useAnchorShorcuts, } from "../utils"; import { useControls } from "leva"; -import useStore from "../store"; -// import { ContactShadows } from "@react-three/drei"; let t; export const Scene = () => { - // const bricks = useStore((state) => state.bricksState); - // const setBricks = useStore((state) => state.setBricks); - const [bricks, setBricks] = useState([]); const bricksBoundBox = useRef([]); @@ -111,7 +106,6 @@ export const Scene = () => { translation: { x: anchorX, z: anchorZ }, }; - // setBricks(brickData); setBricks((prevBricks) => [...prevBricks, brickData]); } } else { diff --git a/src/store/index.js b/src/store/index.js index a36ec84..e69de29 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,31 +0,0 @@ -import create from "zustand"; -import { createClient } from "@liveblocks/client"; -import { liveblocks } from "@liveblocks/zustand"; - -const client = createClient({ - publicApiKey: - "pk_dev_TZ6PEVqkJbtrcNqq8bnqghwmoxDr1WuSOcxycuo-_qYBLp9jDPQ12nhRcyNU_L_o", -}); - -const useStore = create( - liveblocks( - (set, get) => ({ - bricksState: [], - setBricks: (newBrick) => { - const { bricksState } = get(); - - set({ - bricksState: [...bricksState, newBrick], - }); - }, - clearBricks: () => { - set({ - bricksState: [], - }); - }, - }), - { client, storageMapping: { bricksState: true } } - ) -); - -export default useStore;