feat: Implement core e-learning platform features including quiz, dashboard, course discovery, and classroom learning with i18n support.
All checks were successful
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Successful in 35s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Successful in 4s
Build and Deploy Frontend Learner / Notify Deployment Status (push) Successful in 1s
All checks were successful
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Successful in 35s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Successful in 4s
Build and Deploy Frontend Learner / Notify Deployment Status (push) Successful in 1s
This commit is contained in:
parent
d787412036
commit
a0ca6f7e6b
13 changed files with 429 additions and 246 deletions
|
|
@ -10,9 +10,9 @@
|
|||
--bg-body: #f8fafc;
|
||||
--bg-surface: #ffffff;
|
||||
--bg-elevated: #ffffff;
|
||||
--text-main: #000000; /* Pure Black for absolute clarity in light mode */
|
||||
--text-secondary: #1f2937; /* text-slate-800: Strong contrast subtext */
|
||||
--primary: #3b82f6; /* Primary Blue */
|
||||
--text-main: #000000; /* Pure Black for absolute clarity in light mode */
|
||||
--text-secondary: #1f2937; /* text-slate-800: Strong contrast subtext */
|
||||
--primary: #3b82f6; /* Primary Blue */
|
||||
|
||||
/* Semantic mappings */
|
||||
--border-color: #e2e8f0;
|
||||
|
|
@ -60,12 +60,12 @@
|
|||
/* Dark Mode (applied when `.dark` class is present on <html>) */
|
||||
.dark {
|
||||
/* Oceanic Palette: Standardized for entire App */
|
||||
--bg-body: #020617; /* Slate-950: Main Background */
|
||||
--bg-surface: #0f172a; /* Slate-900: Sidebar & Header */
|
||||
--bg-elevated: #1e293b; /* Slate-800: Cards & Hover states */
|
||||
--bg-body: #020617; /* Slate-950: Main Background */
|
||||
--bg-surface: #0f172a; /* Slate-900: Sidebar & Header */
|
||||
--bg-elevated: #1e293b; /* Slate-800: Cards & Hover states */
|
||||
|
||||
--text-main: #f8fafc; /* Slate-50: Brightest for titles */
|
||||
--text-secondary: #94a3b8; /* Slate-400: Muted for subtext */
|
||||
--text-main: #f8fafc; /* Slate-50: Brightest for titles */
|
||||
--text-secondary: #94a3b8; /* Slate-400: Muted for subtext */
|
||||
|
||||
--border-color: rgba(255, 255, 255, 0.06);
|
||||
|
||||
|
|
@ -658,12 +658,12 @@ ul {
|
|||
.page-container {
|
||||
max-width: 1280px; /* max-7xl equivalent roughly */
|
||||
margin: 0 auto;
|
||||
padding: 2rem 1.5rem;
|
||||
padding: 1rem 1.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.page-container {
|
||||
padding: 3rem 2rem;
|
||||
padding: 1.5rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,20 @@ const getLocalizedText = (text: any) => {
|
|||
const currentLocale = locale.value as 'th' | 'en'
|
||||
return text[currentLocale] || text.th || text.en || ''
|
||||
}
|
||||
|
||||
// Local Progress Calculation
|
||||
const progressPercentage = computed(() => {
|
||||
if (!props.courseData || !props.courseData.chapters) return 0
|
||||
let total = 0
|
||||
let completed = 0
|
||||
props.courseData.chapters.forEach((c: any) => {
|
||||
c.lessons.forEach((l: any) => {
|
||||
total++
|
||||
if (l.is_completed || l.progress?.is_completed) completed++
|
||||
})
|
||||
})
|
||||
return total > 0 ? Math.round((completed / total) * 100) : 0
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -38,13 +52,29 @@ const getLocalizedText = (text: any) => {
|
|||
show-if-above
|
||||
bordered
|
||||
side="left"
|
||||
:width="320"
|
||||
:width="280"
|
||||
:breakpoint="1024"
|
||||
class="bg-[var(--bg-surface)]"
|
||||
content-class="bg-[var(--bg-surface)]"
|
||||
class="bg-slate-50 dark:bg-slate-900 shadow-xl"
|
||||
content-class="flex flex-col h-full"
|
||||
>
|
||||
<div v-if="courseData" class="h-full scroll">
|
||||
<q-list class="pb-10">
|
||||
<div v-if="courseData" class="flex flex-col h-full overflow-hidden">
|
||||
<!-- Course Progress Header -->
|
||||
<div class="p-5 border-b border-gray-200 dark:border-white/5 bg-white dark:bg-slate-900">
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
<span class="text-xs font-black uppercase tracking-widest text-slate-500 dark:text-slate-400">{{ $t('course.progress', 'ความคืบหน้า') }}</span>
|
||||
<span class="text-sm font-black text-blue-600 dark:text-blue-400">{{ progressPercentage }}%</span>
|
||||
</div>
|
||||
<q-linear-progress
|
||||
:value="progressPercentage / 100"
|
||||
color="primary"
|
||||
track-color="blue-1"
|
||||
class="rounded-full h-2"
|
||||
rounded
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex-grow scroll">
|
||||
<q-list padding class="py-2">
|
||||
|
||||
|
||||
<template v-for="chapter in courseData.chapters" :key="chapter.id">
|
||||
|
|
@ -58,8 +88,8 @@ const getLocalizedText = (text: any) => {
|
|||
clickable
|
||||
v-ripple
|
||||
:active="currentLessonId === lesson.id"
|
||||
active-class="bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-200 font-medium"
|
||||
class="border-b border-gray-50 dark:border-white/5"
|
||||
active-class="bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300 active-lesson-indicator"
|
||||
class="px-5 py-3 transition-all duration-200 group relative border-b border-gray-100/50 dark:border-white/5"
|
||||
@click="!lesson.is_locked && emit('select-lesson', lesson.id)"
|
||||
:disable="lesson.is_locked"
|
||||
>
|
||||
|
|
@ -68,19 +98,26 @@ const getLocalizedText = (text: any) => {
|
|||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
<q-item-label class="text-sm md:text-base line-clamp-2 text-[var(--text-main)]">
|
||||
<q-item-label
|
||||
class="text-sm font-bold line-clamp-2 transition-colors"
|
||||
:class="currentLessonId === lesson.id ? 'text-blue-700 dark:text-blue-300' : 'text-slate-700 dark:text-slate-300'"
|
||||
>
|
||||
{{ getLocalizedText(lesson.title) }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section side>
|
||||
<q-icon v-if="lesson.is_completed || lesson.progress?.is_completed" name="check_circle" color="positive" size="xs" />
|
||||
<q-icon v-else-if="currentLessonId === lesson.id" name="play_circle" color="primary" size="xs" />
|
||||
<q-icon v-else name="radio_button_unchecked" color="grey-4" size="xs" />
|
||||
<div class="flex items-center">
|
||||
<q-icon v-if="lesson.is_completed || lesson.progress?.is_completed" name="check_circle" color="positive" size="18px" />
|
||||
<q-icon v-else-if="currentLessonId === lesson.id" name="play_arrow" color="primary" size="18px" class="animate-pulse" />
|
||||
<q-icon v-else-if="lesson.is_locked" name="lock" color="grey-4" size="18px" />
|
||||
<q-icon v-else name="radio_button_unchecked" color="grey-3" size="18px" />
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-list>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="isLoading" class="p-6 text-center text-slate-500">
|
||||
<q-spinner color="primary" size="2em" />
|
||||
|
|
@ -88,3 +125,33 @@ const getLocalizedText = (text: any) => {
|
|||
</div>
|
||||
</q-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.active-lesson-indicator {
|
||||
position: relative;
|
||||
}
|
||||
.active-lesson-indicator::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 4px;
|
||||
background: #2563eb; /* blue-600 */
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
.scroll::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
.scroll::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
.scroll::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.dark .scroll::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
const props = defineProps<{
|
||||
src: string;
|
||||
poster?: string;
|
||||
initialSeekTime?: number;
|
||||
}>();
|
||||
|
||||
|
|
@ -241,6 +242,7 @@ watch([volume, isMuted], () => {
|
|||
<video
|
||||
ref="videoRef"
|
||||
:src="src"
|
||||
:poster="poster"
|
||||
class="w-full h-full object-contain"
|
||||
@click="togglePlay"
|
||||
@timeupdate="handleTimeUpdate"
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const toggleCategory = (id: number) => {
|
|||
</div>
|
||||
<div class="flex-1">
|
||||
<div class="text-lg font-black text-slate-900 dark:!text-white leading-none mb-1">{{ $t('discovery.categoryTitle') }}</div>
|
||||
<div class="text-[10px] font-black uppercase tracking-widest text-slate-400 dark:text-slate-500">{{ modelValue.length }} Selectable</div>
|
||||
<div class="text-[10px] font-black uppercase tracking-widest text-slate-400 dark:text-slate-500">{{ modelValue.length }} {{ $t('discovery.selectable') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -47,21 +47,17 @@ const handleEnroll = () => {
|
|||
|
||||
<template>
|
||||
<div class="animate-fade-in-up">
|
||||
<q-btn
|
||||
unelevated
|
||||
rounded
|
||||
icon="arrow_back"
|
||||
:label="$t('common.back')"
|
||||
class="mb-8 font-bold bg-slate-100 text-slate-700 hover:bg-slate-200 dark:bg-white/10 dark:text-white dark:hover:bg-white/20 transition-all px-4 shadow-sm"
|
||||
@click="emit('back')"
|
||||
/>
|
||||
<div class="flex items-center gap-2 mb-8 group cursor-pointer" @click="emit('back')">
|
||||
<q-icon name="arrow_back" size="20px" class="text-slate-400 group-hover:text-blue-600 transition-colors" />
|
||||
<span class="text-sm font-bold text-slate-500 group-hover:text-blue-600 transition-colors uppercase tracking-widest">{{ $t('common.back') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
||||
<!-- Left: Content Detail -->
|
||||
<div class="lg:col-span-2 space-y-8">
|
||||
|
||||
<!-- Video Preview Section -->
|
||||
<div class="relative aspect-video rounded-3xl overflow-hidden shadow-2xl group bg-black">
|
||||
<div class="relative aspect-video rounded-3xl overflow-hidden shadow-2xl group cursor-pointer bg-slate-900 border-4 border-white dark:border-slate-800 transition-transform duration-500 hover:scale-[1.01]">
|
||||
<template v-if="course.media?.video_url">
|
||||
<video
|
||||
controls
|
||||
|
|
@ -69,27 +65,28 @@ const handleEnroll = () => {
|
|||
:poster="course.thumbnail_url || course.cover_image || 'https://placehold.co/800x450?text=Course+Preview'"
|
||||
>
|
||||
<source :src="course.media.video_url" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
{{ $t('course.videoNotSupported') }}
|
||||
</video>
|
||||
<!-- Custom Play Overlay when not playing - simple version is often best -->
|
||||
</template>
|
||||
<!-- Beautiful Image Showcase if no video -->
|
||||
<template v-else>
|
||||
<div class="w-full h-full flex items-center justify-center relative overflow-hidden bg-slate-950">
|
||||
<!-- Show Thumbnail as Background if exists (Blurred background fill) -->
|
||||
<div class="w-full h-full flex items-center justify-center relative overflow-hidden bg-slate-950 group">
|
||||
<!-- Blurred background fill -->
|
||||
<img
|
||||
v-if="course.thumbnail_url || course.cover_image"
|
||||
:src="course.thumbnail_url || course.cover_image"
|
||||
class="absolute inset-0 w-full h-full object-cover opacity-30 blur-xl scale-110"
|
||||
class="absolute inset-0 w-full h-full object-cover opacity-40 blur-2xl scale-125"
|
||||
/>
|
||||
|
||||
<!-- Main Sharp Image -->
|
||||
<img
|
||||
v-if="course.thumbnail_url || course.cover_image"
|
||||
:src="course.thumbnail_url || course.cover_image"
|
||||
class="relative z-10 w-full h-full object-contain shadow-2xl shadow-black/50"
|
||||
class="relative z-10 w-full h-full object-cover shadow-2xl transition-transform duration-700 group-hover:scale-105"
|
||||
/>
|
||||
|
||||
<div v-else class="absolute inset-0 bg-gradient-to-br from-slate-800 to-slate-900 flex items-center justify-center">
|
||||
<div v-if="!course.thumbnail_url && !course.cover_image" class="absolute inset-0 bg-gradient-to-br from-slate-800 to-slate-900 flex items-center justify-center">
|
||||
<q-icon name="image" size="80px" class="text-slate-700 opacity-50" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -101,11 +98,6 @@ const handleEnroll = () => {
|
|||
<h1 class="text-3xl md:text-4xl font-extrabold text-slate-900 dark:text-white mb-4 leading-tight">
|
||||
{{ getLocalizedText(course.title) }}
|
||||
</h1>
|
||||
<div class="flex flex-wrap items-center gap-4 text-sm text-slate-500 dark:text-slate-400 mb-6">
|
||||
<span class="flex items-center gap-1 bg-slate-100 dark:bg-slate-800 px-3 py-1 rounded-full text-slate-700 dark:text-slate-300 font-medium">
|
||||
{{ getLocalizedText(course.category?.name) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="prose max-w-none text-slate-600 dark:text-slate-400 leading-relaxed font-light">
|
||||
<p>{{ getLocalizedText(course.description) }}</p>
|
||||
|
|
@ -113,32 +105,40 @@ const handleEnroll = () => {
|
|||
</div>
|
||||
|
||||
<!-- Curriculum Preview -->
|
||||
<div class="bg-slate-100/50 dark:bg-slate-800/50 rounded-3xl p-6 md:p-8 border border-transparent dark:border-slate-700/50">
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-6 flex items-center gap-2">
|
||||
<q-icon name="list_alt" class="text-blue-600 dark:text-blue-400" />
|
||||
{{ $t('course.courseContent') }}
|
||||
</h3>
|
||||
<div class="bg-slate-50 dark:bg-slate-900 rounded-3xl p-6 md:p-8 border border-slate-200 dark:border-white/5">
|
||||
<div class="flex items-center justify-between mb-8">
|
||||
<div>
|
||||
<h3 class="text-xl font-black text-slate-900 dark:text-white mb-1 flex items-center gap-2">
|
||||
{{ $t('course.courseContent') }}
|
||||
</h3>
|
||||
</div>
|
||||
<q-icon name="keyboard_command_key" class="text-slate-200 dark:text-slate-800" size="32px" />
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<div v-for="(chapter, idx) in course.chapters" :key="chapter.id" class="bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-slate-800 overflow-hidden">
|
||||
<div class="px-6 py-4 bg-slate-100 dark:bg-white/5 font-bold text-slate-800 dark:text-white flex justify-between items-center">
|
||||
<span>{{ Number(idx) + 1 }}. {{ getLocalizedText(chapter.title) }}</span>
|
||||
<span class="text-xs text-slate-500 dark:text-slate-400 font-normal">{{ chapter.lessons?.length || 0 }} {{ $t('course.lessonsUnit') }}</span>
|
||||
<div v-for="(chapter, idx) in course.chapters" :key="chapter.id" class="group">
|
||||
<div class="px-6 py-4 bg-white dark:bg-slate-800 rounded-2xl border border-slate-200 dark:border-white/5 font-black text-slate-800 dark:text-white flex justify-between items-center mb-2 shadow-sm">
|
||||
<span class="flex items-center gap-3">
|
||||
<span class="w-7 h-7 flex items-center justify-center bg-slate-100 dark:bg-white/10 rounded-lg text-xs font-bold font-mono">{{ Number(idx) + 1 }}</span>
|
||||
{{ getLocalizedText(chapter.title) }}
|
||||
</span>
|
||||
<span class="text-[10px] uppercase font-black tracking-widest text-slate-400 opacity-60">{{ chapter.lessons?.length || 0 }} {{ $t('course.lessonsUnit') }}</span>
|
||||
</div>
|
||||
<div class="divide-y divide-slate-100 dark:divide-slate-800">
|
||||
<div v-for="lesson in chapter.lessons" :key="lesson.id" class="px-6 py-3 flex items-center gap-3 text-sm text-slate-600 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-white/5 transition-colors">
|
||||
<q-icon
|
||||
:name="lesson.type === 'VIDEO' ? 'play_circle' : 'article'"
|
||||
:class="lesson.type === 'VIDEO' ? 'text-blue-500 dark:text-blue-400' : 'text-orange-500 dark:text-orange-400'"
|
||||
size="18px"
|
||||
/>
|
||||
<span class="flex-1">{{ getLocalizedText(lesson.title) }}</span>
|
||||
<span v-if="lesson.duration_minutes" class="text-slate-400 dark:text-slate-500 text-xs">{{ lesson.duration_minutes }} {{ $t('course.minutes') }}</span>
|
||||
<div class="ml-4 pl-4 border-l-2 border-slate-100 dark:border-slate-800 space-y-1 mt-3">
|
||||
<div v-for="lesson in chapter.lessons" :key="lesson.id" class="px-5 py-3 flex items-center gap-3 text-sm text-slate-600 dark:text-slate-400 hover:bg-white dark:hover:bg-white/5 rounded-xl transition-all hover:translate-x-1">
|
||||
<div class="w-8 h-8 rounded-full flex items-center justify-center" :class="lesson.type === 'VIDEO' ? 'bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-400' : 'bg-orange-50 text-orange-600 dark:bg-orange-500/10 dark:text-orange-400'">
|
||||
<q-icon
|
||||
:name="lesson.type === 'VIDEO' ? 'play_arrow' : 'article'"
|
||||
size="16px"
|
||||
/>
|
||||
</div>
|
||||
<span class="flex-1 font-bold">{{ getLocalizedText(lesson.title) }}</span>
|
||||
<span v-if="lesson.duration_minutes" class="text-slate-400 dark:text-slate-500 text-[10px] font-bold">{{ lesson.duration_minutes }} {{ $t('quiz.minutes') }}</span>
|
||||
<q-icon v-if="lesson.is_locked !== false" name="lock" size="14px" class="text-slate-300 dark:text-slate-600" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!course.chapters || course.chapters.length === 0" class="flex flex-col items-center justify-center py-12 text-slate-400 dark:text-slate-500 bg-white/50 dark:bg-slate-900/50 rounded-2xl border-2 border-dashed border-slate-200 dark:border-slate-800">
|
||||
<div v-if="!course.chapters || course.chapters.length === 0" class="flex flex-col items-center justify-center py-12 text-slate-400 dark:text-slate-500 bg-white/50 dark:bg-slate-900/50 rounded-2xl border-2 border-dashed border-slate-200 dark:border-slate-800">
|
||||
<q-icon name="menu_book" size="40px" class="mb-2 opacity-50" />
|
||||
<p class="text-sm font-medium">{{ $t('course.noContent') }}</p>
|
||||
</div>
|
||||
|
|
@ -150,17 +150,18 @@ const handleEnroll = () => {
|
|||
<!-- Right: Enrollment Card -->
|
||||
<div class="lg:col-span-1">
|
||||
<div class="sticky top-24">
|
||||
<div class="bg-white dark:bg-slate-800/40 dark:backdrop-blur-xl rounded-3xl shadow-xl shadow-slate-200/50 dark:shadow-none p-6 border border-slate-100 dark:border-white/10 relative overflow-hidden">
|
||||
<div class="absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-500/20 to-purple-500/20 rounded-full blur-3xl -mr-16 -mt-16"></div>
|
||||
<div class="bg-white dark:bg-slate-900 rounded-3xl shadow-2xl shadow-blue-500/10 dark:shadow-none p-8 border border-slate-100 dark:border-white/5 relative overflow-hidden group">
|
||||
<!-- Decorative background glow -->
|
||||
<div class="absolute -top-12 -right-12 w-48 h-48 bg-blue-500/10 rounded-full blur-3xl group-hover:bg-blue-500/20 transition-colors"></div>
|
||||
|
||||
<div class="relative">
|
||||
<div class="text-3xl font-black mb-2 font-display">
|
||||
<span v-if="course.price > 0" class="text-slate-900 dark:text-white">
|
||||
{{ formatPrice(course.price) }}
|
||||
</span>
|
||||
<span v-else class="text-blue-600 dark:text-blue-400 drop-shadow-sm">
|
||||
{{ $t('course.free') }}
|
||||
</span>
|
||||
<div class="relative">
|
||||
<div v-if="course.price > 0" class="mb-4">
|
||||
<span class="text-xs font-black uppercase tracking-widest text-slate-400 mb-1 block">{{ $t('course.price', 'ราคาคอร์ส') }}</span>
|
||||
<div class="text-4xl font-black font-display">
|
||||
<span class="text-slate-900 dark:text-white">
|
||||
{{ formatPrice(course.price) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<q-btn
|
||||
|
|
@ -168,22 +169,41 @@ const handleEnroll = () => {
|
|||
rounded
|
||||
size="lg"
|
||||
color="primary"
|
||||
class="w-full mb-4 shadow-lg shadow-blue-600/30 font-bold"
|
||||
class="w-full h-14 shadow-xl shadow-blue-600/30 font-black tracking-tight"
|
||||
:label="user ? (course.enrolled ? $t('course.startLearning') : (course.price > 0 ? $t('course.buyNow') : $t('course.enrollFree'))) : $t('course.loginToEnroll')"
|
||||
:loading="enrollmentLoading"
|
||||
@click="handleEnroll"
|
||||
/>
|
||||
>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-facebook />
|
||||
</template>
|
||||
</q-btn>
|
||||
|
||||
<div class="mt-6 space-y-4">
|
||||
<p class="text-[10px] font-black uppercase tracking-[0.2em] text-slate-400 mb-4">{{ $t('course.includes', 'คอร์สนี้รวมอะไรบ้าง') }}</p>
|
||||
|
||||
<hr class="my-6 border-slate-100 dark:border-slate-800">
|
||||
<div class="flex items-center gap-3 text-sm text-slate-600 dark:text-slate-300 font-bold">
|
||||
<div class="w-6 h-6 rounded-lg bg-blue-50 dark:bg-blue-500/10 flex items-center justify-center">
|
||||
<q-icon name="all_inclusive" size="14px" class="text-blue-600 dark:text-blue-400" />
|
||||
</div>
|
||||
{{ $t('course.fullLifetimeAccess', 'เข้าเรียนได้ตลอดชีพ') }}
|
||||
</div>
|
||||
|
||||
<div class="space-y-3 block">
|
||||
<div class="flex items-center gap-3 text-sm text-slate-600 dark:text-slate-400">
|
||||
<q-icon name="check_circle" class="text-green-500" />
|
||||
{{ $t('course.certificate') }} ({{ $t('course.available') }})
|
||||
<div class="flex items-center gap-3 text-sm text-slate-600 dark:text-slate-300 font-bold">
|
||||
<div class="w-6 h-6 rounded-lg bg-emerald-50 dark:bg-emerald-500/10 flex items-center justify-center">
|
||||
<q-icon name="workspace_premium" size="14px" class="text-emerald-600 dark:text-emerald-400" />
|
||||
</div>
|
||||
{{ $t('course.certificate') }}
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-3 text-sm text-slate-600 dark:text-slate-300 font-bold">
|
||||
<div class="w-6 h-6 rounded-lg bg-purple-50 dark:bg-purple-500/10 flex items-center justify-center">
|
||||
<q-icon name="devices" size="14px" class="text-purple-600 dark:text-purple-400" />
|
||||
</div>
|
||||
{{ $t('course.accessOnMobile', 'เข้าเรียนได้ทุกอุปกรณ์') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ export interface Course {
|
|||
approved_by?: number
|
||||
rejection_reason?: string
|
||||
enrolled?: boolean
|
||||
total_lessons?: number
|
||||
|
||||
|
||||
rating?: string
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
"enrollFree": "Enroll for free",
|
||||
"loginToEnroll": "Log in to enroll",
|
||||
"minutes": "Minutes",
|
||||
"noVideoPreview": "Video preview not available"
|
||||
"noVideoPreview": "Video preview not available",
|
||||
"videoNotSupported": "Your browser does not support the video tag"
|
||||
},
|
||||
"sidebar": {
|
||||
"overview": "Home",
|
||||
|
|
@ -69,7 +70,8 @@
|
|||
"emptyDesc": "Try different keywords or check spelling",
|
||||
"showAll": "Show All",
|
||||
"loadMore": "Load More",
|
||||
"backToCatalog": "Back to Catalog"
|
||||
"backToCatalog": "Back to Catalog",
|
||||
"selectable": "Selected"
|
||||
},
|
||||
"myCourses": {
|
||||
"filterAll": "All",
|
||||
|
|
@ -84,7 +86,8 @@
|
|||
"successDesc": "You have successfully enrolled in this course.",
|
||||
"startNow": "Start Learning",
|
||||
"later": "Later",
|
||||
"alreadyEnrolledHint": "You have already enrolled in the course {course}."
|
||||
"alreadyEnrolledHint": "You have already enrolled in the course {course}.",
|
||||
"error": "Failed to enroll"
|
||||
},
|
||||
"certificate": {
|
||||
"title": "Certificate of Completion",
|
||||
|
|
@ -195,7 +198,11 @@
|
|||
"attachments": "Attachments",
|
||||
"announcements": "Course Announcements",
|
||||
"posts": "Posts",
|
||||
"noAnnouncements": "No announcements yet"
|
||||
"noAnnouncements": "No announcements yet",
|
||||
"quizRequired": "Please pass the quiz \"{title}\" first",
|
||||
"lessonRequired": "Please complete the lesson \"{title}\" first",
|
||||
"notEnrolled": "You are not yet enrolled in this course",
|
||||
"curriculum": "Course Content"
|
||||
},
|
||||
"quiz": {
|
||||
"exitTitle": "Exit Quiz",
|
||||
|
|
@ -235,6 +242,7 @@
|
|||
"statusCompleted": "Completed",
|
||||
"statusSkipped": "Skipped",
|
||||
"statusNotStarted": "Not Started",
|
||||
"alertIncomplete": "Please answer all questions"
|
||||
"alertIncomplete": "Please answer all questions",
|
||||
"yourAnswer": "Your Answer"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
"enrollFree": "ลงทะเบียนเรียนฟรี",
|
||||
"loginToEnroll": "เข้าสู่ระบบเพื่อลงทะเบียน",
|
||||
"minutes": "นาที",
|
||||
"noVideoPreview": "วิดีโอตัวอย่างยังไม่พร้อมใช้งาน"
|
||||
"noVideoPreview": "วิดีโอตัวอย่างยังไม่พร้อมใช้งาน",
|
||||
"videoNotSupported": "เบราว์เซอร์ของคุณไม่รองรับการเล่นวิดีโอ"
|
||||
},
|
||||
"sidebar": {
|
||||
"overview": "หน้าหลัก",
|
||||
|
|
@ -69,7 +70,8 @@
|
|||
"emptyDesc": "ลองใช้คำค้นหาอื่น หรือตรวจดูความถูกต้องของตัวอักษรอีกครั้ง",
|
||||
"showAll": "แสดงทั้งหมด",
|
||||
"loadMore": "โหลดเพิ่มเติม",
|
||||
"backToCatalog": "กลับหน้ารายการคอร์ส"
|
||||
"backToCatalog": "กลับหน้ารายการคอร์ส",
|
||||
"selectable": "รายการที่เลือก"
|
||||
},
|
||||
"myCourses": {
|
||||
"filterAll": "ทั้งหมด",
|
||||
|
|
@ -84,7 +86,8 @@
|
|||
"successDesc": "คุณได้ลงทะเบียนคอร์สนี้เรียบร้อยแล้ว",
|
||||
"startNow": "เริ่มเรียนทันที",
|
||||
"later": "ไว้ทีหลัง",
|
||||
"alreadyEnrolledHint": "ท่านเคยลงทะเบียนคอร์ส {course} นี้ไปเรียบร้อยแล้ว"
|
||||
"alreadyEnrolledHint": "ท่านเคยลงทะเบียนคอร์ส {course} นี้ไปเรียบร้อยแล้ว",
|
||||
"error": "ไม่สามารถลงทะเบียนได้"
|
||||
},
|
||||
"certificate": {
|
||||
"title": "ใบประกาศนียบัตรจบหลักสูตร",
|
||||
|
|
@ -195,7 +198,11 @@
|
|||
"attachments": "เอกสารประกอบ",
|
||||
"announcements": "ประกาศในคอร์ส",
|
||||
"posts": "โพสต์",
|
||||
"noAnnouncements": "ยังไม่มีประกาศในขณะนี้"
|
||||
"noAnnouncements": "ยังไม่มีประกาศในขณะนี้",
|
||||
"quizRequired": "กรุณาทำแบบทดสอบ \"{title}\" ให้ผ่านก่อน",
|
||||
"lessonRequired": "กรุณาเรียนบทเรียน \"{title}\" ให้จบก่อน",
|
||||
"notEnrolled": "คุณยังไม่ได้ลงทะเบียนในคอร์สนี้",
|
||||
"curriculum": "เนื้อหาหลักสูตร"
|
||||
},
|
||||
"quiz": {
|
||||
"startTitle": "แบบทดสอบ",
|
||||
|
|
@ -235,6 +242,7 @@
|
|||
"statusCompleted": "ทำแล้ว",
|
||||
"statusSkipped": "ข้าม",
|
||||
"statusNotStarted": "ยังไม่ทำ",
|
||||
"alertIncomplete": "กรุณาเลือกคำตอบให้ครบทุกข้อ"
|
||||
"alertIncomplete": "กรุณาเลือกคำตอบให้ครบทุกข้อ",
|
||||
"yourAnswer": "คำตอบของคุณ"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ const handleEnroll = async (id: number) => {
|
|||
} else {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: res.error || 'Failed to enroll',
|
||||
message: res.error || t('enrollment.error'),
|
||||
position: 'top',
|
||||
timeout: 3000,
|
||||
actions: [{ icon: 'close', color: 'white' }]
|
||||
|
|
@ -127,6 +127,15 @@ watch(selectedCategoryIds, () => {
|
|||
loadCourses(1);
|
||||
}, { deep: true });
|
||||
|
||||
const toggleCategory = (id: number) => {
|
||||
const index = selectedCategoryIds.value.indexOf(id)
|
||||
if (index === -1) {
|
||||
selectedCategoryIds.value.push(id)
|
||||
} else {
|
||||
selectedCategoryIds.value.splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadCategories();
|
||||
loadCourses();
|
||||
|
|
@ -140,91 +149,101 @@ onMounted(() => {
|
|||
<div v-if="!showDetail">
|
||||
|
||||
<!-- Top Header Area -->
|
||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-6 mb-8">
|
||||
<!-- Title -->
|
||||
<h1 class="text-3xl font-black text-slate-900 dark:text-white flex items-center gap-3">
|
||||
<span class="w-1.5 h-8 bg-blue-600 rounded-full shadow-sm shadow-blue-500/50"></span>
|
||||
{{ $t('discovery.title') }}
|
||||
</h1>
|
||||
<div class="flex flex-col gap-6 mb-10">
|
||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-6">
|
||||
<!-- Title -->
|
||||
<h1 class="text-3xl font-black text-slate-900 dark:text-white flex items-center gap-3">
|
||||
<span class="w-1.5 h-8 bg-blue-600 rounded-full shadow-sm shadow-blue-500/50"></span>
|
||||
{{ $t('discovery.title') }}
|
||||
</h1>
|
||||
|
||||
<!-- Right Side: Search & Sort -->
|
||||
<div class="flex items-center gap-3 w-full md:w-auto">
|
||||
<!-- Search Input -->
|
||||
<q-input
|
||||
v-model="searchQuery"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:placeholder="$t('discovery.searchPlaceholder')"
|
||||
class="w-full md:w-72 search-input"
|
||||
bg-color="transparent"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="search" class="text-slate-400" />
|
||||
</template>
|
||||
</q-input>
|
||||
<!-- Right Side: Search -->
|
||||
<div class="flex items-center gap-3 w-full md:w-auto">
|
||||
<q-input
|
||||
v-model="searchQuery"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:placeholder="$t('discovery.searchPlaceholder')"
|
||||
class="w-full md:w-72 search-input shadow-sm"
|
||||
bg-color="transparent"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="search" class="text-slate-400" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Unified Filter Section: Categories -->
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<q-btn
|
||||
flat
|
||||
rounded
|
||||
dense
|
||||
class="px-4 font-bold transition-all text-xs uppercase tracking-widest"
|
||||
:class="selectedCategoryIds.length === 0 ? 'bg-blue-600 text-white shadow-lg shadow-blue-600/30' : 'bg-white dark:bg-slate-800 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-white/5'"
|
||||
@click="selectedCategoryIds = []"
|
||||
:label="$t('discovery.showAll')"
|
||||
/>
|
||||
<q-btn
|
||||
v-for="cat in categories"
|
||||
:key="cat.id"
|
||||
flat
|
||||
rounded
|
||||
dense
|
||||
class="px-4 font-bold transition-all text-xs uppercase tracking-widest"
|
||||
:class="selectedCategoryIds.includes(cat.id) ? 'bg-blue-600 text-white shadow-lg shadow-blue-600/30' : 'bg-white dark:bg-slate-800 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-white/5'"
|
||||
@click="toggleCategory(cat.id)"
|
||||
:label="getLocalizedText(cat.name)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main Layout: Sidebar + Grid -->
|
||||
<div class="flex flex-col lg:flex-row gap-8">
|
||||
|
||||
<!-- LEFT SIDEBAR: Category Filter -->
|
||||
<div class="w-full lg:w-64 flex-shrink-0 lg:sticky lg:top-24 z-10">
|
||||
<ClientOnly>
|
||||
<CategorySidebar
|
||||
:categories="categories"
|
||||
v-model="selectedCategoryIds"
|
||||
/>
|
||||
</ClientOnly>
|
||||
</div>
|
||||
|
||||
<!-- RIGHT CONTENT: Course Grid -->
|
||||
<div class="flex-1 w-full">
|
||||
<div v-if="filteredCourses.length > 0" class="flex flex-col gap-12">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6">
|
||||
<CourseCard
|
||||
v-for="course in filteredCourses"
|
||||
:key="course.id"
|
||||
v-bind="{ ...course, image: course.thumbnail_url }"
|
||||
show-view-details
|
||||
@view-details="selectCourse(course.id)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Pagination Controls -->
|
||||
<div v-if="totalPages > 1" class="flex justify-center pb-10">
|
||||
<q-pagination
|
||||
v-model="currentPage"
|
||||
:max="totalPages"
|
||||
:max-pages="6"
|
||||
boundary-numbers
|
||||
direction-links
|
||||
color="primary"
|
||||
flat
|
||||
active-design="unelevated"
|
||||
active-color="primary"
|
||||
@update:model-value="loadCourses"
|
||||
/>
|
||||
</div>
|
||||
<!-- Main Layout: Grid Only -->
|
||||
<div class="w-full">
|
||||
<div v-if="filteredCourses.length > 0" class="flex flex-col gap-12">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
|
||||
<CourseCard
|
||||
v-for="course in filteredCourses"
|
||||
:key="course.id"
|
||||
v-bind="{ ...course, image: course.thumbnail_url }"
|
||||
show-view-details
|
||||
@view-details="selectCourse(course.id)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div
|
||||
v-else
|
||||
class="flex flex-col items-center justify-center py-20 bg-slate-50 dark:bg-slate-800/50 rounded-3xl border-2 border-dashed border-slate-200 dark:border-slate-700"
|
||||
>
|
||||
<q-icon name="search_off" size="64px" class="text-slate-300 dark:text-slate-600 mb-4" />
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-2">{{ $t('discovery.emptyTitle') }}</h3>
|
||||
<p class="text-slate-500 dark:text-slate-400 text-center max-w-md">
|
||||
{{ $t('discovery.emptyDesc') }}
|
||||
</p>
|
||||
<button class="mt-6 font-bold text-blue-600 hover:text-blue-700 dark:hover:text-blue-400 transition-colors" @click="searchQuery = ''; selectedCategoryIds = []">
|
||||
{{ $t('discovery.showAll') }}
|
||||
</button>
|
||||
<!-- Pagination Controls -->
|
||||
<div v-if="totalPages > 1" class="flex justify-center pb-10">
|
||||
<q-pagination
|
||||
v-model="currentPage"
|
||||
:max="totalPages"
|
||||
:max-pages="6"
|
||||
boundary-numbers
|
||||
direction-links
|
||||
color="primary"
|
||||
flat
|
||||
active-design="unelevated"
|
||||
active-color="primary"
|
||||
@update:model-value="loadCourses"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div
|
||||
v-else
|
||||
class="flex flex-col items-center justify-center py-20 bg-white dark:bg-slate-800/50 rounded-3xl border-2 border-dashed border-slate-200 dark:border-slate-700 shadow-sm"
|
||||
>
|
||||
<q-icon name="search_off" size="64px" class="text-slate-300 dark:text-slate-600 mb-4" />
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-2">{{ $t('discovery.emptyTitle') }}</h3>
|
||||
<p class="text-slate-500 dark:text-slate-400 text-center max-w-md">
|
||||
{{ $t('discovery.emptyDesc') }}
|
||||
</p>
|
||||
<button class="mt-6 font-bold text-blue-600 hover:text-blue-700 dark:hover:text-blue-400 transition-colors" @click="searchQuery = ''; selectedCategoryIds = []">
|
||||
{{ $t('discovery.showAll') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -219,14 +219,14 @@ const loadLesson = async (lessonId: number) => {
|
|||
msg = accessRes.data.lock_reason
|
||||
} else if (accessRes.data.required_quiz_pass && !accessRes.data.required_quiz_pass.is_passed) {
|
||||
const quizTitle = getLocalizedText(accessRes.data.required_quiz_pass.title)
|
||||
msg = `กรุณาทำแบบทดสอบ "${quizTitle}" ให้ผ่านก่อน`
|
||||
msg = t('classroom.quizRequired', { title: quizTitle })
|
||||
} else if (accessRes.data.required_lessons && accessRes.data.required_lessons.length > 0) {
|
||||
const reqLesson = accessRes.data.required_lessons.find((l: any) => !l.is_completed)
|
||||
if (reqLesson) {
|
||||
msg = `กรุณาเรียนบทเรียน "${getLocalizedText(reqLesson.title)}" ให้จบก่อน`
|
||||
msg = t('classroom.lessonRequired', { title: getLocalizedText(reqLesson.title) })
|
||||
}
|
||||
} else if (accessRes.data.is_enrolled === false) {
|
||||
msg = 'คุณยังไม่ได้ลงทะเบียนในคอร์สนี้'
|
||||
msg = t('classroom.notEnrolled')
|
||||
}
|
||||
|
||||
alert(msg)
|
||||
|
|
@ -516,27 +516,31 @@ onBeforeUnmount(() => {
|
|||
<!-- Header -->
|
||||
<q-header bordered class="bg-[var(--bg-surface)] border-b border-gray-200 dark:border-white/5 text-[var(--text-main)] h-14">
|
||||
<q-toolbar>
|
||||
<q-btn flat round dense icon="menu" class="mr-2 text-slate-900 dark:text-white hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors" @click="toggleSidebar" />
|
||||
<!-- Exit/Back Button -->
|
||||
<q-btn
|
||||
flat
|
||||
rounded
|
||||
no-caps
|
||||
color="primary"
|
||||
class="mr-4 bg-slate-100 dark:bg-slate-800 text-slate-900 dark:text-white font-bold hover:bg-slate-200"
|
||||
@click="handleExit('/dashboard/my-courses')"
|
||||
>
|
||||
<q-icon name="close" size="18px" class="mr-1.5" />
|
||||
<span class="hidden sm:inline">{{ $t('common.close') }}</span>
|
||||
<q-tooltip>{{ $t('classroom.backToDashboard') }}</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<!-- Back Button & Branding -->
|
||||
<div class="flex items-center gap-2 mr-6">
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
icon="arrow_back"
|
||||
class="mr-2 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30 border border-blue-100 dark:border-blue-800/50 hover:bg-blue-100 dark:hover:bg-blue-800/50 transition-all"
|
||||
@click="handleExit('/dashboard/my-courses')"
|
||||
>
|
||||
<q-tooltip>{{ $t('classroom.backToDashboard') }}</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<div class="hidden sm:flex items-center gap-2 cursor-pointer group" @click="handleExit('/dashboard')">
|
||||
<div class="w-8 h-8 rounded-lg bg-blue-600 flex items-center justify-center text-white font-black shadow-lg shadow-blue-600/30 group-hover:scale-110 transition-transform">
|
||||
E
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Sidebar Toggle (Clearer for Course Content) -->
|
||||
<q-btn
|
||||
flat
|
||||
rounded
|
||||
no-caps
|
||||
class="mr-2 text-slate-900 dark:text-white hover:bg-slate-100 dark:hover:bg-slate-800 transition-colors font-bold px-3"
|
||||
@click="toggleSidebar"
|
||||
>
|
||||
<q-icon name="format_list_bulleted" size="18px" class="mr-1.5" />
|
||||
<span class="hidden md:inline">{{ $t('classroom.curriculum', 'เนื้อหาหลักสูตร') }}</span>
|
||||
</q-btn>
|
||||
|
||||
<q-toolbar-title class="text-base font-bold text-left truncate text-slate-900 dark:text-white">
|
||||
{{ courseData ? getLocalizedText(courseData.course.title) : $t('classroom.loadingTitle') }}
|
||||
|
|
@ -581,6 +585,7 @@ onBeforeUnmount(() => {
|
|||
v-if="currentLesson && videoSrc && !isLessonLoading"
|
||||
ref="videoPlayerComp"
|
||||
:src="videoSrc"
|
||||
:poster="courseData?.course?.thumbnail_url"
|
||||
:initialSeekTime="initialSeekTime"
|
||||
@timeupdate="handleVideoTimeUpdate"
|
||||
@ended="onVideoEnded"
|
||||
|
|
@ -588,11 +593,21 @@ onBeforeUnmount(() => {
|
|||
/>
|
||||
|
||||
<!-- Skeleton Loader for Video/Content -->
|
||||
<div v-if="isLessonLoading" class="aspect-video bg-slate-200 dark:bg-slate-800 rounded-2xl animate-pulse flex items-center justify-center mb-6 overflow-hidden relative">
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-slate-200 to-slate-300 dark:from-slate-700 dark:to-slate-800 opacity-50"></div>
|
||||
<div v-if="isLessonLoading" class="aspect-video bg-slate-200 dark:bg-slate-800 rounded-2xl animate-pulse flex items-center justify-center mb-6 overflow-hidden relative shadow-xl">
|
||||
<!-- Course Thumbnail as a background during loading -->
|
||||
<img
|
||||
v-if="courseData?.course?.thumbnail_url"
|
||||
:src="courseData.course.thumbnail_url"
|
||||
class="absolute inset-0 w-full h-full object-cover opacity-20 blur-md"
|
||||
/>
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-slate-200/50 to-slate-300/50 dark:from-slate-900/80 dark:to-slate-800/80"></div>
|
||||
|
||||
<div class="z-10 flex flex-col items-center">
|
||||
<q-spinner size="4rem" color="primary" :thickness="4" />
|
||||
<p class="mt-4 text-slate-500 dark:text-slate-400 font-bold animate-bounce">{{ $t('common.loading') }}...</p>
|
||||
<div class="relative">
|
||||
<q-spinner size="4rem" color="primary" :thickness="4" />
|
||||
<q-icon name="play_circle" size="2rem" color="primary" class="absolute inset-0 m-auto opacity-50" />
|
||||
</div>
|
||||
<p class="mt-4 text-slate-600 dark:text-slate-300 font-black text-xs uppercase tracking-[0.2em] animate-pulse">{{ $t('common.loading') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -600,7 +615,7 @@ onBeforeUnmount(() => {
|
|||
<div v-if="currentLesson" class="bg-[var(--bg-surface)] p-6 md:p-8 rounded-3xl shadow-sm border border-[var(--border-color)]">
|
||||
<!-- ใช้สีจากตัวแปรกลาง: จะแยกโหมดให้อัตโนมัติ (สว่าง=ดำ / มืด=ขาว) -->
|
||||
<div class="flex items-start justify-between gap-4 mb-4">
|
||||
<h1 class="text-2xl md:text-3xl font-bold text-slate-900 dark:text-white leading-tight font-display">{{ getLocalizedText(currentLesson.title) }}</h1>
|
||||
<h1 class="text-3xl md:text-5xl font-black text-slate-900 dark:text-white leading-tight tracking-tight font-display">{{ getLocalizedText(currentLesson.title) }}</h1>
|
||||
</div>
|
||||
|
||||
<p class="text-slate-600 dark:text-slate-400 text-base md:text-lg leading-relaxed mb-6" v-if="currentLesson.description">{{ getLocalizedText(currentLesson.description) }}</p>
|
||||
|
|
@ -615,10 +630,10 @@ onBeforeUnmount(() => {
|
|||
|
||||
<div class="flex justify-center flex-wrap gap-3 text-sm mb-8">
|
||||
<span v-if="currentLesson.quiz?.questions?.length" class="px-3 py-1 bg-white dark:bg-white rounded-full border border-gray-200 dark:border-white/10 shadow-sm flex items-center gap-1.5 text-slate-900 font-bold">
|
||||
<q-icon name="format_list_numbered" size="14px" class="text-blue-600" /> {{ currentLesson.quiz.questions.length }} ข้อ
|
||||
<q-icon name="format_list_numbered" size="14px" class="text-blue-600" /> {{ currentLesson.quiz.questions.length }} {{ $t('quiz.questions') }}
|
||||
</span>
|
||||
<span v-if="currentLesson.quiz?.time_limit" class="px-3 py-1 bg-white dark:bg-white rounded-full border border-gray-200 dark:border-white/10 shadow-sm flex items-center gap-1.5 text-slate-900 font-bold">
|
||||
<q-icon name="schedule" size="14px" class="text-orange-600" /> {{ currentLesson.quiz.time_limit }} นาที
|
||||
<q-icon name="schedule" size="14px" class="text-orange-600" /> {{ currentLesson.quiz.time_limit }} {{ $t('quiz.minutes') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -627,7 +642,7 @@ onBeforeUnmount(() => {
|
|||
size="lg"
|
||||
rounded
|
||||
no-caps
|
||||
:label="$t('quiz.startBtn', 'เริ่มทำแบบทดสอบ')"
|
||||
:label="$t('quiz.startBtn')"
|
||||
icon="play_arrow"
|
||||
@click="$router.push(`/classroom/quiz?course_id=${courseId}&lesson_id=${currentLesson.id}`)"
|
||||
/>
|
||||
|
|
@ -642,7 +657,7 @@ onBeforeUnmount(() => {
|
|||
<div class="w-8 h-8 rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-600 flex items-center justify-center">
|
||||
<q-icon name="attach_file" size="18px" />
|
||||
</div>
|
||||
{{ $t('classroom.attachments') || 'เอกสารประกอบการเรียน' }}
|
||||
{{ $t('classroom.attachments') }}
|
||||
</h3>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<a
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ definePageMeta({
|
|||
middleware: 'auth'
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const { locale, t } = useI18n()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const $q = useQuasar()
|
||||
|
|
@ -118,7 +118,8 @@ const timerDisplay = computed(() => {
|
|||
const getLocalizedText = (text: any) => {
|
||||
if (!text) return ''
|
||||
if (typeof text === 'string') return text
|
||||
return text.th || text.en || ''
|
||||
const currentLocale = locale.value as 'th' | 'en'
|
||||
return text[currentLocale] || text.th || text.en || ''
|
||||
}
|
||||
|
||||
const lessonProgress = ref<any>(null)
|
||||
|
|
|
|||
|
|
@ -53,27 +53,28 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<!-- Welcome Header Section -->
|
||||
<div class="welcome-section mb-10 overflow-hidden relative rounded-[2.5rem] p-8 md:p-12 text-white shadow-xl dark:shadow-2xl dark:shadow-blue-950/40 transition border border-white/5">
|
||||
<div class="relative z-10 flex flex-col md:flex-row justify-between items-center gap-8">
|
||||
<div class="text-center md:text-left">
|
||||
<ClientOnly>
|
||||
<h1 class="text-4xl md:text-6xl font-black mb-4 slide-up tracking-tight text-white drop-shadow-sm">
|
||||
{{ $t('dashboard.welcomeTitle') }}, {{ currentUser?.firstName }}!
|
||||
</h1>
|
||||
</ClientOnly>
|
||||
<p class="text-lg md:text-xl slide-up font-medium text-blue-100/90 max-w-xl" style="animation-delay: 0.1s;">
|
||||
{{ $t('dashboard.welcomeSubtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="stats-mini flex gap-6 slide-up" style="animation-delay: 0.2s;"/>
|
||||
<div class="page-container !pt-4">
|
||||
<!-- Welcome Header Section (Minimalist) -->
|
||||
<div class="flex items-center gap-6 mb-10 py-2 animate-fade-in">
|
||||
<!-- Avatar with premium shadow -->
|
||||
<div class="relative group cursor-pointer" @click="$router.push('/dashboard/profile')">
|
||||
<div class="absolute -inset-1 bg-gradient-to-r from-blue-600 to-indigo-600 rounded-full blur opacity-25 group-hover:opacity-50 transition duration-1000 group-hover:duration-200"></div>
|
||||
<q-avatar size="84px" class="relative shadow-2xl ring-4 ring-white dark:ring-slate-900 transition-all duration-500 overflow-hidden">
|
||||
<img
|
||||
:src="currentUser?.photoURL || 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y'"
|
||||
class="object-cover"
|
||||
/>
|
||||
</q-avatar>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col">
|
||||
<h1 class="text-2xl md:text-4xl font-black text-slate-900 dark:text-white tracking-tight leading-tight mb-1">
|
||||
{{ $t('dashboard.welcomeTitle') }}, {{ currentUser?.firstName }}!
|
||||
</h1>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-slate-500 dark:text-slate-400 text-sm font-medium">{{ $t('dashboard.welcomeSubtitle') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Decorative Background elements -->
|
||||
<div class="absolute inset-0 bg-gradient-to-br from-blue-500 via-blue-600 to-indigo-700 dark:from-[#1e293b] dark:via-[#0f172a] dark:to-[#1e3a8a] -z-0"/>
|
||||
<div class="absolute -top-20 -right-20 w-80 h-80 bg-white/10 blur-[100px] rounded-full"/>
|
||||
<div class="absolute -bottom-20 -left-20 w-80 h-80 bg-blue-400/10 blur-[100px] rounded-full"/>
|
||||
<div class="absolute inset-0 bg-[url('https://www.transparenttextures.com/patterns/cubes.png')] opacity-[0.03] mix-blend-overlay"></div>
|
||||
</div>
|
||||
|
||||
<!-- Main Content Area -->
|
||||
|
|
@ -104,13 +105,12 @@ onMounted(async () => {
|
|||
</template>
|
||||
|
||||
<style scoped>
|
||||
@keyframes slide-up {
|
||||
from { opacity: 0; transform: translateY(30px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
@keyframes fade-in {
|
||||
from { opacity: 0; transform: translateX(-20px); }
|
||||
to { opacity: 1; transform: translateX(0); }
|
||||
}
|
||||
|
||||
.slide-up {
|
||||
animation: slide-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
|
||||
opacity: 0;
|
||||
.animate-fade-in {
|
||||
animation: fade-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ useHead({
|
|||
const route = useRoute()
|
||||
const showEnrollModal = ref(false)
|
||||
const activeFilter = ref<'all' | 'progress' | 'completed'>('all')
|
||||
const searchQuery = ref('')
|
||||
|
||||
|
||||
// Check URL query parameters to show 'Enrollment Success' modal
|
||||
|
|
@ -71,6 +72,7 @@ const loadEnrolledCourses = async () => {
|
|||
enrollment_id: item.id,
|
||||
title: item.course.title,
|
||||
progress: item.progress_percentage || 0,
|
||||
lessons: item.course.total_lessons || 0,
|
||||
completed: item.status === 'COMPLETED',
|
||||
thumbnail_url: item.course.thumbnail_url
|
||||
}))
|
||||
|
|
@ -83,6 +85,16 @@ watch(activeFilter, () => {
|
|||
loadEnrolledCourses()
|
||||
})
|
||||
|
||||
// Client-side Search Filtering
|
||||
const filteredEnrolledCourses = computed(() => {
|
||||
if (!searchQuery.value) return enrolledCourses.value
|
||||
const query = searchQuery.value.toLowerCase()
|
||||
return enrolledCourses.value.filter(c => {
|
||||
const title = getLocalizedText(c.title).toLowerCase()
|
||||
return title.includes(query)
|
||||
})
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (route.query.enrolled) {
|
||||
showEnrollModal.value = true
|
||||
|
|
@ -138,21 +150,43 @@ const validCourseId = computed(() => {
|
|||
<div class="page-container">
|
||||
|
||||
|
||||
<!-- Page Header & Filters -->
|
||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-6 mb-10">
|
||||
<h1 class="text-3xl font-black text-slate-900 dark:text-white">{{ $t('sidebar.myCourses') }}</h1>
|
||||
<!-- Page Header & Filters (Unified Layout) -->
|
||||
<div class="flex flex-col gap-6 mb-10">
|
||||
<div class="flex flex-col md:flex-row md:items-center justify-between gap-6">
|
||||
<h1 class="text-3xl font-black text-slate-900 dark:text-white flex items-center gap-3">
|
||||
<span class="w-1.5 h-8 bg-blue-600 rounded-full shadow-sm shadow-blue-500/50"></span>
|
||||
{{ $t('sidebar.myCourses') }}
|
||||
</h1>
|
||||
|
||||
<!-- Filter Tabs -->
|
||||
<div class="flex gap-2">
|
||||
<!-- Search Input -->
|
||||
<div class="flex items-center gap-3 w-full md:w-auto">
|
||||
<q-input
|
||||
v-model="searchQuery"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:placeholder="$t('discovery.searchPlaceholder')"
|
||||
class="w-full md:w-72 search-input shadow-sm"
|
||||
bg-color="transparent"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="search" class="text-slate-400" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filter Tabs (Horizontal Bar) -->
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<q-btn
|
||||
v-for="filter in ['all', 'progress', 'completed']"
|
||||
:key="filter"
|
||||
@click="activeFilter = filter as any"
|
||||
flat
|
||||
rounded
|
||||
unelevated
|
||||
:color="activeFilter === filter ? 'primary' : 'white'"
|
||||
:text-color="activeFilter === filter ? 'white' : 'grey-8'"
|
||||
class="font-bold px-6"
|
||||
dense
|
||||
class="px-4 font-bold transition-all text-xs uppercase tracking-widest"
|
||||
:class="activeFilter === filter ? 'bg-blue-600 text-white shadow-lg shadow-blue-600/30' : 'bg-white dark:bg-slate-800 text-slate-500 dark:text-slate-400 border border-slate-200 dark:border-white/5'"
|
||||
:label="$t(`myCourses.filter${filter.charAt(0).toUpperCase() + filter.slice(1)}`)"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -163,7 +197,7 @@ const validCourseId = computed(() => {
|
|||
<q-spinner size="3rem" color="primary" />
|
||||
</div>
|
||||
<div v-else class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
||||
<template v-for="course in enrolledCourses" :key="course.id">
|
||||
<template v-for="course in filteredEnrolledCourses" :key="course.id">
|
||||
<!-- In Progress Course Card -->
|
||||
<CourseCard
|
||||
v-if="!course.completed"
|
||||
|
|
@ -192,10 +226,18 @@ const validCourseId = computed(() => {
|
|||
</div>
|
||||
|
||||
<!-- Empty State -->
|
||||
<div v-if="!isLoading && enrolledCourses.length === 0" class="flex flex-col items-center justify-center py-20 bg-slate-50 dark:bg-slate-800/50 rounded-3xl border-2 border-dashed border-slate-200 dark:border-slate-700 mt-4">
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-2">{{ $t('myCourses.emptyTitle') }}</h3>
|
||||
<p class="text-slate-500 dark:text-slate-400 text-center max-w-md">{{ $t('myCourses.emptyDesc') }}</p>
|
||||
<NuxtLink to="/browse/discovery" class="mt-6 px-6 py-2 bg-blue-600 text-white rounded-lg font-bold hover:bg-blue-700 transition-colors">{{ $t('myCourses.goToDiscovery') }}</NuxtLink>
|
||||
<div v-if="!isLoading && filteredEnrolledCourses.length === 0" class="flex flex-col items-center justify-center py-20 bg-slate-50 dark:bg-slate-800/50 rounded-3xl border-2 border-dashed border-slate-200 dark:border-slate-700 mt-4">
|
||||
<q-icon v-if="searchQuery" name="search_off" size="64px" class="text-slate-300 dark:text-slate-600 mb-4" />
|
||||
<h3 class="text-xl font-bold text-slate-900 dark:text-white mb-2">
|
||||
{{ searchQuery ? $t('discovery.emptyTitle') : $t('myCourses.emptyTitle') }}
|
||||
</h3>
|
||||
<p class="text-slate-500 dark:text-slate-400 text-center max-w-md">
|
||||
{{ searchQuery ? $t('discovery.emptyDesc') : $t('myCourses.emptyDesc') }}
|
||||
</p>
|
||||
<NuxtLink v-if="!searchQuery" to="/browse/discovery" class="mt-6 px-6 py-2 bg-blue-600 text-white rounded-lg font-bold hover:bg-blue-700 transition-colors">{{ $t('myCourses.goToDiscovery') }}</NuxtLink>
|
||||
<button v-else class="mt-4 font-bold text-blue-600 hover:text-blue-700 transition-colors" @click="searchQuery = ''">
|
||||
{{ $t('discovery.showAll') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- MODAL: Enrollment Success -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue