64 lines
1.7 KiB
TypeScript
64 lines
1.7 KiB
TypeScript
import { useState, useEffect } from 'react'
|
|
|
|
const baseUrl = typeof window !== 'undefined'
|
|
? window.location.origin
|
|
: process.env.VITE_VERCEL_URL || 'http://localhost:5173' // Fallback for your server env
|
|
|
|
export function Control() {
|
|
|
|
const [stats, setStats] = useState([])
|
|
const [skills, setSkills] = useState([])
|
|
|
|
useEffect(() => {
|
|
fetch(`${baseUrl}/characters/collateral/stats.json`)
|
|
.then(r => r.json())
|
|
.then(j => setStats(j))
|
|
|
|
fetch(`${baseUrl}/characters/collateral/skills.json`)
|
|
.then(r => r.json())
|
|
.then(j => setSkills(j))
|
|
})
|
|
|
|
|
|
return (
|
|
<main>
|
|
<table className="cyber-table">
|
|
<thead>
|
|
<tr>
|
|
<th style={{ width: "70%" }}>CONTROL SKILLS</th>
|
|
<th style={{ width: "10%" }}>RANKS</th>
|
|
<th style={{ width: "10%" }}>STAT</th>
|
|
<th style={{ width: "10%" }}>BASE</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>DRIVE LAND VEHICLE</td>
|
|
<td>{skills.driveland}</td>
|
|
<td>{stats.dex}</td>
|
|
<td>{stats.dex + skills.driveland}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>PILOT AIR VEHICLE</td>
|
|
<td>{skills.pilotair}</td>
|
|
<td>{stats.dex}</td>
|
|
<td>{stats.dex + skills.pilotair}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>PILOT SEA VEHICLE</td>
|
|
<td>{skills.lipreading}</td>
|
|
<td>{stats.dex}</td>
|
|
<td>{stats.dex + skills.pilotsea}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RIDING</td>
|
|
<td>{skills.riding}</td>
|
|
<td>{stats.dex}</td>
|
|
<td>{stats.dex + skills.riding}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</main>
|
|
)
|
|
}
|