diff --git a/htmlpage/static.go b/htmlpage/static.go new file mode 100644 index 00000000..0a544c00 --- /dev/null +++ b/htmlpage/static.go @@ -0,0 +1,20 @@ +package htmlpage + +import ( + "embed" + "net/http" + + "github.com/go-chi/chi/v5" +) + +//go:embed static/* +var EmbeddedStaticFS embed.FS + +var localFS http.Dir + +func AddStaticRoute(r chi.Router, path string) { + if localFS == "" { + localFS = http.Dir("./htmlpage/static") + } + FileServer(r, "/static", localFS, EmbeddedStaticFS, "static") +} diff --git a/htmlpage/static/js/address-display.js b/htmlpage/static/js/address-display.js new file mode 100644 index 00000000..051e147b --- /dev/null +++ b/htmlpage/static/js/address-display.js @@ -0,0 +1,127 @@ +class AddressDisplay extends HTMLElement { + constructor() { + super(); + + // Create a shadow DOM + this.attachShadow({mode: "open" }); + + // Initial render + this.render(); + + // Element references + this._locationDisplay = this.shadowRoot.querySelector(".location-display"); + this._streetAddress = this.shadowRoot.querySelector(".street-address"); + this._postCode = this.shadowRoot.querySelector(".post-code"); + this._district = this.shadowRoot.querySelector(".district"); + this._region = this.shadowRoot.querySelector(".region"); + this._country = this.shadowRoot.querySelector(".country"); + } + + // Initial render of component + render() { + this.shadowRoot.innerHTML = ` + + +
Please provide the location of the potential mosquito breeding source. We may be able to extract this information from your photos if they contain location data.