Преглед изворни кода

refactor: resultsHeader/Body→ ResultProperties sig

tags/v0.3.0
bertieb пре 3 година
родитељ
комит
bccc86acc6
1 измењених фајлова са 12 додато и 12 уклоњено
  1. +12
    -12
      src/ts/frontend.ts

+ 12
- 12
src/ts/frontend.ts Прегледај датотеку

@@ -358,14 +358,14 @@ function resultsCard(resultsProperties: ResultProperties): JQuery<HTMLElement>{
* 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
let resultsBodyId = `resultsBody-${rollstats.numDice}`;
let resultsBodyId = `resultsBody-${resultProperties.itemId()}`;
let resultsTitle = `<div class="d-flex justify-content-between">`
resultsTitle += `<div>`
+ bigTitle(`Asphodice Results
<small class="h4 text-muted">
(<var>d=${rollstats.numDice}</var>)
(<var>d=${resultProperties.numDice}</var>)
</small>`)
+ `</div>`;
resultsTitle += `<div>
@@ -384,13 +384,13 @@ function resultsHeader(rollstats: RollStats): string {
* 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>`;
return resultsBody;
}
@@ -401,9 +401,9 @@ function resultsBody(rollstats: RollStats): string {
function addResults(resultProperties: ResultProperties): void {
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
//


Loading…
Откажи
Сачувај