Browse Source

refactor: resultsHeader/Body→ ResultProperties sig

tags/v0.3.0
bertieb 3 years ago
parent
commit
bccc86acc6
1 changed files with 12 additions and 12 deletions
  1. +12
    -12
      src/ts/frontend.ts

+ 12
- 12
src/ts/frontend.ts View File

@@ -358,14 +358,14 @@ function resultsCard(resultsProperties: ResultProperties): JQuery<HTMLElement>{
* Set up results 'header' - class name (TODO) and number of dice rolled * Set up results 'header' - class name (TODO) and number of dice rolled
*/ */


function resultsHeader(rollstats: RollStats): string {
function resultsHeader(resultProperties: ResultProperties): string {
// Use flexbox (d-flex) for LHS/RHS justification // Use flexbox (d-flex) for LHS/RHS justification
let resultsBodyId = `resultsBody-${rollstats.numDice}`;
let resultsBodyId = `resultsBody-${resultProperties.itemId()}`;
let resultsTitle = `<div class="d-flex justify-content-between">` let resultsTitle = `<div class="d-flex justify-content-between">`
resultsTitle += `<div>` resultsTitle += `<div>`
+ bigTitle(`Asphodice Results + bigTitle(`Asphodice Results
<small class="h4 text-muted"> <small class="h4 text-muted">
(<var>d=${rollstats.numDice}</var>)
(<var>d=${resultProperties.numDice}</var>)
</small>`) </small>`)
+ `</div>`; + `</div>`;
resultsTitle += `<div> resultsTitle += `<div>
@@ -384,13 +384,13 @@ function resultsHeader(rollstats: RollStats): string {
* to be filled in afterwards * to be filled in afterwards
*/ */


function resultsBody(rollstats: RollStats): string {
let resultsBodyId = `resultsBody-${rollstats.numDice}`;
let resultsBody = `<div id="${resultsBodyId}" class="show row resultsToggle">`;
resultsBody += describeRolls(rollstats);
resultsBody += rerollReport(rollstats)
+ outcomesReport(rollstats)
+ outcomeBalancesReport(rollstats);
function resultsBody(resultProperties: ResultProperties): string {
let resultsBodyId = `resultsBody-${resultProperties.numDice}`;
let resultsBody = `<div id="${resultsBodyId}" class="show row resultsToggle ${resultProperties.variantClass()}">`;
resultsBody += describeRolls(resultProperties.rollstats);
resultsBody += rerollReport(resultProperties.rollstats)
+ outcomesReport(resultProperties.rollstats)
+ outcomeBalancesReport(resultProperties.rollstats);
resultsBody += `</div>`; resultsBody += `</div>`;
return resultsBody; return resultsBody;
} }
@@ -401,9 +401,9 @@ function resultsBody(rollstats: RollStats): string {
function addResults(resultProperties: ResultProperties): void { function addResults(resultProperties: ResultProperties): void {
let resultsCardBody = resultsCard(resultProperties); let resultsCardBody = resultsCard(resultProperties);


resultsCardBody.append(resultsHeader(resultProperties.rollstats));
resultsCardBody.append(resultsHeader(resultProperties));


resultsCardBody.append(resultsBody(resultProperties.rollstats));
resultsCardBody.append(resultsBody(resultProperties));


// Post-DOM-Construction generation // Post-DOM-Construction generation
// //


Loading…
Cancel
Save