Overhaul the web UI with CSS custom property-based theming and dark mode support. Extract reusable template partials (location search, scan input) and web components (photo-capture, searchable-select). Add version and commit info to page footer. - Replace hardcoded amber palette with semantic theme tokens - Add dark mode with localStorage persistence and system preference detection - Extract <brew-photo-capture> and <searchable-select> web components - Extract location_search and scan_input Askama macros - Add sun/moon, timeline, database, map icons - Display version and git commit in footer - Improve timeline coordinate rounding and map link formatting - Add roast_name, roaster_name, remaining to BagOptionView
26 lines
820 B
JavaScript
26 lines
820 B
JavaScript
customElements.define("brew-photo-capture", class extends HTMLElement {
|
|
connectedCallback() {
|
|
const input = document.createElement("input");
|
|
input.type = "file";
|
|
input.accept = "image/*";
|
|
input.capture = "environment";
|
|
input.hidden = true;
|
|
this.appendChild(input);
|
|
|
|
this.addEventListener("click", (e) => {
|
|
if (e.target !== input) input.click();
|
|
});
|
|
|
|
input.addEventListener("change", () => {
|
|
const file = input.files[0];
|
|
if (!file) return;
|
|
const reader = new FileReader();
|
|
reader.onload = () => {
|
|
document.getElementById(this.getAttribute("target-input")).value = reader.result;
|
|
document.getElementById(this.getAttribute("target-form")).requestSubmit();
|
|
};
|
|
reader.readAsDataURL(file);
|
|
input.value = "";
|
|
});
|
|
}
|
|
});
|