feat: Implement initial e-learning platform frontend structure including dashboard, course management, authentication, and common UI components.
This commit is contained in:
parent
aceeb80d9a
commit
ad11c6b7c5
44 changed files with 720 additions and 578 deletions
|
|
@ -1,17 +1,19 @@
|
|||
/**
|
||||
* @file useNavItems.ts
|
||||
* @description Single Source of Truth for navigation items used across the app (Sidebar, Mobile Nav, User Menu).
|
||||
* @description ศูนย์รวมจัดการเมนูนำทาง (Navigation Items) เพื่อให้ใช้ข้อมูลชุดเดียวกันทั้งเว็บ
|
||||
* (เช่น เมนูด้านข้าง, เมนูบนมือถือ, และเมนูโปรไฟล์ผู้ใช้)
|
||||
*/
|
||||
|
||||
export interface NavItem {
|
||||
to: string
|
||||
labelKey: string
|
||||
icon: string
|
||||
showOn: ('sidebar' | 'mobile' | 'userMenu')[]
|
||||
roles?: string[]
|
||||
to: string // ลิงก์ปลายทาง
|
||||
labelKey: string // คีย์ภาษาสำหรับ i18n
|
||||
icon: string // ไอคอนจาก Material Icons
|
||||
showOn: ('sidebar' | 'mobile' | 'userMenu')[] // กำหนดให้โชว์ที่ส่วนไหนบ้าง
|
||||
roles?: string[] // กำหนดสิทธิ์ผู้ใช้ที่จะเห็น (ถ้ามี)
|
||||
}
|
||||
|
||||
export const useNavItems = () => {
|
||||
// เมนูทั้งหมดในระบบ กำหนดไว้ที่เดียว
|
||||
const allNavItems: NavItem[] = [
|
||||
{
|
||||
to: '/dashboard',
|
||||
|
|
@ -63,6 +65,7 @@ export const useNavItems = () => {
|
|||
}
|
||||
]
|
||||
|
||||
// คัดกรองเมนูที่จะเอาไปแสดงแต่ละตำแหน่ง
|
||||
const sidebarItems = computed(() => allNavItems.filter(item => item.showOn.includes('sidebar')))
|
||||
const mobileItems = computed(() => allNavItems.filter(item => item.showOn.includes('mobile')))
|
||||
const userMenuItems = computed(() => allNavItems.filter(item => item.showOn.includes('userMenu')))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue