108 lines
7.2 KiB
Markdown
108 lines
7.2 KiB
Markdown
# Work Log
|
|
|
|
## 2026-01-15
|
|
|
|
### 1. Schedule Module Optimization
|
|
* **Visual Overhaul (`schedule-view.tsx`)**:
|
|
* Refactored the schedule grid to match the exact design of the `ClassScheduleGrid` widget.
|
|
* Implemented a clean, borderless layout with no grid lines for a modern look.
|
|
* **Time-Based Positioning**: Replaced grid-row logic with absolute positioning based on time (8:00 - 18:00 range) using percentage calculations (`getPositionStyle`).
|
|
* **Color Coding**: Added `getSubjectColor` to auto-assign thematic colors (blue for Math, purple for Physics, etc.) based on course names.
|
|
* **Card Design**: Refined course cards with vertical centering, better spacing, and removed unnecessary UI elements (like the "+" button in headers).
|
|
|
|
* **Filter Bar Refinement (`schedule-filters.tsx`)**:
|
|
* **Minimalist Design**: Removed borders and shadows from the class selector and buttons to integrate seamlessly with the background.
|
|
* **Center Label**: Added a dynamic, absolute-centered text label that updates based on selection:
|
|
* Shows "All Classes" when no filter is active.
|
|
* Shows "{Class Name}" when a specific class is selected.
|
|
* **Simplified Controls**: Removed the "Reset" button (X icon) entirely for a cleaner interface.
|
|
* **Ghost Buttons**: Styled the "Add Event" button as a ghost variant with muted colors.
|
|
|
|
### 2. Architecture & Cleanup
|
|
* **Insights Module Removal**:
|
|
* Deleted the entire `src/app/(dashboard)/teacher/classes/insights` directory as the feature was deemed redundant.
|
|
* Removed `insights-filters.tsx` component.
|
|
* Updated `navigation.ts` to remove the "Insights" link from the sidebar.
|
|
* *Note*: Preserved `getClassHomeworkInsights` in `data-access.ts` as it's still used by the Class Detail dashboard widgets.
|
|
|
|
### 3. Verification
|
|
* **Type Safety**: Ran `npm run typecheck` multiple times during refactoring to ensure no regressions (Passed).
|
|
* **Build**: Attempted to clear build cache to resolve a chunk loading error (Windows permission issue encountered but workaround applied).
|
|
|
|
## 2026-01-14
|
|
|
|
### 1. Class Management Refactoring (Role Separation)
|
|
* **Separation of Duties**:
|
|
* Moved class creation and management responsibilities from the generic Teacher view to a dedicated Management view.
|
|
* Created **Grade Management Page** at `src/app/(dashboard)/management/grade/classes/page.tsx` for Grade Directors and Admins.
|
|
* Teachers can now only **Join Classes** (via code) or view their assigned classes in "My Classes".
|
|
|
|
* **New Components & Pages**:
|
|
* `GradeClassesView` (`src/modules/classes/components/grade-classes-view.tsx`): A comprehensive table view for managing classes within specific grades, supporting creation, editing, and deletion.
|
|
* `GradeClassesPage`: Server Component that fetches managed grades and classes using strict RBAC (Role-Based Access Control).
|
|
|
|
* **Teacher "My Classes" Update (`my-classes-grid.tsx`)**:
|
|
* Removed the "Create Class" button/dialog.
|
|
* Added a **"Join Class"** dialog that accepts a 6-digit invitation code.
|
|
* Updated styling to use standard design system colors (`bg-card`, `border-border`) instead of hardcoded gradients.
|
|
|
|
### 2. Backend & Logic Updates
|
|
* **Data Access (`data-access.ts`)**:
|
|
* Implemented `getGradeManagedClasses`: Fetches classes for grades where the user is either a Grade Head or Teaching Head.
|
|
* Implemented `getManagedGrades`: Fetches the list of grades managed by the user for the creation dropdown.
|
|
* Updated `getTeacherClasses`: Now returns both **owned classes** (assigned by admin) and **enrolled classes** (joined via code).
|
|
* Fixed a SQL syntax error in `getGradeManagedClasses` (unescaped backticks in template literal).
|
|
|
|
* **Server Actions (`actions.ts`)**:
|
|
* Added `createGradeClassAction`, `updateGradeClassAction`, `deleteGradeClassAction`: These actions enforce that the user manages the target grade before performing operations.
|
|
* Updated `joinClassByInvitationCodeAction`: Expanded to allow Teachers (role `teacher`) to join classes, not just Students.
|
|
|
|
### 3. Verification
|
|
* **RBAC**: Verified that users can only manage classes for grades they are assigned to.
|
|
* **Flow**: Verified Teacher "Join Class" flow correctly redirects and updates the list.
|
|
* **Syntax**: Fixed TypeScript/SQL syntax errors in the new data access functions.
|
|
|
|
### 4. Class UI/UX Optimization
|
|
* **Students Management Interface (`students-table.tsx`, `students-filters.tsx`)**:
|
|
* **Enhanced Table**: Added student avatars, gender display, and join date.
|
|
* **Pagination**: Implemented client-side pagination (10 items per page) to handle larger classes gracefully.
|
|
* **Status Filtering**: Added "Active/Inactive" filter with visual status badges (Emerald for active, muted for inactive).
|
|
* **Data Access**: Updated `getClassStudents` to fetch extended user profile data and support server-side status filtering.
|
|
|
|
* **Class Detail Dashboard (`/teacher/classes/my/[id]/page.tsx`)**:
|
|
* **Dashboard Layout**: Refactored into a responsive two-column layout (Main Content + Sidebar).
|
|
* **Key Metrics**: Added a 4-card stats grid at the top displaying critical insights:
|
|
* Total Students (Active/Inactive breakdown)
|
|
* Schedule Items (Weekly sessions)
|
|
* Active Assignments (Overdue count)
|
|
* Class Average (Based on graded submissions)
|
|
* **Sidebar Widgets**: Added "Class Schedule" and "Homework History" widgets for quick access to temporal data.
|
|
* **Visual Polish**: Integrated `lucide-react` icons throughout for better information scanning.
|
|
|
|
## 2026-01-13
|
|
|
|
### 1. Navigation & Layout Improvements
|
|
* **Dynamic Breadcrumbs (`site-header.tsx`)**:
|
|
* Replaced hardcoded "Dashboard > Overview" breadcrumbs with a dynamic system.
|
|
* Implemented a path-to-title lookup using `NAV_CONFIG` from `src/modules/layout/config/navigation.ts`.
|
|
* Added logic to filter out root role segments (admin/teacher/student/parent) for cleaner paths.
|
|
* Added fallback capitalization for segments not found in the config.
|
|
* Refactored `SiteHeader` to use `usePathname` for real-time route updates.
|
|
|
|
### 2. Code Quality & Bug Fixes
|
|
* **Type Safety (`homework-grading-view.tsx`)**:
|
|
* Fixed a TypeScript error where a boolean expression was returning `boolean | undefined` which is not a valid React node (implicit `true` check added).
|
|
* Resolved "Calling setState synchronously within an effect" React warning by initializing state lazily instead of using `useEffect`.
|
|
* Fixed implicit `any` type errors in map functions.
|
|
* **Linting**:
|
|
* Cleaned up unused imports across multiple files (`exam-actions.tsx`, `exam-assembly.tsx`, `textbook-reader.tsx`, etc.).
|
|
* Fixed unescaped HTML entities in `student-dashboard-header.tsx` and others.
|
|
* Removed unused variables to clear ESLint warnings.
|
|
* **Refactoring**:
|
|
* Updated `TextbookCard` to support `hideActions` prop for better reuse in student views.
|
|
* Added missing `Progress` component to `src/shared/components/ui/progress.tsx`.
|
|
|
|
### 3. Verification
|
|
* Ran `npm run typecheck`: **Passed** (0 errors).
|
|
* Ran `npm run lint`: **Passed** (0 errors, 28 warnings remaining for unused vars/components that may be needed later).
|