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
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@ import TabBar from "./TabBar.mjs"
import SongList from "./SongList.mjs"
import SongList from "./SongList.mjs"


// Die Haupt-Layout-Komponente der Anwendung.
// Die Haupt-Layout-Komponente der Anwendung.
const AppLayout = {
export const AppLayout = {
    currentView: "all", // Aktuell ausgewählter Tab (z.B. 'all', 'favorites', 'popular')
    currentView: "all", // Aktuell ausgewählter Tab (z.B. 'all', 'favorites', 'popular')
    searchTerm: "", // Aktueller Suchbegriff aus der Suchleiste
    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
Original line number Original line Diff line number Diff line
@@ -20,6 +20,6 @@
        </div>
        </div>


        <script src="https://unpkg.com/mithril/mithril.js"></script>
        <script src="https://unpkg.com/mithril/mithril.js"></script>
        <script type="module" src="app.mjs"></script>
        <script type="module" src="karaokatalog.mjs"></script>
    </body>
    </body>
</html>
</html>
+11 −0
Original line number Original line 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,
})