refactor(modules): update classes, course-plans, diagnostic, questions, settings, student, layout
- Update classes data-access (invitations, main) for invitation management - Update course-plans actions, data-access, and types - Update diagnostic data-access for report queries - Update questions data-access for question bank queries - Update settings actions, ai-provider-settings-card, data-access, and types - Update student course-filters, student-courses-view, student-schedule-filters, student-schedule-view - Update layout app-sidebar, site-header, and navigation config
This commit is contained in:
@@ -4,6 +4,7 @@ import * as React from "react"
|
||||
import Link from "next/link"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { ChevronRight } from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
import {
|
||||
Collapsible,
|
||||
@@ -31,6 +32,8 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
const { expanded, toggleSidebar, isMobile } = useSidebar()
|
||||
const pathname = usePathname()
|
||||
const { permissions, hasRole } = usePermission()
|
||||
const tNav = useTranslations("nav")
|
||||
const tCommon = useTranslations("common")
|
||||
|
||||
// 自动检测当前角色(优先级 admin > student > parent > teacher)
|
||||
// 注意:grade_head / teaching_head 统一归入 teacher,因为 teacher 导航已通过
|
||||
@@ -86,6 +89,7 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
{navItems.map((item, index) => {
|
||||
const isActive = pathname.startsWith(item.href)
|
||||
const hasChildren = item.items && item.items.length > 0
|
||||
const title = tNav(item.title)
|
||||
|
||||
if (!expanded && !isMobile) {
|
||||
// Collapsed Mode (Icon Only + Tooltip)
|
||||
@@ -100,10 +104,10 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
)}
|
||||
>
|
||||
<item.icon className="size-5" />
|
||||
<span className="sr-only">{item.title}</span>
|
||||
<span className="sr-only">{title}</span>
|
||||
</Link>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">{item.title}</TooltipContent>
|
||||
<TooltipContent side="right">{title}</TooltipContent>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
@@ -121,7 +125,7 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<item.icon className="size-4" />
|
||||
<span>{item.title}</span>
|
||||
<span>{title}</span>
|
||||
</div>
|
||||
<ChevronRight className="text-muted-foreground size-4 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
|
||||
</button>
|
||||
@@ -137,7 +141,7 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
pathname === subItem.href && "text-foreground font-medium"
|
||||
)}
|
||||
>
|
||||
{subItem.title}
|
||||
{tNav(subItem.title)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
@@ -156,7 +160,7 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
)}
|
||||
>
|
||||
<item.icon className="size-4" />
|
||||
<span>{item.title}</span>
|
||||
<span>{title}</span>
|
||||
{item.href === "/messages" ? <UnreadMessageBadge /> : null}
|
||||
</Link>
|
||||
)
|
||||
@@ -172,7 +176,7 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
onClick={toggleSidebar}
|
||||
className="hover:bg-sidebar-accent text-sidebar-foreground flex w-full items-center justify-center rounded-md border p-2 text-sm transition-colors"
|
||||
>
|
||||
{expanded ? "收起" : <ChevronRight className="size-4" />}
|
||||
{expanded ? tCommon("sidebar.collapse") : <ChevronRight className="size-4" />}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user