From 3e21dca51be0798da4c84508d7eba3cde9eb928a Mon Sep 17 00:00:00 2001 From: Benjamin Bolte Date: Tue, 6 Aug 2024 21:48:18 -0700 Subject: [PATCH] misc checkpoint --- .../src/components/listing/ListingImages.tsx | 58 ++++++------- .../src/components/listing/ListingSTLs.tsx | 82 +++++++++---------- 2 files changed, 71 insertions(+), 69 deletions(-) diff --git a/frontend/src/components/listing/ListingImages.tsx b/frontend/src/components/listing/ListingImages.tsx index 9eadbc10..6ae724f3 100644 --- a/frontend/src/components/listing/ListingImages.tsx +++ b/frontend/src/components/listing/ListingImages.tsx @@ -44,23 +44,23 @@ const ListingImages = (props: Props) => { } }; - return ( + return images.length > 0 || edit ? (
- - {!collapsed && ( -
- {images.length > 0 && ( + {images.length > 0 && ( + <> + + {!collapsed && (
{images.map((image) => (
{ ))}
)} - {edit && ( - { - setImages([...images, artifact.artifact]); - }} - /> - )} -
+ + )} + {edit && ( + { + setImages([...images, artifact.artifact]); + }} + /> )}
+ ) : ( + <> ); }; diff --git a/frontend/src/components/listing/ListingSTLs.tsx b/frontend/src/components/listing/ListingSTLs.tsx index 7be51c96..08e0e139 100644 --- a/frontend/src/components/listing/ListingSTLs.tsx +++ b/frontend/src/components/listing/ListingSTLs.tsx @@ -1,4 +1,4 @@ -import { Canvas, useLoader } from "@react-three/fiber"; +import { useLoader } from "@react-three/fiber"; import ListingFileUpload from "components/listing/ListingFileUpload"; import { Button } from "components/ui/Button/Button"; import { components } from "gen/api"; @@ -7,6 +7,7 @@ import { useAuthentication } from "hooks/useAuth"; import { useState } from "react"; import { FaCaretSquareDown, FaCaretSquareUp, FaTimes } from "react-icons/fa"; import { STLLoader } from "three/examples/jsm/loaders/STLLoader"; +import { OBJLoader } from 'three/addons/loaders/OBJLoader'; const Model = ({ url }: { url: string }) => { const stl = useLoader(STLLoader, url); @@ -20,13 +21,15 @@ interface SingleStlViewerProps { const SingleStlViewer = (props: SingleStlViewerProps) => { const { url } = props; - return ( - console.log(error)}> - - - - - ); + // return ( + // console.log(error)}> + // + // + // + // + // ); + + return
{url}
; }; interface Props { @@ -67,34 +70,29 @@ const ListingSTLs = (props: Props) => { } }; - return ( + return stls.length > 0 || edit ? (
- - {!collapsed && ( -
- {stls.length > 0 && ( + {stls.length > 0 && ( + <> + + {!collapsed && (
{stls.map((stl) => (
- {/* {stl.name} */} {edit && (
)} - {edit && ( - { - setStls([...stls, artifact.artifact]); - }} - /> - )} -
+ + )} + {edit && ( + { + setStls([...stls, artifact.artifact]); + }} + /> )}
+ ) : ( + <> ); };