Dev - #62
Merged
Merged
Conversation
Universe/release v1
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR is a broad "dev" sync that wires up the teacher Lost & Found page to the backend, removes some unfinished UI placeholders (Dark Mode toggles), refreshes the RAG policy document model to use a status field, introduces a shared api-client helper and a calendar API client, adjusts the teacher overview "Absentees" calculation, and adds react-hot-toast for user notifications. A stale firebase-debug.log is also removed.
Changes:
- Replace mocked data and local toggles in the teacher Lost & Found page with real API calls (
/api/lost-found/...), spinner state, and toast feedback; addreact-hot-toastand a sharedrequest<T>()client. - Drop the placeholder Dark Mode / Preferences UI from the sidebar and teacher profile page; add a Lost & Found entry to admin/teacher sidebars and a new
calendar-apimodule. - Evolve RAG
PolicyDocumentfromis_processed: booleanto astatusenum +error_message; changeOverviewStatsto an interface and add optionaltodayClassroomPresent, now used by the teacher overview absentees stat.
Reviewed changes
Copilot reviewed 86 out of 92 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
package-lock.json |
Adds react-hot-toast@^2.6.0 and its goober dependency. |
firebase-debug.log |
Removes a committed local Firebase CLI debug log. |
apps/frontend/src/shared/lib/api-client.ts |
New shared request<T>() helper with ApiResult discriminated union. |
apps/frontend/src/shared/components/layout/sidebarConfig.ts |
Adds "Lost & Found" entry for admin sidebar. |
apps/frontend/src/shared/components/layout/Sidebar.tsx |
Removes Dark Mode placeholder block from sidebar footer. |
apps/frontend/src/features/school/lib/school-api.ts |
Converts OverviewStats to interface and adds optional todayClassroomPresent. |
apps/frontend/src/features/rag/lib/rag-api.ts |
Replaces is_processed with status + error_message for documents. |
apps/frontend/src/features/calendar/lib/calendar-api.ts |
New CRUD client for calendar events. |
apps/frontend/src/app/teacher/profile/page.tsx |
Removes Preferences/Dark Mode/Email Notifications UI and unused state. |
apps/frontend/src/app/teacher/overview/page.tsx |
Computes absentees from todayClassroomPresent instead of gate attendance. |
apps/frontend/src/app/teacher/lost-and-found/page.tsx |
Replaces mock data with API-backed fetching, posting and status updates with toast feedback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
226
to
242
| {filtered.length === 0 ? ( | ||
| <div className="flex flex-col items-center justify-center py-20 text-center text-gray-400 bg-white border border-gray-200 rounded-[20px]"> | ||
| <Package className="w-10 h-10 mb-3 text-gray-300" /> | ||
| <p className="font-semibold text-[#334155]">No items found</p> | ||
| <p className="text-sm mt-1">Try adjusting your filters or post a new item.</p> | ||
| </div> | ||
| ) : ( | ||
| <div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-5"> | ||
| {filtered.map((item) => ( | ||
| <ItemCard key={item.id} item={item} onToggleStatus={handleToggleStatus} /> | ||
| {isLoading ? ( | ||
| <div className="col-span-full py-20 flex justify-center"> | ||
| <Loader2 className="w-8 h-8 text-indigo-500 animate-spin" /> | ||
| </div> | ||
| ) : filtered.map((item) => ( | ||
| <ItemCard key={item.id} item={item} onToggleStatus={() => handleToggleStatus(item.id, item.status, item.type)} /> | ||
| ))} | ||
| </div> | ||
| )} |
Comment on lines
+129
to
+138
| } : { | ||
| item_name: form.title, | ||
| description: form.description, | ||
| location: form.location, | ||
| date: form.date || new Date().toISOString().split("T")[0], | ||
| postedBy: "Samantha Perera", | ||
| postedByRole: "teacher", | ||
| status: "active", | ||
| bgColor: form.type === "lost" ? "bg-orange-100" : "bg-teal-100", | ||
| tags: [], | ||
| student_id: "", // Teacher posting lost report needs a student ID? Maybe only for parents. | ||
| date_lost: form.date || new Date().toISOString() | ||
| }; | ||
| setItems((prev) => [newItem, ...prev]); | ||
| setShowModal(false); | ||
| setForm(EMPTY_FORM); | ||
| setTab("all"); | ||
|
|
||
| // Note: Teacher posting LOST might not work if backend strictly requires student_id for reports. | ||
| // However, teachers usually post FOUND items. | ||
|
|
|
|
||
| const handleToggleStatus = (id: string) => { | ||
| setItems((prev) => prev.map((item) => item.id === id ? { ...item, status: item.status === "active" ? "claimed" : "active" } : item)); | ||
| const handleToggleStatus = async (id: string, currentStatus: ItemStatus, type: ItemType) => { |
Comment on lines
+82
to
+91
| useEffect(() => { | ||
| mountedRef.current = true; | ||
| const timeout = setTimeout(() => { | ||
| if (mountedRef.current) void fetchItems(); | ||
| }, 0); | ||
| return () => { | ||
| mountedRef.current = false; | ||
| clearTimeout(timeout); | ||
| }; | ||
| }, [fetchItems]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.