Flask + Vue rewrite of the classic-ASP shopdb, built as a plugin framework so sister GE Aerospace sites can adopt it. Product version 0.7.0-pre-0.8.0, plugin contract 0.11.0, 966 backend tests. Key entry points: - docs/INSTALL-WINDOWS-IIS.md - tested Windows + IIS install runbook (own-site and subpath deployment methods) - docs/PILOT-DEPLOY.md - production pilot: stand up + import + verify - docs/IMPORT-API.md - schema-agnostic legacy data import contract - scripts/site_imports/wjf/ - West Jefferson reference import loader - docs/adr/ - twelve accepted architecture decision records
40 lines
948 B
JavaScript
40 lines
948 B
JavaScript
import { ref, watch } from 'vue'
|
|
|
|
const STORAGE_KEY = 'shopdb-theme'
|
|
|
|
// Get initial theme from localStorage or system preference
|
|
function getInitialTheme() {
|
|
const stored = localStorage.getItem(STORAGE_KEY)
|
|
if (stored) return stored
|
|
|
|
// Fall back to system preference
|
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
return 'dark'
|
|
}
|
|
return 'light'
|
|
}
|
|
|
|
export const currentTheme = ref(getInitialTheme())
|
|
|
|
// Apply theme to document
|
|
function applyTheme(theme) {
|
|
document.documentElement.setAttribute('data-theme', theme)
|
|
localStorage.setItem(STORAGE_KEY, theme)
|
|
}
|
|
|
|
// Initialize on load
|
|
applyTheme(currentTheme.value)
|
|
|
|
// Watch for changes
|
|
watch(currentTheme, (newTheme) => {
|
|
applyTheme(newTheme)
|
|
})
|
|
|
|
export function toggleTheme() {
|
|
currentTheme.value = currentTheme.value === 'dark' ? 'light' : 'dark'
|
|
}
|
|
|
|
export function setTheme(theme) {
|
|
currentTheme.value = theme
|
|
}
|