Minor adjustments, add "trending weekly"

pull/1216/head
tobspr 3 years ago
parent 8149ba875b
commit 39d6d3d565

@ -1,4 +1,3 @@
import { globalConfig } from "../core/config";
import { createLogger } from "../core/logging"; import { createLogger } from "../core/logging";
import { DialogWithForm } from "../core/modal_dialog_elements"; import { DialogWithForm } from "../core/modal_dialog_elements";
import { FormElementInput } from "../core/modal_dialog_forms"; import { FormElementInput } from "../core/modal_dialog_forms";
@ -11,8 +10,8 @@ import { Savegame } from "../savegame/savegame";
import { T } from "../translations"; import { T } from "../translations";
const navigation = { const navigation = {
categories: ["official", "top-rated", "trending", "new"], categories: ["official", "top-rated", "trending", "trending-weekly", "new"],
difficulties: ["easy", "medium", "hard", "short"], difficulties: ["easy", "medium", "hard"],
account: ["mine", "completed"], account: ["mine", "completed"],
}; };
@ -72,6 +71,7 @@ export class PuzzleMenuState extends TextualGameState {
<div class="categories subCategories"> <div class="categories subCategories">
</div> </div>
</div> </div>
@ -147,7 +147,10 @@ export class PuzzleMenuState extends TextualGameState {
activeCategory.classList.remove("active"); activeCategory.classList.remove("active");
} }
this.htmlElement.querySelector(`[data-root-category="${rootCategory}"]`).classList.add("active"); const newActiveCategory = this.htmlElement.querySelector(`[data-root-category="${rootCategory}"]`);
if (newActiveCategory) {
newActiveCategory.classList.add("active");
}
// Rerender buttons // Rerender buttons
@ -206,7 +209,7 @@ export class PuzzleMenuState extends TextualGameState {
elem.appendChild(stats); elem.appendChild(stats);
if ( if (
puzzle.downloads > 0 && puzzle.downloads > 3 &&
!["official", "easy", "medium", "hard"].includes(this.activeCategory) !["official", "easy", "medium", "hard"].includes(this.activeCategory)
) { ) {
const difficulty = document.createElement("div"); const difficulty = document.createElement("div");

@ -141,16 +141,17 @@ puzzleMenu:
new: New new: New
top-rated: Top Rated top-rated: Top Rated
mine: Created mine: Created
short: Short
easy: Easy easy: Easy
medium: Medium medium: Medium
hard: Hard hard: Hard
completed: Completed completed: Completed
official: Official official: Official
trending: Trending today trending: Trending today
trending-weekly: Trending weekly
categories: Categories categories: Categories
difficulties: By Difficulty difficulties: By Difficulty
account: My Puzzles account: My Puzzles
search: Search
difficulties: difficulties:
easy: Easy easy: Easy

Loading…
Cancel
Save