Skip to content

Commit

Permalink
change text on lifetime after booster used
Browse files Browse the repository at this point in the history
  • Loading branch information
saertna committed Oct 17, 2023
1 parent 5c5efaf commit 67cd0df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion main.js

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1415,21 +1415,23 @@ class MultiSelectModal extends Modal {
label.innerHTML = `${labelText} : (${stock})`;
//const useButton = document.createElement('button');
useButton.innerText = `cooldown ${hoursUntilMinutesPassed(window.moment(this.gamificationInstance.getSetting(this.getBoosterDateFromName(labelText)), 'YYYY-MM-DD HH:mm:ss'),this.getBoosterCooldownFromName(labelText))} hours`;

useButton.id = `use-button-${labelText.replace(' ','-')}`;
useButton.onclick = () => {
new ModalInformationbox(this.app, `${labelText} is for ${hoursUntilMinutesPassed(window.moment(this.gamificationInstance.getSetting(this.getBoosterDateFromName(labelText)), 'YYYY-MM-DD HH:mm:ss'),this.getBoosterCooldownFromName(labelText))} hours in cooldown and can only then be used again.`).open();
};
} else {
label.innerHTML = `${labelText} : (${stock})`;
//const useButton = document.createElement('button');
useButton.innerText = 'Use';
useButton.id = `use-button-${labelText.replace(' ','-')}`;
useButton.onclick = () => {
this.useBoosterItem(labelText);
};
}

const useInfoButton = document.createElement('button');
useInfoButton.innerText = '?';
useInfoButton.id = `information-${labelText.replace(' ','-')}`;
useInfoButton.onclick = () => {
new ModalInformationbox(this.app, this.getBoosterInforFromFromName(labelText)).open();
};
Expand Down Expand Up @@ -1495,6 +1497,10 @@ class MultiSelectModal extends Modal {
stockInfo.innerHTML = ''; // Clear the current content
stockInfo.innerHTML = `${labelText} : (${stock})`
}
const buttonUse = document.querySelector(`#use-button-${labelText.replace(' ','-')}`);
if (buttonUse && isMinutesPassed(window.moment(this.gamificationInstance.getSetting(this.getBoosterDateFromName(labelText)), 'YYYY-MM-DD HH:mm:ss'),this.getBoosterCooldownFromName(labelText)) == false){
buttonUse.setText(`cooldown ${hoursUntilMinutesPassed(window.moment(this.gamificationInstance.getSetting(this.getBoosterDateFromName(labelText)), 'YYYY-MM-DD HH:mm:ss'),this.getBoosterCooldownFromName(labelText))} hours`)
}
}


Expand All @@ -1515,6 +1521,7 @@ class MultiSelectModal extends Modal {
return true;
}


private useIngrediments(incredients: {name: string; incredients: string[];}) {
console.log(`useIngrediments: ${incredients}`)
for (const ingredient of incredients.incredients) {
Expand All @@ -1533,6 +1540,7 @@ class MultiSelectModal extends Modal {
return true;
}


private updateStockInformation() {
const stockInfo = document.querySelector('.stock-info');
if (stockInfo) {
Expand Down

0 comments on commit 67cd0df

Please sign in to comment.