feat: Implement initial e-learning platform frontend structure including dashboard, course management, authentication, and common UI components.

This commit is contained in:
supalerk-ar66 2026-02-27 10:05:33 +07:00
parent aceeb80d9a
commit ad11c6b7c5
44 changed files with 720 additions and 578 deletions

View file

@ -1,8 +1,8 @@
<script setup lang="ts">
/**
* @file FormInput.vue
* @description Reusable input component with label, error handling, and support for disabled/required states.
* Now supports password visibility toggle.
* @description คอมโพเนนตองกรอกขอม (Input) แบบนำกลบมาใชใหมได พรอมรองรบขอความปายกำก, ดการขอผดพลาด และสถานะปดใชงาน/งคบกรอก
* รองรบการสลบซอน/แสดงรหสผาน
*/
const props = defineProps<{
@ -16,19 +16,19 @@ const props = defineProps<{
}>()
const emit = defineEmits<{
/** Update v-model value */
/** อัปเดตค่า v-model (Update v-model value) */
'update:modelValue': [value: string]
}>()
// Password visibility state
// / (Password visibility state)
const showPassword = ref(false)
// Toggle function
// (Toggle function)
const togglePassword = () => {
showPassword.value = !showPassword.value
}
// Compute input type based on visibility state
// بناءً pada state (Compute input type based on visibility state)
const inputType = computed(() => {
if (props.type === 'password') {
return showPassword.value ? 'text' : 'password'
@ -59,7 +59,7 @@ const updateValue = (event: Event) => {
@input="updateValue"
>
<!-- Password Toggle Button -->
<!-- มสลบซอน/แสดงรหสผาน (Password Toggle Button) -->
<button
v-if="type === 'password'"
type="button"
@ -67,13 +67,13 @@ const updateValue = (event: Event) => {
@click="togglePassword"
tabindex="-1"
>
<!-- Eye Icon (Show) -->
<!-- ไอคอนเปดตา (แสดงรหสผาน) (Eye Icon - Show) -->
<svg v-if="!showPassword" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
<!-- Eye Off Icon (Hide) -->
<!-- ไอคอนปดตา (อนรหสผาน) (Eye Off Icon - Hide) -->
<svg v-else xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M9.88 9.88a3 3 0 1 0 4.24 4.24"/>
<path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/>

View file

@ -1,20 +1,20 @@
<script setup lang="ts">
/**
* @file GlobalLoader.vue
* @description Global full-screen loading overlay that triggers during page navigation.
* Uses a premium pulsing logo animation.
* @description คอมโพเนนตหนาจอโหลดแบบเตมจอ (Global full-screen loading) แสดงผลตอนเปลยนหน
* พรมแอนเมชนโลโกขยบไดแบบพรเมยม
*/
const nuxtApp = useNuxtApp()
const isLoading = ref(false)
// Hook into Nuxt page transitions
// Nuxt hook (Hook into Nuxt page transitions)
nuxtApp.hook('page:start', () => {
isLoading.value = true
})
nuxtApp.hook('page:finish', () => {
// Add a small delay for better UX (prevents flickering on fast loads)
// (Add a small delay for better UX)
setTimeout(() => {
isLoading.value = false
}, 500)
@ -25,14 +25,14 @@ nuxtApp.hook('page:finish', () => {
<Transition name="fade">
<div v-if="isLoading" class="fixed inset-0 z-[99999] flex flex-col items-center justify-center bg-white dark:bg-[#0f172a] transition-colors duration-300">
<div class="relative flex flex-col items-center">
<!-- Main Logo Box -->
<!-- กลองโลโกหล (Main Logo Box) -->
<div class="w-20 h-20 bg-blue-50 dark:bg-blue-900/20 rounded-2xl flex items-center justify-center mb-6 animate-pulse-soft">
<div class="w-12 h-12 bg-blue-600 rounded-xl flex items-center justify-center shadow-lg shadow-blue-600/30 animate-bounce-subtle">
<span class="text-2xl font-black text-white">E</span>
</div>
</div>
<!-- Loading Text -->
<!-- อความระหวางโหลด (Loading Text) -->
<div class="flex flex-col items-center gap-2">
<h3 class="text-lg font-bold text-slate-800 dark:text-white tracking-wide">e-Learning</h3>
<div class="flex gap-1">

View file

@ -1,13 +1,13 @@
<script setup lang="ts">
/**
* @file LanguageSwitcher.vue
* @description Language switcher component using Quasar dropdown.
* Allows switching between Thai (th) and English (en) locales.
* @description คอมโพเนนตวสลบภาษาใช Dropdown ของ Quasar
* ใชสลบระหวางภาษาไทย (th) และภาษาองกฤษ (en)
*/
const { locale, setLocale, locales } = useI18n()
// Get available locales with their names
// (Get available locales with their names)
const availableLocales = computed(() => {
return (locales.value as Array<{ code: string; name: string }>).map((loc) => ({
code: loc.code,
@ -15,13 +15,13 @@ const availableLocales = computed(() => {
}))
})
// Get flag image path for a locale
// (Get flag image path for a locale)
const getFlagPath = (code: string) => `/flags/${code}.png`
// Handle locale change
// (Handle locale change)
const changeLocale = async (code: string) => {
await setLocale(code as 'th' | 'en')
// Cookie is automatically handled by @nuxtjs/i18n with detectBrowserLanguage.useCookie
// (Cookie) @nuxtjs/i18n detectBrowserLanguage.useCookie
}
</script>
@ -32,7 +32,7 @@ const changeLocale = async (code: string) => {
class="language-btn"
:aria-label="$t('language.label')"
>
<!-- Show current locale flag -->
<!-- แสดงธงชาตตามภาษาทใชอย (Show current locale flag) -->
<img
:src="getFlagPath(locale)"
:alt="locale.toUpperCase()"
@ -178,7 +178,7 @@ const changeLocale = async (code: string) => {
</style>
<style>
/* Global styles for teleported menu */
/* สไตล์ Global สำหรับเมนูที่ถูกข้ามไปแสดงผลที่อื่นด้วย Teleport (Global styles for teleported menu) */
.language-menu {
border-radius: 16px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);

View file

@ -1,4 +1,8 @@
<script setup lang="ts">
/**
* @file LoadingSkeleton.vue
* @description คอมโพเนนต Skeleton สำหรบแสดงโครงรางหนาจอระหวางรอโหลดขอม (Loading Skeleton Component)
*/
defineProps<{
type?: 'text' | 'avatar' | 'card' | 'button'
width?: string
@ -9,6 +13,7 @@ defineProps<{
<template>
<div class="skeleton-wrapper">
<!-- กรณเปนโครงรางประเภทการ (Card type skeleton) -->
<template v-if="type === 'card'">
<div v-for="i in (count || 1)" :key="i" class="skeleton-card">
<div class="skeleton skeleton-image"/>
@ -20,14 +25,17 @@ defineProps<{
</div>
</template>
<!-- กรณเปนโครงรางประเภทรปโปรไฟล (Avatar type skeleton) -->
<template v-else-if="type === 'avatar'">
<div class="skeleton skeleton-avatar"/>
</template>
<!-- กรณเปนโครงรางประเภทปมกด (Button type skeleton) -->
<template v-else-if="type === 'button'">
<div class="skeleton skeleton-button" :style="{ width: width || '120px' }"/>
</template>
<!-- กรณนๆ จะแสดงเปนบรรทดขอความ (Fallback/Text type skeleton) -->
<template v-else>
<div
v-for="i in (count || 1)"

View file

@ -1,4 +1,8 @@
<script setup lang="ts">
/**
* @file LoadingSpinner.vue
* @description ไอคอนหมนแสดงการโหลด (Loading Spinner Component) เหมาะสำหรบใชตรงจดเลกๆ หรอตอนโหลดหนาเว
*/
defineProps<{
size?: 'sm' | 'md' | 'lg'
text?: string