| 1 | import { createStore } from "/js/AlpineStore.js"; |
| 2 | |
| 3 | // Sidebar Bottom store manages version info display |
| 4 | const model = { |
| 5 | versionNo: "", |
| 6 | commitTime: "", |
| 7 | |
| 8 | get versionLabel() { |
| 9 | return this.versionNo && this.commitTime |
| 10 | ? `Version ${this.versionNo} ${this.commitTime}` |
| 11 | : ""; |
| 12 | }, |
| 13 | |
| 14 | init() { |
| 15 | // Load version info from global scope (exposed in index.html) |
| 16 | const gi = globalThis.gitinfo; |
| 17 | if (gi && gi.version && gi.commit_time) { |
| 18 | this.versionNo = gi.version; |
| 19 | this.commitTime = gi.commit_time; |
| 20 | } |
| 21 | }, |
| 22 | }; |
| 23 | |
| 24 | export const store = createStore("sidebarBottom", model); |
| 25 |