Adding in buildname to EDOMH Export

This commit is contained in:
Alex Williams
2024-06-07 10:06:53 +01:00
parent 4efc47dff0
commit ee04416e2b
3 changed files with 15 additions and 6 deletions

View File

@@ -12,7 +12,8 @@ const base64url = require('base64url');
export default class ModalShoppingList extends TranslatedComponent {
static propTypes = {
ship: PropTypes.object.isRequired
ship: PropTypes.object.isRequired,
buildName: PropTypes.string
};
/**
@@ -156,6 +157,7 @@ export default class ModalShoppingList extends TranslatedComponent {
sendToEDOMH(event) {
event.preventDefault();
const ship = this.props.ship;
const buildName = this.props.buildName;
let blueprints = [];
//create the json
@@ -216,15 +218,18 @@ export default class ModalShoppingList extends TranslatedComponent {
}
}
let shipName = buildName + " - " + ship.name;
//create JSON to encode
let baseJson = {
"version":1,
"name":ship.name, // TO-DO: Import build name and put that here correctly
"name": shipName, // TO-DO: Import build name and put that here correctly
"items": blueprints
}
let JSONString = JSON.stringify(baseJson)
console.log(JSONString)
console.log(ship)
let deflated = zlib.deflateSync(JSONString)
//actually encode
@@ -333,6 +338,7 @@ export default class ModalShoppingList extends TranslatedComponent {
this.sendToEDOMH = this.sendToEDOMH.bind(this);
return <div className='modal' onClick={ (e) => e.stopPropagation() }>
<h2>{translate('PHRASE_SHOPPING_MATS')}</h2>
<p>{translate('PHRASE_DIFFERENT_ROLLS')}</p>
{/* <label>{translate('Grade 1 rolls ')}</label>
<input id={1} type={'number'} min={0} defaultValue={this.state.matsPerGrade[1]} onChange={this.changeHandler} />
<br/>

View File

@@ -26,6 +26,7 @@
"PHRASE_NO_SPECIAL": "No experimental effect",
"PHRASE_SHOPPING_LIST": "Stations that sell this build",
"PHRASE_SHOPPING_MATS": "Materials needed for this build",
"PHRASE_DIFFERENT_ROLLS": "NOTE: ED Engineer and/or EDOMH likely have their own 'rolls' configuration, so material requirements may differ!",
"PHRASE_REFIT_SHOPPING_LIST": "Stations that sell required modules",
"PHRASE_TOTAL_EFFECTIVE_SHIELD": "Total amount of damage that can be taken from each damage type, if using all shield cells",
"PHRASE_TIME_TO_LOSE_SHIELDS": "Shields will hold for",
@@ -81,9 +82,9 @@
"TT_SUMMARY_UNLADEN_TOTAL_JUMP": "Farthest possible range with no cargo, a full fuel tank, and jumping as far as possible each time",
"TT_SUMMARY_LADEN_TOTAL_JUMP": "Farthest possible range with full cargo, a full fuel tank, and jumping as far as possible each time",
"HELP_MODIFICATIONS_MENU": "Click on a number to enter a new value, or drag along the bar for small changes",
"PHRASE_FAIL_EDENGINEER": "Failed to send to EDEngineer (Launch EDEngineer and make sure the API is started then refresh the page.)",
"PHRASE_ENSURE_EDOMH": "Ensure EDO Material Helper is running, else this button will do nothing!",
"PHRASE_FIREFOX_EDENGINEER": "Sending to EDEngineer is not compatible with Firefox's security settings. Please try again with Chrome.",
"PHRASE_FAIL_EDENGINEER": "Failed to send to EDEngineer (Launch EDEngineer and make sure the API is started then refresh the page.)",
"PHRASE_ENSURE_EDOMH": "Ensure EDO Material Helper is installed and registered to handle edomh:// urls, else this button will do nothing!",
"PHRASE_FIREFOX_EDENGINEER": "Sending to EDEngineer is not compatible with Firefox's security settings. Please try again with Chrome.",
"PHRASE_FAILED_TO_FIND_EDENGINEER": "Failed to find ED Engineer API. Please ensure it is running and try again.",
"MISSING_MODULES": "Missing Modules",
"am": "Auto Field-Maintenance Unit",

View File

@@ -700,7 +700,9 @@ export default class OutfittingPage extends Page {
* Generates the shopping list
*/
_genShoppingList() {
this.context.showModal(<ModalShoppingList ship={this.state.ship} />);
this.context.showModal(<ModalShoppingList
ship={this.state.ship}
buildName={this.state.buildName} />);
}
/**