selector.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { view } from "./view.js";
  2. import { cx_ui } from "./cx-ui.js";
  3. import { dictionary } from "./dictionary.js";
  4. import { shelf } from "./shelf.js";
  5. import { space } from "./space.js";
  6. export class selector extends view {
  7. #manager;
  8. #shelf() {
  9. this.#manager.view = new shelf(this.#manager);
  10. }
  11. #space() {
  12. this.#manager.view = new space(this.#manager);
  13. }
  14. constructor(manager) {
  15. super();
  16. this.#manager = manager;
  17. }
  18. show() {
  19. const lang = new dictionary();
  20. const container = cx_ui.div("selector");
  21. const shelf = cx_ui.div("shelf");
  22. const space = cx_ui.div("space");
  23. const shelf_icon = cx_ui.image(
  24. "shelf-image",
  25. "./static/icons/shelf.svg",
  26. () => { this.#shelf(); }
  27. );
  28. const space_icon = cx_ui.image(
  29. "space-icon",
  30. "./static/icons/space.svg",
  31. () => { this.#space(); }
  32. );
  33. const shelf_title = cx_ui.p("shelf-title", lang.get("selector.shelf"));
  34. const space_title = cx_ui.p("space-title", lang.get("selector.space"));
  35. shelf.appendChild(shelf_icon);
  36. shelf.appendChild(shelf_title);
  37. space.appendChild(space_icon);
  38. space.appendChild(space_title);
  39. container.appendChild(shelf);
  40. container.appendChild(space);
  41. return container;
  42. }
  43. }