added Chaos Demons demo, style improvements

This commit is contained in:
NilsUeter
2023-05-09 21:24:45 +02:00
parent b966a31606
commit 88812cf5a5
5 changed files with 55 additions and 34 deletions
Binary file not shown.
+21 -2
View File
@@ -27,8 +27,18 @@ function App() {
}; };
reader.readAsBinaryString(files[0]); reader.readAsBinaryString(files[0]);
} else { } else {
let example;
switch (event) {
case "ultras":
example = await fetch("Ultramarines Example.rosz");
break;
case "chaos daemons":
example = await fetch("Chaos Demons Mix.rosz");
default:
break;
}
// load example // load example
const example = await fetch("Ultramarines Example.rosz");
const arrayBuffer = await example.arrayBuffer(); const arrayBuffer = await example.arrayBuffer();
// Create a new Blob object from the zip file contents // Create a new Blob object from the zip file contents
const zipBlob = new Blob([arrayBuffer], { type: "application/zip" }); const zipBlob = new Blob([arrayBuffer], { type: "application/zip" });
@@ -189,13 +199,22 @@ function App() {
{error} {error}
</div> </div>
<Roster roster={roster} onePerPage={onePerPage} /> <Roster roster={roster} onePerPage={onePerPage} />
<div style={{ display: "flex", gap: 8 }}>
<button <button
className="print-display-none" className="print-display-none"
style={{ display: roster ? "none" : "" }} style={{ display: roster ? "none" : "" }}
onClick={handleFileSelect} onClick={() => handleFileSelect("ultras")}
> >
Load Ultramarines example Load Ultramarines example
</button> </button>
<button
className="print-display-none"
style={{ display: roster ? "none" : "" }}
onClick={() => handleFileSelect("chaos daemons")}
>
Load Chaos Daemons example
</button>
</div>
<div <div
className="print-display-none" className="print-display-none"
style={{ display: roster ? "none" : "" }} style={{ display: roster ? "none" : "" }}
+19 -21
View File
@@ -25,6 +25,7 @@ export const Roster = ({ roster, onePerPage }) => {
fontSize: " 1.7em", fontSize: " 1.7em",
fontWeight: "800", fontWeight: "800",
textTransform: "uppercase", textTransform: "uppercase",
marginBottom: "12px",
}} }}
> >
{name} [{cost.commandPoints} CP] {name} [{cost.commandPoints} CP]
@@ -121,8 +122,6 @@ const Unit = ({ unit, index, catalog, onePerPage }) => {
} }
style={{ style={{
fontWeight: 500, fontWeight: 500,
border: "2px solid var(--primary-color)",
backgroundColor: "#DFE0E2",
marginBottom: 32, marginBottom: 32,
"--primary-color": overridePrimary, "--primary-color": overridePrimary,
@@ -133,7 +132,11 @@ const Unit = ({ unit, index, catalog, onePerPage }) => {
> >
<label <label
className="print-display-none" className="print-display-none"
style={{ display: "flex", alignItems: "center" }} style={{
display: "flex",
alignItems: "center",
justifyContent: "flex-end",
}}
> >
<input type="checkbox" onChange={() => setHide(!hide)} /> <input type="checkbox" onChange={() => setHide(!hide)} />
<span className="print-display-none">Don't print this card.</span> <span className="print-display-none">Don't print this card.</span>
@@ -237,7 +240,14 @@ const Unit = ({ unit, index, catalog, onePerPage }) => {
</div> </div>
</div> </div>
</div> </div>
<div style={{ display: "flex" }}> <div
style={{
display: "flex",
border: "2px solid var(--primary-color)",
borderTop: "none",
backgroundColor: "#DFE0E2",
}}
>
<div <div
style={{ style={{
flex: "1", flex: "1",
@@ -324,7 +334,7 @@ const Unit = ({ unit, index, catalog, onePerPage }) => {
</div> </div>
<Rules rules={rules} /> <Rules rules={rules} />
<Abilities abilities={abilities.Abilities} /> <Abilities abilities={abilities.Abilities} />
<Psykers title="PSYKER" psykers={psykers} /> <Psykers psykers={psykers} />
<Factions factions={factions} /> <Factions factions={factions} />
<FactionIcon catalog={catalog} /> <FactionIcon catalog={catalog} />
</div> </div>
@@ -625,10 +635,10 @@ const Psykers = ({ title, psykers }) => {
color: "#fff", color: "#fff",
}} }}
> >
<th style={{ textAlign: "left" }}>{title}</th> <th style={{ textAlign: "left" }}>PSYKER</th>
<th>Cast</th> <th>Cast</th>
<th>Deny</th> <th>Deny</th>
<th style={{ textAlign: "left" }} colSpan="4"> <th style={{ textAlign: "left", width: "100%" }} colSpan="4">
Powers Known Powers Known
</th> </th>
</tr> </tr>
@@ -640,8 +650,7 @@ const Psykers = ({ title, psykers }) => {
))} ))}
{psykers.length > 0 && ( {psykers.length > 0 && (
<tr className="emptyRow"> <tr className="emptyRow">
<td style={{ width: 37 }}></td> <td colSpan={4}></td>
<td colSpan={7}></td>
</tr> </tr>
)} )}
</tbody> </tbody>
@@ -657,18 +666,7 @@ const Psyker = ({ psyker, index }) => {
className={index % 2 ? "rowOtherColor" : ""} className={index % 2 ? "rowOtherColor" : ""}
style={{ fontSize: ".8em" }} style={{ fontSize: ".8em" }}
> >
<td style={{ textAlign: "left" }}> <td style={{ textAlign: "left" }}></td>
<div
style={{
display: "flex",
alignItems: "center",
flexWrap: "wrap",
gap: "0 4px",
}}
>
{name}
</div>
</td>
<td>{cast}</td> <td>{cast}</td>
<td>{deny}</td> <td>{deny}</td>
<td style={{ textAlign: "left" }} colSpan="4"> <td style={{ textAlign: "left" }} colSpan="4">
+2 -4
View File
@@ -227,9 +227,7 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
return ( return (
<> <>
<tr className={className}> <tr className={className}>
<td style={{ borderTop: "none", backgroundColor: "#dfe0e2" }}> <td style={{ borderTop: "none" }}>{differentProfiles && Arrow}</td>
{differentProfiles && Arrow}
</td>
<td style={{ textAlign: "left" }}> <td style={{ textAlign: "left" }}>
<div <div
style={{ style={{
@@ -303,7 +301,7 @@ const getWeaponClassNames = (weapons, index) => {
}; };
const calculateWeaponStrength = (strModel, strWeapon) => { const calculateWeaponStrength = (strModel, strWeapon) => {
if (strWeapon.startsWith("User")) return strModel; if (strWeapon.includes("User")) return strModel;
if (strWeapon.startsWith("x")) { if (strWeapon.startsWith("x")) {
return strModel * parseInt(strWeapon.replace("x", "")); return strModel * parseInt(strWeapon.replace("x", ""));
} }
+7 -1
View File
@@ -71,7 +71,7 @@ button:focus-visible {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 8px; gap: 8px;
padding: var(--size-24) var(--size-32); padding: var(--size-24) var(--size-20);
max-width: 1100px; max-width: 1100px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
@@ -177,6 +177,12 @@ button:focus-visible {
#root { #root {
min-width: 1000px; min-width: 1000px;
} }
.body {
padding: 0;
display: block;
max-width: none;
}
} }
@media screen and (max-width: 800px) { @media screen and (max-width: 800px) {