From 9d17f5f07b6538d90f94cc5e1b0c9fa4018ada43 Mon Sep 17 00:00:00 2001 From: iamBadgers Date: Mon, 9 Nov 2026 21:56:54 -0800 Subject: [PATCH] initial cyberware page --- app/details/weaponsandarmor.tsx | 5 +- app/routes/cyberware.tsx | 139 +++++++++++++- public/characters/collateral/cyberware.json | 195 ++++++++++++++++++++ 3 files changed, 333 insertions(+), 6 deletions(-) diff --git a/app/details/weaponsandarmor.tsx b/app/details/weaponsandarmor.tsx index 7cee2e7..77b8326 100644 --- a/app/details/weaponsandarmor.tsx +++ b/app/details/weaponsandarmor.tsx @@ -7,10 +7,7 @@ const baseUrl = const wandr = await fetch( `${baseUrl}/characters/collateral/weaponsandarmor.json`, -).then((r) => { - console.log(r); - return r.json(); -}); +).then((r) => r.json()); type DisplayArmor = { displayheadarmor: string; diff --git a/app/routes/cyberware.tsx b/app/routes/cyberware.tsx index 6141a3d..5fdae28 100644 --- a/app/routes/cyberware.tsx +++ b/app/routes/cyberware.tsx @@ -1,3 +1,4 @@ +import { useState, useEffect } from "react"; import type { Route } from "./+types/home"; export function meta({}: Route.MetaArgs) { @@ -7,6 +8,140 @@ export function meta({}: Route.MetaArgs) { ]; } -export default function StatsAndSkills() { - return
POTATO
; +const baseUrl = + typeof window !== "undefined" + ? window.location.origin + : process.env.VITE_VERCEL_URL || "http://localhost:5173"; // Fallback for your server env + +const c = await fetch(`${baseUrl}/characters/collateral/cyberware.json`).then( + (r) => r.json(), +); + +type CyberBodyData = { + neural: FoundationData; + audio: FoundationData; + lefteye: FoundationData; + righteye: FoundationData; + leftarm: FoundationData; + rightarm: FoundationData; + leftleg: FoundationData; + rightleg: FoundationData; + internal: CyberData[]; + external: CyberData[]; + borgware: CyberData[]; +}; + +type FoundationData = { + name: string; + slots: number; + upgraded: boolean; + hl: number; + contents: CyberData[]; +}; + +type CyberData = { + name: string; + description: string; + hl: number; +}; + +function FoundationHeader(): ReactElement { + return ( + + + Name + Description + + + ); +} + +function FoundationRow({ + cyber, +}: { + cyber: CyberData | undefined; +}): ReactElement { + if (!cyber) { + return ( + + -- + -- + + ); + } + + const upgrade = !cyber.upgraded ? ( + <> + ) : ( + + + {cyber.upgraded.name}: {cyber.upgraded.description} + + + ); + + return ( + <> + + {cyber.name} + {cyber.description} + + + ); +} + +function Foundation({ + foundation, +}: { + foundation: FoundationData; +}): ReactElement { + const rows: ReactElement[] = Array(foundation.slots); + + for (let i = 0; i < foundation.slots; i++) { + rows[i] = ; + } + + return ( + <> +
{foundation.name}
+ + + {rows} +
+ + ); +} + +const rowStyle = { + display: "flex", + flexDirection: "column", + width: "25%", +}; + +export default function Cyberware() { + const [cyber, setCyber] = useState(c); + + return ( +
+
+ + + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ ); } diff --git a/public/characters/collateral/cyberware.json b/public/characters/collateral/cyberware.json index e69de29..0089d96 100644 --- a/public/characters/collateral/cyberware.json +++ b/public/characters/collateral/cyberware.json @@ -0,0 +1,195 @@ +{ + "neural": { + "name": "Neural Link", + "installed": true, + "slots": 5, + "upgraded": false, + "hl": 2, + "contents": [ + { + "name": "Interfacec Plugs", + "description": "Plugs in your brain.", + "hl": 2 + }, + { + "name": "Interfacec Plugs", + "description": "Plugs in your brain.", + "hl": 2 + }, + { + "name": "Subdermal Grip Res.", + "description": "Subdermal Grip requires 1 neural slot.", + "hl": 0 + } + ] + }, + "audio": { + "name": "Audio Suite", + "installed": false, + "slots": 3, + "upgraded": false, + "hl": 2, + "contents": [] + }, + "lefteye": { + "name": "Left Meat Eye", + "installed": true, + "slots": 3, + "upgraded": false, + "hl": 2, + "contents": [] + }, + "righteye": { + "name": "Right Meat Eye", + "installed": true, + "slots": 3, + "upgraded": false, + "hl": 2, + "contents": [] + }, + "leftarm": { + "name": "Left Cyber Arm", + "installed": true, + "slots": 5, + "upgraded": { + "name": "slot+", + "description": "Add an extra option slot." + }, + "hl": 2, + "contents": [ + { + "name": "PopUp Dragon (Open Bay)", + "description": "SQ Flamethrower with S.Choke.", + "hl": 2 + }, + { + "name": "PopUp Dragon (Open Bay)", + "description": "Second Slot.", + "hl": 0 + }, + { + "name": "Tech Scanner", + "description": "+2 to tech skills.", + "hl": 2 + }, + { + "name": "Tech Scanner", + "description": "Second Slot.", + "hl": 2 + }, + { + "name": "Tech Tool", + "description": "Never loose your tools.", + "hl": 2 + } + ] + }, + "rightarm": { + "name": "Right Cyber Arm", + "installed": true, + "slots": 5, + "upgraded": { + "name": "slot+", + "description": "Add an extra option slot." + }, + "hl": 2, + "contents": [ + { + "name": "PopUp HSMG+", + "description": "EQ sub-caliber chaingun. S.Link | D.Mag", + "hl": 2 + }, + { + "name": "PopUp HSMG+", + "description": "Second Slot.", + "hl": 0, + "upgraded": { + "name": "Open Bay Mounting", + "description": "Swap mounted weapons." + } + }, + { + "name": "PopUp HSMG+", + "description": "EQ sub-caliber chaingun. S.Link | D.Mag", + "hl": 2 + }, + { + "name": "PopUp HSMG+", + "description": "Second Slot.", + "hl": 0 + }, + { + "name": "Subdermal Grip", + "description": "Gun Connection via Skin.", + "hl": 2 + } + ] + }, + "rightleg": { + "name": "Right Cyber Leg", + "installed": true, + "slots": 3, + "upgraded": { + "name": "Burden Managment", + "description": "Reduce MOVE Armor Penalty by 2." + }, + "hl": 1, + "contents": [ + { + "name": "Bilatteral Coprocessor", + "description": "Havles HL contributions.", + "hl": 0 + } + ] + }, + "leftleg": { + "name": "Left Cyber Leg", + "installed": true, + "slots": 3, + "upgraded": { + "name": "Burden Managment", + "description": "Reduce MOVE Armor Penalty by 2." + }, + "hl": 1, + "contents": [ + { + "name": "Bilatteral Coprocessor", + "description": "Havles HL contributions.", + "hl": 0 + } + ] + }, + "internal": { + "name": "Internal", + "installed": true, + "slots": 7, + "upgraded": { + "name": "Burden Managment", + "description": "Reduce MOVE Armor Penalty by 2." + }, + "hl": 1, + "contents": [] + }, + "external": { + "name": "External", + "installed": true, + "slots": 7, + "upgraded": { + "name": "Burden Managment", + "description": "Reduce MOVE Armor Penalty by 2." + }, + "hl": 1, + "contents": [] + }, + "borgware": { + "name": "Borgware", + "installed": true, + "slots": 7, + "upgraded": { + "name": "Burden Managment", + "description": "Reduce MOVE Armor Penalty by 2." + }, + "hl": 1, + "contents": [] + } +}