Skip to content

Commit

Permalink
adds text changes when mode changes
Browse files Browse the repository at this point in the history
  • Loading branch information
joaovictor3g committed Apr 24, 2024
1 parent 72d97fe commit c7086bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions web/assets/js/components/modals/playground-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
renderExamplesInSelectInstance,
renderExpressionContent,
renderTabs,
setCost,
} from "../../utils/render-functions.js";
import { ModesService } from "../../services/modes.js";
import { ExampleService } from "../../services/examples.js";
Expand Down Expand Up @@ -183,12 +184,18 @@ function createInputElement(mode) {

function renderUIChangesByMode(mode) {
const titleEl = document.querySelector(".title.expression__square");
const inputTitleEl = document.querySelector(".title.input__square");
const toggleModeHolder = document.querySelector(".modes__container-holder");
const costText = document.querySelector(".cost__text");

titleEl.innerHTML = mode.name;
toggleModeHolder.innerHTML = mode.name;
inputTitleEl.innerHTML = mode.tabs.length > 1 ? "Inputs: " : "Input";
costText.innerHTML = mode.tabs.length > 1 ? "Total cost: " : "Cost: ";

ExampleService.getExampleContentById(mode).then((examples) => {
renderExpressionContent(mode, examples);
setCost("");
renderTabs(mode, examples);
renderExamplesInSelectInstance(mode, examples);
applyThemeToEditors();
Expand Down
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
>
</div>
</div>
<span class="text">Cost:</span>
<span class="text cost__text">Cost:</span>
</span>
<span id="cost"> - </span>
</span>
Expand Down

0 comments on commit c7086bb

Please sign in to comment.