Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
48bf071
Implement View Submissions page, with mock data
YUMO9743 Oct 17, 2025
551f390
Add student name for submission history.
YUMO9743 Oct 23, 2025
36018f4
Modify the style for view submission page to match the requirement
YUMO9743 Oct 28, 2025
ea08511
Added AssignGrades Page
SpencerKersey Oct 29, 2025
44c2af4
Update SubmissionsView.tsx
SpencerKersey Oct 29, 2025
d602c60
Update SubmissionGradeModal.tsx
SpencerKersey Oct 29, 2025
73fa3c8
Added test cases for front end view submissions
SiddhiKhairee Oct 29, 2025
a651e12
Test the necessary validations and formatting
SiddhiKhairee Oct 29, 2025
baccb43
Testing the Assign grades functionality
SiddhiKhairee Oct 29, 2025
50ea5da
Merge branch 'reimplement' of https://github.com/YUMO9743/reimplement…
SiddhiKhairee Oct 29, 2025
693aa95
Add tests for view submissions
SiddhiKhairee Oct 29, 2025
6f67333
Revert "Add tests for view submissions"
SiddhiKhairee Oct 29, 2025
d5babd1
Update SubmissionHistoryView.tsx
SpencerKersey Oct 29, 2025
4c5f668
Update AssignGrades.tsx
SpencerKersey Oct 29, 2025
d4b592c
Add description of modified view Submission page
YUMO9743 Oct 29, 2025
fa4960f
Add comment to ViewSubmissions.css for clarity
YUMO9743 Oct 29, 2025
cb97838
remove mock login
YUMO9743 Oct 29, 2025
bd1f67a
Revert TypeScript version to ^5.9.2
YUMO9743 Oct 29, 2025
7534642
Revert the package-lock.json file
YUMO9743 Oct 29, 2025
585c293
Merge branch 'reimplement' of https://github.com/YUMO9743/reimplement…
SiddhiKhairee Oct 29, 2025
59de570
heroku deployment
SiddhiKhairee Oct 29, 2025
6cd247c
Fixed server js
SiddhiKhairee Oct 29, 2025
c5524c8
change
SiddhiKhairee Oct 29, 2025
386c999
Enable mock data in production
SiddhiKhairee Oct 29, 2025
d3c7880
Mock login
SiddhiKhairee Oct 29, 2025
3652ab8
Mock login shii
SiddhiKhairee Oct 29, 2025
a8dc97f
change
SiddhiKhairee Oct 29, 2025
e8bd4a1
change
SiddhiKhairee Oct 29, 2025
e2124b9
change
SiddhiKhairee Oct 29, 2025
5814ae9
change
SiddhiKhairee Oct 29, 2025
28ebe48
change
SiddhiKhairee Oct 29, 2025
40ff88c
change
SiddhiKhairee Oct 29, 2025
0f3f899
change
SiddhiKhairee Oct 29, 2025
4300d5a
Mock Login
SiddhiKhairee Oct 29, 2025
0daca5d
Revert "Revert the package-lock.json file"
YUMO9743 Oct 31, 2025
f8b6b8d
Revert "heroku deployment"
YUMO9743 Oct 31, 2025
ceaad13
Corrected the test error
SiddhiKhairee Oct 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ import Email_the_author from "./pages/Email_the_author/email_the_author";
import CreateTeams from "pages/Assignments/CreateTeams";
import AssignReviewer from "pages/Assignments/AssignReviewer";
import ViewSubmissions from "pages/Assignments/ViewSubmissions";
import AssignGrades, { assignGradesLoader } from "pages/Assignments/AssignGrades";
import ViewScores from "pages/Assignments/ViewScores";
import ViewReports from "pages/Assignments/ViewReports";
import ViewDelayedJobs from "pages/Assignments/ViewDelayedJobs";
import SubmissionHistoryView from "./pages/Submissions/SubmissionHistoryView";
function App() {
const router = createBrowserRouter([
{
Expand Down Expand Up @@ -75,6 +77,11 @@ function App() {
element: <ViewSubmissions />,
loader: loadAssignment,
},
{
path: "/assignments/:assignmentId/assign-grades",
element: <AssignGrades />,
loader: assignGradesLoader
},
{
path: "assignments/edit/:id/viewscores",
element: <ViewScores />,
Expand All @@ -90,6 +97,10 @@ function App() {
element: <ViewDelayedJobs />,
loader: loadAssignment,
},
{
path: "submissions/history/:id",
element: <SubmissionHistoryView />,
},
{
path: "assignments",
element: <ProtectedRoute element={<Assignment />} leastPrivilegeRole={ROLE.TA} />,
Expand Down Expand Up @@ -138,6 +149,8 @@ function App() {
},
],
},
// Legacy route redirect: keep supporting old student_tasks path
{ path: "student_tasks", element: <Navigate to="/assignments" /> },
{
path: "profile",
element: <ProtectedRoute element={<EditProfile />} />,
Expand Down
85 changes: 83 additions & 2 deletions src/hooks/useAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,87 @@ const useAPI = () => {

setIsLoading(true);
setError("");

// Development mock handlers: allow working without a backend
if (process.env.NODE_ENV === "development") {
const url = (requestConfig.url || "").toString();
const method = (requestConfig.method || "get").toString().toLowerCase();

// Simple in-memory mock data
const mockAssignments = [
{
id: 1,
name: "Mock Assignment",
directory_path: "mock/path",
spec_location: "",
private: false,
show_template_review: false,
require_quiz: false,
has_badge: false,
staggered_deadline: false,
is_calibrated: false,
course_id: 1,
},
];
const mockCourses = [{ id: 1, name: "Mock Course" }];

const makeResponse = (data: any, status = 200) => {
const resp: AxiosResponse = {
data: data,
status: status,
statusText: status === 200 ? "OK" : "Created",
headers: {},
config: requestConfig,
} as AxiosResponse;
return resp;
};

// Simulate network latency
setTimeout(() => {
try {
if (url === "/assignments" && method === "get") {
setData(makeResponse(mockAssignments));
setIsLoading(false);
return;
}

const assignmentIdMatch = url.match(/^\/assignments\/(\d+)/);
if (assignmentIdMatch && method === "get") {
const id = parseInt(assignmentIdMatch[1], 10);
const found = mockAssignments.find((a) => a.id === id) || mockAssignments[0];
setData(makeResponse(found));
setIsLoading(false);
return;
}

if (url === "/assignments" && (method === "post" || method === "put")) {
// create or update - echo back created assignment with id
let payload: any = requestConfig.data || {};
try {
if (typeof payload === "string") payload = JSON.parse(payload);
} catch (e) {
// ignore
}
const created = { id: Math.floor(Math.random() * 10000) + 2, ...payload };
setData(makeResponse(created, 201));
setIsLoading(false);
return;
}

if (url === "/courses" && method === "get") {
setData(makeResponse(mockCourses));
setIsLoading(false);
return;
}

// Default: fall through to real network call if not matched
} catch (err) {
setError((err as Error).message || "Mock error");
setIsLoading(false);
}
}, 200);
}

let errorMessage = "";

axios(requestConfig)
Expand All @@ -51,8 +132,8 @@ const useAPI = () => {
}

if (errorMessage) setError(errorMessage);
});
setIsLoading(false);
})
.finally(() => setIsLoading(false));
}, []);

return { data, setData, isLoading, error, sendRequest };
Expand Down
2 changes: 1 addition & 1 deletion src/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const Header: React.FC = () => {
</NavDropdown.Item>
</NavDropdown>
)}
<Nav.Link as={Link} to="/student_tasks">
<Nav.Link as={Link} to="/assignments">
Assignments
</Nav.Link>
<Nav.Link as={Link} to="/profile">
Expand Down
Loading