feat: scaffold Nuxt 3 application with initial core pages, components, and comprehensive 'My Courses' view.
This commit is contained in:
parent
af7890cc8f
commit
0c0121eac7
7 changed files with 308 additions and 238 deletions
|
|
@ -22,6 +22,8 @@ useHead({
|
|||
const showDetail = ref(false);
|
||||
// searchQuery: เก็บคำค้นหาที่ผู้ใช้พิมพ์
|
||||
const searchQuery = ref("");
|
||||
const sortOption = ref('เรียงตาม: ล่าสุด')
|
||||
const sortOptions = ['เรียงตาม: ล่าสุด', 'ราคา: ต่ำไปสูง', 'ราคา: สูงไปต่ำ']
|
||||
// isCategoryOpen: ควบคุมการเปิด/ปิดเมนูหมวดหมู่ด้านข้าง
|
||||
const isCategoryOpen = ref(true);
|
||||
|
||||
|
|
@ -193,29 +195,32 @@ const { currentUser } = useAuth();
|
|||
<!-- Right Side: Search & Sort -->
|
||||
<div class="flex items-center gap-3">
|
||||
<!-- Search Input -->
|
||||
<div class="relative">
|
||||
<input
|
||||
v-model="searchQuery"
|
||||
type="text"
|
||||
class="pl-4 pr-10 py-2 rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-900 dark:text-white focus:outline-none focus:border-slate-400 w-full md:w-64 text-sm"
|
||||
placeholder="ค้นหาคอร์ส..."
|
||||
/>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="absolute right-3 top-2.5 h-4 w-4 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
||||
</svg>
|
||||
</div>
|
||||
<q-input
|
||||
v-model="searchQuery"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
placeholder="ค้นหาคอร์ส..."
|
||||
class="bg-white dark:bg-slate-800 w-full md:w-64"
|
||||
bg-color="white"
|
||||
dark:bg-color="slate-800"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" class="text-slate-400" />
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<!-- Sort Dropdown (Dummy) -->
|
||||
<div class="relative">
|
||||
<select class="appearance-none pl-4 pr-10 py-2 rounded-lg border border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-800 text-slate-700 dark:text-slate-200 text-sm focus:outline-none focus:border-slate-400 cursor-pointer">
|
||||
<option>เรียงตาม: ล่าสุด</option>
|
||||
<option>ราคา: ต่ำไปสูง</option>
|
||||
<option>ราคา: สูงไปต่ำ</option>
|
||||
</select>
|
||||
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-slate-500">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Sort Dropdown -->
|
||||
<q-select
|
||||
v-model="sortOption"
|
||||
:options="sortOptions"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
class="bg-white dark:bg-slate-800 w-40"
|
||||
bg-color="white"
|
||||
behavior="menu"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -310,17 +315,17 @@ const { currentUser } = useAuth();
|
|||
|
||||
<!-- COURSE DETAIL VIEW: Detailed information about a specific course -->
|
||||
<div v-else>
|
||||
<button
|
||||
@click="showDetail = false"
|
||||
class="mb-6 inline-flex items-center gap-2 text-slate-500 hover:text-slate-900 dark:hover:text-white transition-colors font-medium"
|
||||
>
|
||||
<span>←</span> {{ $t('discovery.backToCatalog') }}
|
||||
</button>
|
||||
<q-btn
|
||||
flat
|
||||
icon="arrow_back"
|
||||
:label="$t('discovery.backToCatalog')"
|
||||
color="grey-7"
|
||||
class="mb-6 font-medium"
|
||||
@click="showDetail = false"
|
||||
/>
|
||||
|
||||
<div v-if="isLoadingDetail" class="flex justify-center py-20">
|
||||
<div class="spinner-border animate-spin inline-block w-8 h-8 border-4 border-blue-500 rounded-full border-t-transparent" role="status">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<q-spinner size="3rem" color="primary" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="selectedCourse" class="grid grid-cols-1 lg:grid-cols-12 gap-8">
|
||||
|
|
@ -364,7 +369,7 @@ const { currentUser } = useAuth();
|
|||
<div v-for="(chapter, index) in selectedCourse.chapters" :key="chapter.id" class="border border-slate-200 dark:border-slate-700 rounded-xl overflow-hidden">
|
||||
<div class="bg-slate-50 dark:bg-slate-800/80 p-4 flex justify-between items-center cursor-pointer">
|
||||
<div class="font-bold text-slate-800 dark:text-slate-200">
|
||||
<span class="opacity-50 mr-2">Chapter {{ index + 1 }}</span>
|
||||
<span class="opacity-50 mr-2">Chapter {{ Number(index) + 1 }}</span>
|
||||
{{ getLocalizedText(chapter.title) }}
|
||||
</div>
|
||||
<span class="text-xs font-bold px-3 py-1 bg-white dark:bg-slate-700 rounded-full border border-slate-200 dark:border-slate-600">
|
||||
|
|
@ -376,7 +381,7 @@ const { currentUser } = useAuth();
|
|||
<div v-for="(lesson, lIndex) in chapter.lessons" :key="lesson.id" class="p-4 flex justify-between items-center hover:bg-slate-50 dark:hover:bg-slate-700/30 transition-colors">
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="w-6 h-6 rounded-full bg-slate-100 dark:bg-slate-700 flex items-center justify-center text-[10px] font-bold text-slate-500">
|
||||
{{ lIndex + 1 }}
|
||||
{{ Number(lIndex) + 1 }}
|
||||
</div>
|
||||
<span class="text-slate-700 dark:text-slate-300 font-medium text-sm">{{ getLocalizedText(lesson.title) }}</span>
|
||||
</div>
|
||||
|
|
@ -398,14 +403,19 @@ const { currentUser } = useAuth();
|
|||
</h2>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<q-btn
|
||||
@click="handleEnroll(selectedCourse.id)"
|
||||
class="w-full py-4 rounded-xl bg-gradient-to-r from-blue-600 to-indigo-600 text-white font-bold text-lg shadow-lg hover:shadow-blue-500/30 hover:scale-[1.02] transform transition-all active:scale-95 disabled:opacity-70 disabled:cursor-not-allowed mb-4 flex items-center justify-center gap-2"
|
||||
:disabled="isEnrolling"
|
||||
unetab
|
||||
unelevated
|
||||
rounded
|
||||
class="w-full py-3 text-lg font-bold bg-gradient-to-r from-blue-600 to-indigo-600 text-white shadow-lg"
|
||||
:loading="isEnrolling"
|
||||
:label="$t('course.enrollNow')"
|
||||
>
|
||||
<span v-if="isEnrolling" class="block w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"></span>
|
||||
{{ $t('course.enrollNow') }}
|
||||
</button>
|
||||
<template v-slot:loading>
|
||||
<q-spinner-facebook />
|
||||
</template>
|
||||
</q-btn>
|
||||
|
||||
<div class="text-sm space-y-3 pt-4 border-t border-slate-100 dark:border-slate-700">
|
||||
<div class="flex justify-between text-slate-600 dark:text-slate-400">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue