-
Home
-
Welcome to RoboList!
-
- -
- Robots
-
- -
- Robot 1
-
-
+
+
+
+ robolist
+
+ Buy, sell and build robot hardware and software
+
+
+
);
};
diff --git a/frontend/src/pages/Robot.tsx b/frontend/src/pages/Robot.tsx
index 608f7df7..06a34c6d 100644
--- a/frontend/src/pages/Robot.tsx
+++ b/frontend/src/pages/Robot.tsx
@@ -1,12 +1,223 @@
-import { useParams } from "react-router-dom";
+import { useState } from "react";
+import {
+ Breadcrumb,
+ Button,
+ ButtonGroup,
+ Carousel,
+ Col,
+ Container,
+ Modal,
+ Row,
+} from "react-bootstrap";
+import { useNavigate, useParams } from "react-router-dom";
+
+interface RobotDetailsResponse {
+ name: string;
+ owner: string;
+ links: { name: string; url: string }[];
+ images: { url: string; caption: string }[];
+ bom: { name: string; part_number: string; quantity: number; price: number }[];
+}
const RobotDetails = () => {
const { id } = useParams();
+ const [show, setShow] = useState(false);
+ const [imageIndex, setImageIndex] = useState(0);
+
+ const handleClose = () => setShow(false);
+ const handleShow = () => setShow(true);
+
+ // This is a placeholder before the backend is hooked up.
+ const response: RobotDetailsResponse = {
+ name: "Stompy",
+ owner: "K-Scale Labs",
+ links: [
+ {
+ name: "URDF (with STLs)",
+ url: "https://media.kscale.dev/stompy/latest_stl_urdf.tar.gz",
+ },
+ {
+ name: "URDF (with OBJs)",
+ url: "https://media.kscale.dev/stompy/latest_obj_urdf.tar.gz",
+ },
+ {
+ name: "MJCF",
+ url: "https://media.kscale.dev/stompy/latest_mjcf.tar.gz",
+ },
+ ],
+ images: [
+ {
+ url: "https://media.robolist.xyz/stompy.png",
+ caption: "Stompy the robot 1",
+ },
+ {
+ url: "https://media.robolist.xyz/stompy.png",
+ caption: "Stompy the robot 2",
+ },
+ {
+ url: "https://media.robolist.xyz/stompy.png",
+ caption: "Stompy the robot 3",
+ },
+ ],
+ bom: [
+ {
+ name: "Actuator",
+ part_number: "1234",
+ quantity: 10,
+ price: 100,
+ },
+ {
+ name: "Sensor",
+ part_number: "5678",
+ quantity: 5,
+ price: 50,
+ },
+ ],
+ };
+
+ const { name, owner, links, images } = response;
+
+ const navigate = useNavigate();
+
return (
-
-
Robot Details
-
Robot ID: {id}
-
+
+
+ navigate("/")}>Home
+ navigate("/robots/")}>
+ Listings
+
+ {name}
+
+
+
+
+ {name}
+
+ {owner}
+
+ ID: {id}
+
+ {links && (
+
+
Links
+
+ {links.map((link, key) => (
+ -
+ {link.name}
+
+ ))}
+
+
+ )}
+
+ {images && (
+
+
+ {images.map((image, key) => (
+
+
+
{
+ setImageIndex(key);
+ handleShow();
+ }}
+ />
+
+
+ {image.caption}
+
+
+ ))}
+
+
+ )}
+
+
+
+
+ Bill of Materials
+
+
+
+ Name |
+ Part Number |
+ Quantity |
+ Price |
+
+
+
+ {response.bom.map((part, key) => (
+
+ {part.name} |
+ {part.part_number} |
+ {part.quantity} |
+ ${part.price} |
+
+ ))}
+
+
+
+
+
+
+
+
+ {images[imageIndex].caption} ({imageIndex + 1} of {images.length})
+
+
+
+
+
+
+
+
+
+
+
+
+
);
};