new screenshots

This commit is contained in:
NilsUeter
2023-10-21 15:00:19 +02:00
parent 87931d9921
commit 17dbc09669
6 changed files with 35 additions and 12 deletions
+4 -1
View File
@@ -302,6 +302,9 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
className="print-display-none" className="print-display-none"
accept=".jpg,.png,.jpeg,.gif,.bmp,.tif,.tiff,.webp,.svg,.jfif,.pjpeg,.pjp,.avif,.apng,.ico,.cur,.ani" accept=".jpg,.png,.jpeg,.gif,.bmp,.tif,.tiff,.webp,.svg,.jfif,.pjpeg,.pjp,.avif,.apng,.ico,.cur,.ani"
onChange={(e) => { onChange={(e) => {
posthog?.capture?.("user_uploaded_image", {
unit_name: name,
});
if (e.target.files && e.target.files[0]) { if (e.target.files && e.target.files[0]) {
let reader = new FileReader(); let reader = new FileReader();
reader.onload = function (ev) { reader.onload = function (ev) {
@@ -535,7 +538,7 @@ const Keywords = ({ keywords }) => {
<span style={{ fontSize: "1.1em" }}>KEYWORDS:</span> <span style={{ fontSize: "1.1em" }}>KEYWORDS:</span>
<span <span
style={{ style={{
fontSize: joinedKeywords.length > 80 ? ".8em" : "1em", fontSize: joinedKeywords.length > 70 ? ".8em" : "1em",
fontWeight: 800, fontWeight: 800,
}} }}
> >
+1
View File
@@ -132,6 +132,7 @@ const Weapon = ({ weapon, previousWeapon, nextWeapon, isMelee, className }) => {
fontWeight: 700, fontWeight: 700,
color: "var(--primary-color)", color: "var(--primary-color)",
textTransform: "uppercase", textTransform: "uppercase",
lineHeight: 1,
}} }}
> >
[{type}] [{type}]
+29 -10
View File
@@ -53,12 +53,14 @@ function App() {
break; break;
} }
// load example // load example
posthog?.capture?.("user_loaded_example", {
roster_faction: event,
});
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" });
const xmldata = await unzip(zipBlob); const xmldata = await unzip(zipBlob);
parseXML(xmldata, false); parseXML(xmldata, false, true);
} }
} }
const loadFromLocalStorage = (roster) => { const loadFromLocalStorage = (roster) => {
@@ -71,6 +73,10 @@ function App() {
setEdition(10); setEdition(10);
setError(""); setError("");
} }
posthog?.capture?.("user_loaded_roster_from_localstorage", {
roster_faction: roster.forces[0].catalog,
roster_type: roster.gameType,
});
}; };
const unzip = async (file) => { const unzip = async (file) => {
@@ -83,7 +89,7 @@ function App() {
} }
}; };
function parseXML(xmldata, addToLocalStorage) { function parseXML(xmldata, addToLocalStorage, isExample = false) {
const parser = new DOMParser(); const parser = new DOMParser();
const doc = parser.parseFromString(xmldata, "text/xml"); const doc = parser.parseFromString(xmldata, "text/xml");
if (!doc) return; if (!doc) return;
@@ -111,7 +117,6 @@ function App() {
} }
} else if (gameType == "Warhammer 40,000 10th Edition") { } else if (gameType == "Warhammer 40,000 10th Edition") {
roster = Create40kRoster10th(doc, gameType); roster = Create40kRoster10th(doc, gameType);
if (roster && roster.forces.length > 0) { if (roster && roster.forces.length > 0) {
setRoster(roster); setRoster(roster);
setEdition(10); setEdition(10);
@@ -120,8 +125,15 @@ function App() {
} else { } else {
setError("No support for game type '" + gameType + "'."); setError("No support for game type '" + gameType + "'.");
} }
if (roster && addToLocalStorage) { if (!roster) {
return;
}
if (addToLocalStorage) {
console.log(roster); console.log(roster);
posthog?.capture?.("user_uploaded_roster", {
roster_faction: roster.forces[0].catalog,
roster_type: gameType,
});
setRosters(stringifyJSON([roster, ...rostersJSON])); setRosters(stringifyJSON([roster, ...rostersJSON]));
} }
} }
@@ -283,7 +295,13 @@ function App() {
<button <button
style={{ display: roster ? "" : "none" }} style={{ display: roster ? "" : "none" }}
onClick={() => window.print()} onClick={() => {
posthog?.capture?.("user_printed_roster", {
roster_faction: roster.forces[0].catalog,
roster_type: roster.gameType,
});
window.print();
}}
> >
Print roster Print roster
</button> </button>
@@ -395,9 +413,10 @@ function App() {
<a href="https://www.battlescribe.net/" target="_blank"> <a href="https://www.battlescribe.net/" target="_blank">
BattleScribe BattleScribe
</a>{" "} </a>{" "}
roster files in an opinionated format inspired by the new 10th or <a href="https://www.newrecruit.eu/">New Recruit</a> roster files
edition datacards. Additional inspiration and large parts of the in an opinionated format inspired by the new 10th edition datacards.
parsing logic come from the{" "} Additional inspiration and large parts of the parsing logic come
from the{" "}
<a href="https://rweyrauch.github.io/PrettyScribe" target="_blank"> <a href="https://rweyrauch.github.io/PrettyScribe" target="_blank">
PrettyScribe PrettyScribe
</a>{" "} </a>{" "}
@@ -420,7 +439,7 @@ function App() {
<div style={{ padding: "8px 0", fontSize: "1.7rem" }}> <div style={{ padding: "8px 0", fontSize: "1.7rem" }}>
Output Examples Output Examples
</div> </div>
<img src={Demo0} style={{ width: "100%" }} /> <img src={Demo0} className="pb-4" style={{ width: "100%" }} />
<img src={Demo1} style={{ width: "100%" }} /> <img src={Demo1} style={{ width: "100%" }} />
</div> </div>
</div> </div>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 KiB

After

Width:  |  Height:  |  Size: 50 KiB

+1 -1
View File
@@ -152,7 +152,7 @@
.rosterUploaded, .rosterUploaded,
.rosterUploaded:hover { .rosterUploaded:hover {
height: auto; height: auto;
border: 2px solid #999; border-width: 2px;
font-size: 1rem; font-size: 1rem;
border-radius: 8px; border-radius: 8px;
} }