From 611b620f885c0e30d8eb33ae3b02d9ce4072e8a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 04:04:55 +0000 Subject: [PATCH 01/15] Bump requirejs from 2.3.6 to 2.3.7 Bumps [requirejs](https://github.com/jrburke/r.js) from 2.3.6 to 2.3.7. - [Commits](https://github.com/jrburke/r.js/compare/2.3.6...2.3.7) --- updated-dependencies: - dependency-name: requirejs dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e8e0438..15847faa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,7 +100,7 @@ "less": "^3.13.1", "markdown-loader-jest": "^0.1.1", "prettier": "^3.0.3", - "requirejs": "^2.3.6", + "requirejs": "^2.3.7", "terser-webpack-plugin": "^4.2.3", "ts-jest": "^29.1.1", "ts-loader": "^6.2.2", @@ -17276,9 +17276,9 @@ } }, "node_modules/requirejs": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", - "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", + "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", "dev": true, "bin": { "r_js": "bin/r.js", @@ -33520,9 +33520,9 @@ "dev": true }, "requirejs": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", - "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", + "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", "dev": true }, "requires-port": { diff --git a/package.json b/package.json index 801c1446..ed4f0626 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "less": "^3.13.1", "markdown-loader-jest": "^0.1.1", "prettier": "^3.0.3", - "requirejs": "^2.3.6", + "requirejs": "^2.3.7", "terser-webpack-plugin": "^4.2.3", "ts-jest": "^29.1.1", "ts-loader": "^6.2.2", From c4a333a0c282a00fb236027c39d825f2a738eea6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 04:05:41 +0000 Subject: [PATCH 02/15] Bump ws, socket.io-adapter, engine.io and engine.io-client Bumps [ws](https://github.com/websockets/ws), [socket.io-adapter](https://github.com/socketio/socket.io-adapter), [engine.io](https://github.com/socketio/engine.io) and [engine.io-client](https://github.com/socketio/engine.io-client). These dependencies needed to be updated together. Updates `ws` from 8.13.0 to 8.17.1 - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.13.0...8.17.1) Updates `socket.io-adapter` from 2.5.2 to 2.5.5 - [Release notes](https://github.com/socketio/socket.io-adapter/releases) - [Changelog](https://github.com/socketio/socket.io-adapter/blob/2.5.5/CHANGELOG.md) - [Commits](https://github.com/socketio/socket.io-adapter/compare/2.5.2...2.5.5) Updates `engine.io` from 6.5.2 to 6.5.5 - [Release notes](https://github.com/socketio/engine.io/releases) - [Changelog](https://github.com/socketio/engine.io/blob/6.5.5/CHANGELOG.md) - [Commits](https://github.com/socketio/engine.io/compare/6.5.2...6.5.5) Updates `engine.io-client` from 6.5.2 to 6.5.4 - [Release notes](https://github.com/socketio/engine.io-client/releases) - [Changelog](https://github.com/socketio/engine.io-client/blob/6.5.4/CHANGELOG.md) - [Commits](https://github.com/socketio/engine.io-client/compare/6.5.2...6.5.4) --- updated-dependencies: - dependency-name: ws dependency-type: indirect - dependency-name: socket.io-adapter dependency-type: indirect - dependency-name: engine.io dependency-type: indirect - dependency-name: engine.io-client dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 146 ++++++++++------------------------------------ 1 file changed, 32 insertions(+), 114 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1e8e0438..0e0ab9ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8316,9 +8316,9 @@ } }, "node_modules/engine.io": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.2.tgz", - "integrity": "sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.5.tgz", + "integrity": "sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==", "dependencies": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", @@ -8329,44 +8329,24 @@ "cors": "~2.8.5", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.11.0" + "ws": "~8.17.1" }, "engines": { "node": ">=10.2.0" } }, "node_modules/engine.io-client": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz", - "integrity": "sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", + "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.11.0", + "ws": "~8.17.1", "xmlhttprequest-ssl": "~2.0.0" } }, - "node_modules/engine.io-client/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/engine.io-parser": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", @@ -8383,26 +8363,6 @@ "node": ">= 0.6" } }, - "node_modules/engine.io/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/enhanced-resolve": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz", @@ -17955,31 +17915,12 @@ } }, "node_modules/socket.io-adapter": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", - "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz", + "integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==", "dependencies": { - "ws": "~8.11.0" - } - }, - "node_modules/socket.io-adapter/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "debug": "~4.3.4", + "ws": "~8.17.1" } }, "node_modules/socket.io-client": { @@ -20238,10 +20179,9 @@ } }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dev": true, + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, @@ -26892,9 +26832,9 @@ } }, "engine.io": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.2.tgz", - "integrity": "sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.5.5.tgz", + "integrity": "sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==", "requires": { "@types/cookie": "^0.4.1", "@types/cors": "^2.8.12", @@ -26905,40 +26845,26 @@ "cors": "~2.8.5", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.11.0" + "ws": "~8.17.1" }, "dependencies": { "cookie": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==" - }, - "ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "requires": {} } } }, "engine.io-client": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz", - "integrity": "sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", + "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", "requires": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.11.0", + "ws": "~8.17.1", "xmlhttprequest-ssl": "~2.0.0" - }, - "dependencies": { - "ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "requires": {} - } } }, "engine.io-parser": { @@ -34068,19 +33994,12 @@ } }, "socket.io-adapter": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz", - "integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==", + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz", + "integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==", "requires": { - "ws": "~8.11.0" - }, - "dependencies": { - "ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "requires": {} - } + "debug": "~4.3.4", + "ws": "~8.17.1" } }, "socket.io-client": { @@ -35742,10 +35661,9 @@ } }, "ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "dev": true, + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "requires": {} }, "xml-name-validator": { From 4e37edd96cdd424600e68ed86186edcc6a9651ab Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 27 Jul 2024 04:55:10 +0000 Subject: [PATCH 03/15] 3.11.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 60c265b6..60fe621b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "improved-initiative", - "version": "3.11.3", + "version": "3.11.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "improved-initiative", - "version": "3.11.3", + "version": "3.11.4", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 18be3889..2a8fd3ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "improved-initiative", - "version": "3.11.3", + "version": "3.11.4", "description": "Combat tracker for Dungeons and Dragons (D&D) 5th Edition", "license": "MIT", "repository": { From a8ed5595fa14183c6b915718adeef7c08576d1ce Mon Sep 17 00:00:00 2001 From: Evan Bailey Date: Fri, 2 Aug 2024 01:12:10 -0700 Subject: [PATCH 04/15] Display rendering error for a bad statblock --- client/Components/StatBlock.tsx | 362 +++++++++++++++++--------------- 1 file changed, 187 insertions(+), 175 deletions(-) diff --git a/client/Components/StatBlock.tsx b/client/Components/StatBlock.tsx index 3fe52d54..9d19aa4f 100644 --- a/client/Components/StatBlock.tsx +++ b/client/Components/StatBlock.tsx @@ -19,201 +19,213 @@ export function StatBlockComponent(props: StatBlockProps) { const textEnricher = useContext(TextEnricherContext); const statBlock = props.statBlock; - const modifierTypes = [ - { name: "Saves", data: statBlock.Saves }, - { name: "Skills", data: statBlock.Skills } - ]; - - const keywordSetTypes = [ - { name: "Senses", data: statBlock.Senses }, - { name: "Damage Vulnerabilities", data: statBlock.DamageVulnerabilities }, - { name: "Damage Resistances", data: statBlock.DamageResistances }, - { name: "Damage Immunities", data: statBlock.DamageImmunities }, - { name: "Condition Immunities", data: statBlock.ConditionImmunities }, - { name: "Languages", data: statBlock.Languages } - ]; - - const powerTypes = [ - { name: "Traits", data: statBlock.Traits }, - { name: "Actions", data: statBlock.Actions }, - { name: "Bonus Actions", data: statBlock.BonusActions }, - { name: "Reactions", data: statBlock.Reactions }, - { name: "Legendary Actions", data: statBlock.LegendaryActions }, - { name: "Mythic Actions", data: statBlock.MythicActions } - ]; - - const headerEntries = ( - <> - {props.hideName || ( - - )} - -
- - ); - - const statEntries = ( - <> -
- Armor Class - {statBlock.AC.Value} - - {textEnricher.EnrichText(statBlock.AC.Notes)} - -
+ try { + const modifierTypes = [ + { name: "Saves", data: statBlock.Saves }, + { name: "Skills", data: statBlock.Skills } + ]; + + const keywordSetTypes = [ + { name: "Senses", data: statBlock.Senses }, + { name: "Damage Vulnerabilities", data: statBlock.DamageVulnerabilities }, + { name: "Damage Resistances", data: statBlock.DamageResistances }, + { name: "Damage Immunities", data: statBlock.DamageImmunities }, + { name: "Condition Immunities", data: statBlock.ConditionImmunities }, + { name: "Languages", data: statBlock.Languages } + ]; + + const powerTypes = [ + { name: "Traits", data: statBlock.Traits }, + { name: "Actions", data: statBlock.Actions }, + { name: "Bonus Actions", data: statBlock.BonusActions }, + { name: "Reactions", data: statBlock.Reactions }, + { name: "Legendary Actions", data: statBlock.LegendaryActions }, + { name: "Mythic Actions", data: statBlock.MythicActions } + ]; + + const headerEntries = ( + <> + {props.hideName || ( + + )} -
- Hit Points - {statBlock.HP.Value} - - {textEnricher.EnrichText(statBlock.HP.Notes)} - -
+
+ + ); -
- Speed - - {statBlock.Speed.map((speed, i) => ( - - {speed} - - ))} - -
+ const statEntries = ( + <> +
+ Armor Class + {statBlock.AC.Value} + + {textEnricher.EnrichText(statBlock.AC.Notes)} + +
+ +
+ Hit Points + {statBlock.HP.Value} + + {textEnricher.EnrichText(statBlock.HP.Notes)} + +
-
- {Object.keys(StatBlock.Default().Abilities).map(abilityName => { - const abilityScore = statBlock.Abilities[abilityName]; - const abilityModifier = - textEnricher.GetEnrichedModifierFromAbilityScore(abilityScore); - return ( -
-
{abilityName}
- {abilityScore} - - {abilityModifier} +
+ Speed + + {statBlock.Speed.map((speed, i) => ( + + {speed} -
- ); - })} -
+ ))} + +
-
- -
- {modifierTypes - .filter(modifierType => modifierType.data.length > 0) - .map(modifierType => ( -
- {modifierType.name} - {modifierType.data.map((modifier, i) => ( - - {modifier.Name} - {textEnricher.EnrichModifier(modifier.Modifier)}{" "} +
+ {Object.keys(StatBlock.Default().Abilities).map(abilityName => { + const abilityScore = statBlock.Abilities[abilityName]; + const abilityModifier = + textEnricher.GetEnrichedModifierFromAbilityScore(abilityScore); + return ( +
+
{abilityName}
+ {abilityScore} + + {abilityModifier} - ))} -
- ))} -
+
+ ); + })} +
-
- {keywordSetTypes - .filter(keywordSetType => keywordSetType.data.length > 0) - .map(keywordSetType => ( -
- {keywordSetType.name} - - - {keywordSetType.data.map((keyword, index) => { - return ( - - {keyword} - - ); - })} - - -
- ))} -
+
- {statBlock.Challenge && ( -
- - {statBlock.Player == "player" ? "Level" : "Challenge"} - - {statBlock.Challenge} +
+ {modifierTypes + .filter(modifierType => modifierType.data.length > 0) + .map(modifierType => ( +
+ {modifierType.name} + {modifierType.data.map((modifier, i) => ( + + {modifier.Name} + {textEnricher.EnrichModifier(modifier.Modifier)}{" "} + + ))} +
+ ))}
- )} - -
- - ); - - const actionEntries = powerTypes - .filter(powerType => powerType?.data?.length > 0) - .map(powerType => ( -
-

{powerType.name}

- {powerType.data.map((power, j) => ( -
- {power.Name?.length ? ( - {power.Name} - ) : null} - {power.Usage && {power.Usage}} - - {textEnricher.EnrichText(power.Content)} + +
+ {keywordSetTypes + .filter(keywordSetType => keywordSetType.data.length > 0) + .map(keywordSetType => ( +
+ {keywordSetType.name} + + + {keywordSetType.data.map((keyword, index) => { + return ( + + {keyword} + + ); + })} + + +
+ ))} +
+ + {statBlock.Challenge && ( +
+ + {statBlock.Player == "player" ? "Level" : "Challenge"} + {statBlock.Challenge}
- ))} + )} +
-
- )); + + ); + + const actionEntries = powerTypes + .filter(powerType => powerType?.data?.length > 0) + .map(powerType => ( +
+

{powerType.name}

+ {powerType.data.map((power, j) => ( +
+ {power.Name?.length ? ( + {power.Name} + ) : null} + {power.Usage && {power.Usage}} + + {textEnricher.EnrichText(power.Content)} + +
+ ))} +
+
+ )); - const description = statBlock.Description && ( -
- {textEnricher.EnrichText(statBlock.Description)} -
- ); + const description = statBlock.Description && ( +
+ {textEnricher.EnrichText(statBlock.Description)} +
+ ); - let innerEntries; + let innerEntries; - if (props.isLoading) { + if (props.isLoading) { + return ( +
+ {headerEntries} + +
+ ); + } + if (props.displayMode == "active") { + innerEntries = ( + <> + {actionEntries} + {statEntries} + + ); + } else { + innerEntries = ( + <> + {statEntries} + {actionEntries} + + ); + } return (
{headerEntries} - + {innerEntries} + {description}
); - } - if (props.displayMode == "active") { - innerEntries = ( - <> - {actionEntries} - {statEntries} - - ); - } else { - innerEntries = ( - <> - {statEntries} - {actionEntries} - + } catch (error) { + return ( +
+
+ There was a problem with this StatBlock: +
+
{error.toString()}
+
Please open it in the StatBlock Editor to check your JSON
+
); } - return ( -
- {headerEntries} - {innerEntries} - {description} -
- ); } From 3eff99acd950c203f5f4cb6c5684870f1dcf3512 Mon Sep 17 00:00:00 2001 From: Evan Bailey Date: Fri, 2 Aug 2024 01:12:23 -0700 Subject: [PATCH 05/15] Use courier for statblock json editor --- lesscss/components/statblock-editor.less | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lesscss/components/statblock-editor.less b/lesscss/components/statblock-editor.less index 2dadc57d..fadcc790 100644 --- a/lesscss/components/statblock-editor.less +++ b/lesscss/components/statblock-editor.less @@ -178,8 +178,7 @@ border: 1px solid var(--accent-white); } -.c-statblock-editor__json-section, -.c-statblock-editor__json-textarea { +.c-statblock-editor__json-section { flex-grow: 1; .c-statblock-editor__text { @@ -187,6 +186,11 @@ } } +.c-statblock-editor__json-textarea { + flex-grow: 1; + font-family: "Courier New", Courier, monospace; +} + .c-statblock-editor__title-row { flex-direction: row; justify-content: stretch; From a762bbf4f4adc541178404192ff1c66b6c720e6e Mon Sep 17 00:00:00 2001 From: Evan Bailey Date: Fri, 2 Aug 2024 01:18:13 -0700 Subject: [PATCH 06/15] Red monospace JSON error --- client/Components/StatBlock.tsx | 8 ++++---- lesscss/components/statblock.less | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/Components/StatBlock.tsx b/client/Components/StatBlock.tsx index 9d19aa4f..713570eb 100644 --- a/client/Components/StatBlock.tsx +++ b/client/Components/StatBlock.tsx @@ -220,11 +220,11 @@ export function StatBlockComponent(props: StatBlockProps) { } catch (error) { return (
-
- There was a problem with this StatBlock: +
+

There was a problem with this StatBlock:

+
{error.toString()}
+

Please open it in the StatBlock Editor to check your JSON

-
{error.toString()}
-
Please open it in the StatBlock Editor to check your JSON
); } diff --git a/lesscss/components/statblock.less b/lesscss/components/statblock.less index f8bf35d2..addbc145 100644 --- a/lesscss/components/statblock.less +++ b/lesscss/components/statblock.less @@ -255,3 +255,8 @@ .c-overlay .c-statblock { max-width: @fixed-column-width; } + +.c-statblock__error { + color: var(--red); + font-family: "Courier New", Courier, monospace; +} From b4c3748ad0cc50fb4d47ee7c9458417d03287b7d Mon Sep 17 00:00:00 2001 From: Evan Bailey Date: Fri, 2 Aug 2024 01:23:08 -0700 Subject: [PATCH 07/15] Use theme red --- lesscss/components/statblock-editor.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lesscss/components/statblock-editor.less b/lesscss/components/statblock-editor.less index fadcc790..a3b90726 100644 --- a/lesscss/components/statblock-editor.less +++ b/lesscss/components/statblock-editor.less @@ -215,7 +215,7 @@ } .c-statblock-editor__error { - text-decoration: underline red; + text-decoration: underline var(--red); } .c-statblock-editor__identity { From 1dc8459dbc0586776d349f6974c47a0cf3c63cbe Mon Sep 17 00:00:00 2001 From: Evan Bailey Date: Fri, 2 Aug 2024 01:23:21 -0700 Subject: [PATCH 08/15] Use toString() for error --- client/StatBlockEditor/StatBlockEditor.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/StatBlockEditor/StatBlockEditor.tsx b/client/StatBlockEditor/StatBlockEditor.tsx index 8882b020..829ec820 100644 --- a/client/StatBlockEditor/StatBlockEditor.tsx +++ b/client/StatBlockEditor/StatBlockEditor.tsx @@ -56,7 +56,7 @@ export class StatBlockEditor extends React.Component< public componentDidCatch(error, info) { this.setState({ editorMode: "json", - renderError: JSON.stringify(error) + renderError: error.toString() }); } @@ -74,9 +74,17 @@ export class StatBlockEditor extends React.Component< const buttons = ( <> -