refactor: fix remaining P2 architecture issues
Fix P2-6: proxy.ts now uses Permissions constants instead of hardcoded strings Fix P2-7: useA11yId file no longer exists (use-aria-live.ts already in hooks/) Fix P2-8: schema.ts section numbering reordered to continuous 1-24 Fix P2-11: announcements dead code void wasPublished already removed Fix P2-17: app-sidebar.tsx uses hasRole() instead of permission-based role inference Fix P2-18: scheduling/actions.ts removes trailing re-export of data-access; 4 pages now import directly from data-access Sync architecture docs 004 and 005
This commit is contained in:
@@ -19,7 +19,7 @@ import {
|
||||
} from "@/shared/components/ui/tooltip"
|
||||
import { cn } from "@/shared/lib/utils"
|
||||
import { usePermission } from "@/shared/hooks"
|
||||
import { Permissions, type Permission } from "@/shared/types/permissions"
|
||||
import { type Permission } from "@/shared/types/permissions"
|
||||
import { useSidebar } from "./sidebar-provider"
|
||||
import { NAV_CONFIG, Role } from "../config/navigation"
|
||||
|
||||
@@ -32,11 +32,11 @@ export function AppSidebar({ mode }: AppSidebarProps) {
|
||||
const pathname = usePathname()
|
||||
const { permissions, hasRole } = usePermission()
|
||||
|
||||
// Determine which role's nav config to use based on permissions
|
||||
// Determine which role's nav config to use based on session roles
|
||||
let currentRole: Role = "teacher"
|
||||
if (permissions.includes(Permissions.SCHOOL_MANAGE)) {
|
||||
if (hasRole("admin")) {
|
||||
currentRole = "admin"
|
||||
} else if (permissions.includes(Permissions.HOMEWORK_SUBMIT) && !permissions.includes(Permissions.EXAM_CREATE)) {
|
||||
} else if (hasRole("student")) {
|
||||
currentRole = "student"
|
||||
} else if (hasRole("parent")) {
|
||||
currentRole = "parent"
|
||||
|
||||
@@ -15,8 +15,6 @@ import {
|
||||
createScheduleChange,
|
||||
updateScheduleChangeStatus,
|
||||
getClassConflicts,
|
||||
getAdminClassesForScheduling,
|
||||
getTeachersForScheduling,
|
||||
getClassroomsForScheduling,
|
||||
getClassSubjectsForScheduling,
|
||||
replaceClassSchedule,
|
||||
@@ -280,13 +278,3 @@ export async function getClassConflictsAction(
|
||||
return { success: false, message: "Unexpected error" }
|
||||
}
|
||||
}
|
||||
|
||||
// Re-export data-access for server pages
|
||||
export {
|
||||
getSchedulingRules,
|
||||
getScheduleChanges,
|
||||
getClassConflicts,
|
||||
getAdminClassesForScheduling,
|
||||
getTeachersForScheduling,
|
||||
getClassroomsForScheduling,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user