chore: Fix linter errors
This commit is contained in:
@@ -272,10 +272,10 @@ export default function CharacterSheet() {
|
||||
[],
|
||||
);
|
||||
|
||||
const xp = parseInt(String(fields.xpCurrent)) || 0;
|
||||
const xp = parseInt(String(fields.xpCurrent), 10) || 0;
|
||||
const xpPct = Math.min((xp % 10) * 10, 100);
|
||||
const hpMax = parseInt(String(fields.hpMax)) || 0;
|
||||
const hpCur = parseInt(String(fields.hpCur)) || 0;
|
||||
const hpMax = parseInt(String(fields.hpMax), 10) || 0;
|
||||
const hpCur = parseInt(String(fields.hpCur), 10) || 0;
|
||||
const inCrisis = hpMax > 0 && hpCur <= Math.floor(hpMax / 2);
|
||||
const fpTotal = Math.max(10, fp);
|
||||
|
||||
@@ -463,7 +463,7 @@ export default function CharacterSheet() {
|
||||
const encoded = params.get("c");
|
||||
if (shortId) {
|
||||
// Short link: fetch the sheet JSON from the share service.
|
||||
fetch(apiURL("api/s/" + encodeURIComponent(shortId)))
|
||||
fetch(apiURL(`api/s/${encodeURIComponent(shortId)}`))
|
||||
.then((res) => {
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
return res.json();
|
||||
@@ -489,9 +489,9 @@ export default function CharacterSheet() {
|
||||
if (raw)
|
||||
try {
|
||||
applyData(JSON.parse(raw));
|
||||
} catch (e) {}
|
||||
} catch (_e) {}
|
||||
}
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [applyData]);
|
||||
|
||||
// Auto-save every 30s
|
||||
useEffect(() => {
|
||||
@@ -565,10 +565,10 @@ export default function CharacterSheet() {
|
||||
});
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
const { id } = await res.json();
|
||||
shareURL = base + "?s=" + id;
|
||||
shareURL = `${base}?s=${id}`;
|
||||
} catch {
|
||||
// Backend unreachable: fall back to a self-contained inline ?c= link.
|
||||
shareURL = base + "?c=" + (await compressToBase64(json));
|
||||
shareURL = `${base}?c=${await compressToBase64(json)}`;
|
||||
}
|
||||
await copyToClipboard(shareURL);
|
||||
setCopyStatus(true);
|
||||
@@ -576,13 +576,13 @@ export default function CharacterSheet() {
|
||||
}, [collectData]);
|
||||
|
||||
const calcHP = useCallback(() => {
|
||||
const mig = parseInt(String(fields.migBase)) || 6;
|
||||
const mig = parseInt(String(fields.migBase), 10) || 6;
|
||||
const max = mig * 5 + level;
|
||||
setFields((prev) => ({ ...prev, hpMax: max, hpCur: prev.hpCur || max }));
|
||||
}, [fields.migBase, level]);
|
||||
|
||||
const calcMP = useCallback(() => {
|
||||
const wlp = parseInt(String(fields.wlpBase)) || 6;
|
||||
const wlp = parseInt(String(fields.wlpBase), 10) || 6;
|
||||
const max = wlp * 5 + level;
|
||||
setFields((prev) => ({ ...prev, mpMax: max, mpCur: prev.mpCur || max }));
|
||||
}, [fields.wlpBase, level]);
|
||||
@@ -663,8 +663,9 @@ export default function CharacterSheet() {
|
||||
</div>
|
||||
<div className="field-row">
|
||||
<div className="field" style={{ flex: 2 }}>
|
||||
<label>Name</label>
|
||||
<label htmlFor="character-name">Name</label>
|
||||
<input
|
||||
id="character-name"
|
||||
type="text"
|
||||
value={fields.charName}
|
||||
onChange={(e) => f("charName", e.target.value)}
|
||||
@@ -672,8 +673,9 @@ export default function CharacterSheet() {
|
||||
/>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Pronouns</label>
|
||||
<label htmlFor="character-pronouns">Pronouns</label>
|
||||
<input
|
||||
id="character-pronouns"
|
||||
type="text"
|
||||
value={fields.charPronouns}
|
||||
onChange={(e) => f("charPronouns", e.target.value)}
|
||||
@@ -682,8 +684,9 @@ export default function CharacterSheet() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Identity</label>
|
||||
<label htmlFor="character-identity">Identity</label>
|
||||
<input
|
||||
id="character-identity"
|
||||
type="text"
|
||||
value={fields.charIdentity}
|
||||
onChange={(e) => f("charIdentity", e.target.value)}
|
||||
@@ -692,8 +695,9 @@ export default function CharacterSheet() {
|
||||
</div>
|
||||
<div className="field-row">
|
||||
<div className="field">
|
||||
<label>Theme</label>
|
||||
<label htmlFor="character-theme">Theme</label>
|
||||
<input
|
||||
id="character-theme"
|
||||
type="text"
|
||||
value={fields.charTheme}
|
||||
onChange={(e) => f("charTheme", e.target.value)}
|
||||
@@ -701,8 +705,9 @@ export default function CharacterSheet() {
|
||||
/>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Origin</label>
|
||||
<label htmlFor="character-origin">Origin</label>
|
||||
<input
|
||||
id="character-origin"
|
||||
type="text"
|
||||
value={fields.charOrigin}
|
||||
onChange={(e) => f("charOrigin", e.target.value)}
|
||||
@@ -711,8 +716,9 @@ export default function CharacterSheet() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="field">
|
||||
<label>Traits (comma-separated)</label>
|
||||
<label htmlFor="character-traits">Traits (comma-separated)</label>
|
||||
<textarea
|
||||
id="character-traits"
|
||||
value={fields.charTraits}
|
||||
onChange={(e) => f("charTraits", e.target.value)}
|
||||
placeholder="Brave, Reckless, Loyal to a fault…"
|
||||
@@ -757,8 +763,9 @@ export default function CharacterSheet() {
|
||||
</div>
|
||||
<div>
|
||||
<div className="field">
|
||||
<label>Experience Points (XP)</label>
|
||||
<label htmlFor="character-xp-current">Experience Points (XP)</label>
|
||||
<input
|
||||
id="character-xp-current"
|
||||
type="number"
|
||||
value={fields.xpCurrent}
|
||||
onChange={(e) => f("xpCurrent", e.target.value)}
|
||||
@@ -773,8 +780,9 @@ export default function CharacterSheet() {
|
||||
<span>10 XP = Level</span>
|
||||
</div>
|
||||
<div className="field" style={{ marginTop: 12 }}>
|
||||
<label>Zenit (currency)</label>
|
||||
<label htmlFor="character-zenit">Zenit (currency)</label>
|
||||
<input
|
||||
id="character-zenit"
|
||||
type="number"
|
||||
value={fields.zenit}
|
||||
onChange={(e) => f("zenit", e.target.value)}
|
||||
@@ -791,24 +799,27 @@ export default function CharacterSheet() {
|
||||
</div>
|
||||
<div className="def-row">
|
||||
<div className="def-block">
|
||||
<label>Initiative Mod</label>
|
||||
<label htmlFor="character-initiative">Initiative Mod</label>
|
||||
<input
|
||||
id="character-initiative"
|
||||
type="number"
|
||||
value={fields.initMod}
|
||||
onChange={(e) => f("initMod", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="def-block">
|
||||
<label>Defense</label>
|
||||
<label htmlFor="character-defense">Defense</label>
|
||||
<input
|
||||
id="character-defense"
|
||||
type="number"
|
||||
value={fields.defense}
|
||||
onChange={(e) => f("defense", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="def-block">
|
||||
<label>Magic Defense</label>
|
||||
<label htmlFor="character-magic-defense">Magic Defense</label>
|
||||
<input
|
||||
id="character-magic-defense"
|
||||
type="number"
|
||||
value={fields.magDef}
|
||||
onChange={(e) => f("magDef", e.target.value)}
|
||||
|
||||
Reference in New Issue
Block a user