Commit 6e224755 authored by Jakob Moser's avatar Jakob Moser
Browse files

Use mithril routing (currently in a bit stupid way)

parent 61eef26d
Loading
Loading
Loading
Loading
+1 −5
Changes for frontend/app.mjs: 1 added line, 5 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ import TabBar from "./TabBar.mjs"
import SongList from "./SongList.mjs"

// Die Haupt-Layout-Komponente der Anwendung.
const AppLayout = {
export const AppLayout = {
    currentView: "all", // Aktuell ausgewählter Tab (z.B. 'all', 'favorites', 'popular')
    searchTerm: "", // Aktueller Suchbegriff aus der Suchleiste

@@ -39,7 +39,3 @@ const AppLayout = {
        ]
    },
}

// Finde das Root-Element im HTML, in das die Mithril-Anwendung gemountet werden soll.
const appRoot = document.querySelector("body")
m.mount(appRoot, AppLayout)
+1 −1
Changes for frontend/index.html: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -20,6 +20,6 @@
        </div>

        <script src="https://unpkg.com/mithril/mithril.js"></script>
        <script type="module" src="app.mjs"></script>
        <script type="module" src="karaokatalog.mjs"></script>
    </body>
</html>
+11 −0
Changes for frontend/karaokatalog.mjs: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
// TODO Import mithril.mjs

import { AppLayout } from "./app.mjs";
import { Base } from "./components/pages/Base.mjs";

// See https://mithril.js.org/route.html#routing-strategies
// TODO m.route.prefix = ""
m.route(document.body, "/", {
    "/": AppLayout,
    "/favorites": AppLayout,
})