feat: Implement initial UI design system, theming, and classroom learning page.

This commit is contained in:
supalerk-ar66 2026-01-27 11:31:08 +07:00
parent 8b403f906a
commit 90d50dc84a
4 changed files with 78 additions and 21 deletions

View file

@ -1,10 +1,21 @@
export default defineNuxtPlugin(() => {
// Client-side only theme initialization to prevent flash of wrong theme
export default defineNuxtPlugin((nuxtApp) => {
const { $q } = useQuasar()
// ฟังก์ชันสลับโหมดและ Sync กับ Quasar
const updateTheme = (isDark: boolean) => {
if (isDark) {
document.documentElement.classList.add('dark')
if ($q) $q.dark.set(true)
} else {
document.documentElement.classList.remove('dark')
if ($q) $q.dark.set(false)
}
}
// ตอนเริ่มทำงานบน Client
if (process.client) {
const saved = localStorage.getItem('theme')
const isDark = saved === 'dark' || (!saved && window.matchMedia('(prefers-color-scheme: dark)').matches)
const savedTheme = localStorage.getItem('theme')
const isDark = savedTheme === 'dark' || (!savedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches)
// Apply class immediately for Tailwind
document.documentElement.classList.toggle('dark', isDark)
}
})