|
|
|
/*
|
|
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
|
|
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
|
|
|
|
------------------------------------------------------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"forge.chapril.org/armen/armen/internal/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Build(ccs *components.Components) error {
|
|
|
|
staticFS, err := getStaticFS()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
router := ccs.Router
|
|
|
|
|
|
|
|
router.ServeFiles("/static/*filepath", staticFS)
|
|
|
|
|
|
|
|
router.Get("/", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
|
|
|
_ = newDashboard(ccs).
|
|
|
|
build().
|
|
|
|
Render(w)
|
|
|
|
}))
|
|
|
|
|
|
|
|
router.Get("/dashboard", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
|
|
|
_ = newDashboard(ccs).
|
|
|
|
build().
|
|
|
|
Render(w)
|
|
|
|
}))
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
######################################################################################################## @(°_°)@ #######
|
|
|
|
*/
|