Files
cpr-character-sheet/app/skills/awareness.tsx
T

70 lines
1.9 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 Awareness() {
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%" }}>AWARENESS 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>CONCENTRATION</td>
<td>{skills.concentration}</td>
<td>{stats.will}</td>
<td>{stats.will + skills.concentration}</td>
</tr>
<tr>
<td>CONCEAL / REVEAL OBJECT</td>
<td>{skills.cro}</td>
<td>{stats.int}</td>
<td>{stats.int + skills.cro}</td>
</tr>
<tr>
<td>LIP READING</td>
<td>{skills.lipreading}</td>
<td>{stats.int}</td>
<td>{stats.int + skills.lipreading}</td>
</tr>
<tr>
<td>PERCEPTION</td>
<td>{skills.perception}</td>
<td>{stats.int}</td>
<td>{stats.int + skills.perception}</td>
</tr>
<tr>
<td>TRACKING</td>
<td>{skills.tracking}</td>
<td>{stats.int}</td>
<td>{stats.int + skills.tracking}</td>
</tr>
</tbody>
</table>
</main>
)
}