2025-05-02 12:34:17 -07:00
|
|
|
|
import React, { useState, useEffect } from "react";
|
2025-04-22 09:33:55 -07:00
|
|
|
|
import "../scss/components/_assignment.scss";
|
|
|
|
|
|
|
|
|
|
|
|
const AssignmentPage = () => {
|
2025-05-07 13:26:17 -07:00
|
|
|
|
const [assignmentId, setAssignmentId] = useState("");
|
2025-04-22 12:05:41 -07:00
|
|
|
|
const [studentName, setStudentName] = useState("");
|
|
|
|
|
|
const [campID, setCampID] = useState("");
|
|
|
|
|
|
const [programID, setProgramID] = useState("");
|
2025-05-07 13:26:17 -07:00
|
|
|
|
const [appName, setAppName] = useState("");
|
|
|
|
|
|
const [qrCodeNumber, setQrCodeNumber] = useState("");
|
2025-04-22 12:05:41 -07:00
|
|
|
|
const [password, setPassword] = useState("");
|
2025-04-22 09:33:55 -07:00
|
|
|
|
const [description, setDescription] = useState("");
|
|
|
|
|
|
const [file, setFile] = useState(null);
|
2025-05-07 13:26:17 -07:00
|
|
|
|
|
2025-04-22 09:33:55 -07:00
|
|
|
|
const [projects, setProjects] = useState([]);
|
|
|
|
|
|
const [showModal, setShowModal] = useState(false);
|
|
|
|
|
|
const [editingIndex, setEditingIndex] = useState(null);
|
2025-05-07 13:26:17 -07:00
|
|
|
|
|
|
|
|
|
|
const [user, setUser] = useState([]);
|
|
|
|
|
|
|
|
|
|
|
|
const VITE_ASSIGNMENT_URL = import.meta.env.VITE_ASSIGNMENT_URL;
|
|
|
|
|
|
const authUrl = import.meta.env.VITE_AUTH_URL;
|
2025-05-07 13:06:05 -07:00
|
|
|
|
const [searchTerm, setSearchTerm] = useState("");
|
|
|
|
|
|
const [showPassword, setShowPassword] = useState(false);
|
|
|
|
|
|
const [loading, setLoading] = useState(false);
|
2025-04-22 09:33:55 -07:00
|
|
|
|
|
2025-04-30 12:22:48 -07:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
document.title = "Assignment";
|
2025-05-07 13:26:17 -07:00
|
|
|
|
getCurrentUser();
|
2025-05-02 12:34:17 -07:00
|
|
|
|
fetchAssignments();
|
2025-04-30 12:22:48 -07:00
|
|
|
|
}, []);
|
2025-05-02 12:34:17 -07:00
|
|
|
|
|
2025-05-07 13:26:17 -07:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (!appName) return; // Don't alert for empty name
|
|
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
|
|
fetch(`${VITE_ASSIGNMENT_URL}/instructor/checkAssignmentByAppName/${appName}`)
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
throw new Error("Failed to fetch assignment by app name");
|
|
|
|
|
|
}
|
|
|
|
|
|
return response.json();
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((data) => {
|
|
|
|
|
|
if (data.exists) {
|
|
|
|
|
|
alert("This app name already exists. Please choose a different one.");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
console.error("Error fetching assignment by app name:", error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}, 1000); // 1 second delay
|
|
|
|
|
|
|
|
|
|
|
|
return () => clearTimeout(timer); // Clear timeout on name change
|
|
|
|
|
|
}, [appName]);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (!qrCodeNumber) return; // Don't alert for empty QR code number
|
|
|
|
|
|
console.log("Checking QR code number:", qrCodeNumber); // Added console log
|
|
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
|
|
fetch(`${VITE_ASSIGNMENT_URL}/instructor/checkAssignmentByQRCode/${qrCodeNumber}`)
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
throw new Error("Failed to fetch assignment by QR code number");
|
|
|
|
|
|
}
|
|
|
|
|
|
return response.json();
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((data) => {
|
|
|
|
|
|
console.log("QR code fetch result:", data); // Added console log
|
|
|
|
|
|
if (data.exists) {
|
|
|
|
|
|
alert("This QR code number already exists. Please choose a different one.");
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
console.error("Error fetching assignment by QR code number:", error);
|
|
|
|
|
|
});
|
|
|
|
|
|
}, 1000); // 1 second delay
|
|
|
|
|
|
|
|
|
|
|
|
return () => clearTimeout(timer); // Clear timeout on QR code number change
|
|
|
|
|
|
}, [qrCodeNumber]);
|
|
|
|
|
|
|
|
|
|
|
|
const getCurrentUser = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const authResponse = await fetch(`${authUrl}/auth/current_user`, {
|
|
|
|
|
|
credentials: "include",
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const user = await authResponse.json();
|
|
|
|
|
|
setUser(user);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error("Error fetching current user:", error);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-02 12:34:17 -07:00
|
|
|
|
const fetchAssignments = async () => {
|
|
|
|
|
|
try {
|
2025-05-07 13:26:17 -07:00
|
|
|
|
// if (user) {
|
|
|
|
|
|
// console.log("Current user:", user, `${VITE_ASSIGNMENT_URL}/instructor/list/${user.userId}`);
|
|
|
|
|
|
// const res = await fetch(`${VITE_ASSIGNMENT_URL}/instructor/list/${user.userId}`, {
|
|
|
|
|
|
// // credentials: "include",
|
|
|
|
|
|
// });
|
|
|
|
|
|
//replace this with commented code above to get the instructor id from the auth service
|
|
|
|
|
|
const res = await fetch(`${VITE_ASSIGNMENT_URL}/instructor/list/9`, {
|
|
|
|
|
|
// credentials: "include",
|
|
|
|
|
|
});
|
2025-05-02 12:34:17 -07:00
|
|
|
|
|
2025-05-07 13:26:17 -07:00
|
|
|
|
if (!res.ok) throw new Error("Failed to fetch");
|
2025-05-02 12:34:17 -07:00
|
|
|
|
const data = await res.json();
|
2025-05-07 13:26:17 -07:00
|
|
|
|
|
|
|
|
|
|
// Optional: Remove duplicate assignment IDs if needed
|
2025-05-02 12:34:17 -07:00
|
|
|
|
const unique = Array.from(
|
|
|
|
|
|
new Map(data.map((item) => [item.assignmentid, item])).values()
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
setProjects(unique);
|
2025-05-07 13:26:17 -07:00
|
|
|
|
// }
|
2025-05-02 12:34:17 -07:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error("Error fetching assignments:", error);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-04-30 12:22:48 -07:00
|
|
|
|
|
2025-04-22 12:05:41 -07:00
|
|
|
|
const resetForm = () => {
|
|
|
|
|
|
setStudentName("");
|
|
|
|
|
|
setCampID("");
|
|
|
|
|
|
setProgramID("");
|
|
|
|
|
|
setPassword("");
|
|
|
|
|
|
setDescription("");
|
|
|
|
|
|
setFile(null);
|
|
|
|
|
|
setEditingIndex(null);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-07 13:26:17 -07:00
|
|
|
|
const handleSubmit = async (e) => {
|
2025-04-22 09:33:55 -07:00
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
2025-05-07 13:26:17 -07:00
|
|
|
|
if (!user.userId) return alert("Please login to submit an assignment.");
|
|
|
|
|
|
|
|
|
|
|
|
//Create the form data needed for both create and edit
|
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
|
formData.append("studentname", studentName);
|
|
|
|
|
|
formData.append("campid", campID);
|
|
|
|
|
|
formData.append("programid", programID);
|
|
|
|
|
|
formData.append("qrcodenumber", qrCodeNumber);
|
|
|
|
|
|
formData.append("password", password);
|
|
|
|
|
|
formData.append("description", description);
|
2025-04-22 12:05:41 -07:00
|
|
|
|
|
2025-05-07 13:06:05 -07:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
if (editingIndex !== null) {
|
|
|
|
|
|
const updatedProjects = [...projects];
|
|
|
|
|
|
updatedProjects[editingIndex] = newProject;
|
|
|
|
|
|
setProjects(updatedProjects);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
setProjects([...projects, newProject]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
alert(editingIndex !== null ? "Assignment updated!" : "Assignment submitted!");
|
|
|
|
|
|
resetForm();
|
|
|
|
|
|
setShowModal(false);
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
}, 2000);
|
2025-05-07 13:26:17 -07:00
|
|
|
|
if (editingIndex !== null) {
|
|
|
|
|
|
//edit mode
|
|
|
|
|
|
await fetch(`${VITE_ASSIGNMENT_URL}/instructor/update/${assignmentId}`, {
|
|
|
|
|
|
method: "PUT",
|
|
|
|
|
|
body: formData,
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
console.error("Failed to edit assignment:", response.statusText);
|
|
|
|
|
|
throw new Error("Failed to edit assignment");
|
|
|
|
|
|
}
|
|
|
|
|
|
return response.json();
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((data) => {
|
|
|
|
|
|
console.log("Assignment edited successfully:", data);
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
console.error("Error submitting assignment:", error);
|
|
|
|
|
|
alert(`Failed to submit assignment. ${error.message}`);
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//create mode
|
|
|
|
|
|
formData.append("instructorid", 9);
|
|
|
|
|
|
formData.append("appname", appName);
|
|
|
|
|
|
|
|
|
|
|
|
if (file) {
|
|
|
|
|
|
formData.append("file", file, file.name);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
throw new Error("Failed to submit assignment: file not found.");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await fetch(`${VITE_ASSIGNMENT_URL}/instructor/create`, {
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
body: formData,
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
console.error("Failed to submit assignment:", response.statusText);
|
|
|
|
|
|
throw new Error("Failed to submit assignment");
|
|
|
|
|
|
}
|
|
|
|
|
|
return response.json();
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((data) => {
|
|
|
|
|
|
console.log("Assignment submitted successfully:", data);
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
console.error("Error submitting assignment:", error);
|
|
|
|
|
|
alert(`Failed to submit assignment. ${error.message}`);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
alert(
|
|
|
|
|
|
editingIndex !== null ? "Assignment updated!" : "Assignment submitted!"
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
fetchAssignments(); // Refresh the assignments list
|
|
|
|
|
|
resetForm();
|
|
|
|
|
|
setShowModal(false);
|
2025-04-22 12:05:41 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleEdit = (index) => {
|
|
|
|
|
|
const project = projects[index];
|
2025-05-07 13:26:17 -07:00
|
|
|
|
setAssignmentId(project.assignmentid || project.assignmentId || "");
|
|
|
|
|
|
setAppName(project.appname || project.appName || "");
|
|
|
|
|
|
setQrCodeNumber(project.qrcodenumber || project.qrCodeNumber || "");
|
|
|
|
|
|
setPassword(project.passwordhash || project.password || "");
|
2025-05-02 12:34:17 -07:00
|
|
|
|
setStudentName(project.studentname || project.studentName || "");
|
|
|
|
|
|
setCampID(project.campid || project.campID || "");
|
|
|
|
|
|
setProgramID(project.programid || project.programID || "");
|
|
|
|
|
|
setDescription(project.description || "");
|
2025-04-30 12:22:48 -07:00
|
|
|
|
setFile(null);
|
2025-04-22 12:05:41 -07:00
|
|
|
|
setEditingIndex(index);
|
|
|
|
|
|
setShowModal(true);
|
2025-04-22 09:33:55 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleDelete = (index) => {
|
2025-05-07 13:26:17 -07:00
|
|
|
|
const project = projects[index];
|
|
|
|
|
|
if (window.confirm("Are you sure you want to delete this assignment?")) {
|
|
|
|
|
|
fetch(`${VITE_ASSIGNMENT_URL}/instructor/delete/${project.assignmentid}`, {
|
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((response) => {
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
|
|
console.error("Failed to delete assignment:", response.statusText);
|
|
|
|
|
|
throw new Error("Failed to delete assignment");
|
|
|
|
|
|
}
|
|
|
|
|
|
return response.json();
|
|
|
|
|
|
})
|
|
|
|
|
|
.then((data) => {
|
|
|
|
|
|
console.log("Assignment deleted successfully:", data);
|
|
|
|
|
|
alert("Assignment deleted successfully!");
|
|
|
|
|
|
fetchAssignments(); // Refresh the assignments list
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
|
console.error("Error deleting assignment:", error);
|
|
|
|
|
|
alert(`Failed to delete assignment. ${error.message}`);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-04-22 09:33:55 -07:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div className="assignment-page">
|
2025-04-30 12:22:48 -07:00
|
|
|
|
<div className="assignment-header-box">
|
2025-05-02 11:27:34 -07:00
|
|
|
|
<h2>Assignments</h2>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<button
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
resetForm();
|
|
|
|
|
|
setShowModal(true);
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
➕ Add New
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="assignment-search-box">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder="🔍︎ Search"
|
|
|
|
|
|
value={searchTerm}
|
|
|
|
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
|
|
|
|
/>
|
2025-04-30 12:22:48 -07:00
|
|
|
|
</div>
|
2025-04-22 09:33:55 -07:00
|
|
|
|
|
2025-05-07 13:06:05 -07:00
|
|
|
|
<div className="assignment-search-box">
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder="🔍︎ Search"
|
|
|
|
|
|
value={searchTerm}
|
|
|
|
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-04-22 09:33:55 -07:00
|
|
|
|
{showModal && (
|
|
|
|
|
|
<div className="modal-overlay">
|
|
|
|
|
|
<div className="modal">
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<h3>
|
|
|
|
|
|
{editingIndex !== null ? "Edit Assignment" : "New Assignment"}
|
|
|
|
|
|
</h3>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
<form onSubmit={handleSubmit}>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label>Student Name</label>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
value={studentName}
|
|
|
|
|
|
onChange={(e) => setStudentName(e.target.value)}
|
|
|
|
|
|
required
|
|
|
|
|
|
/>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label>Camp ID</label>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<input
|
|
|
|
|
|
type="number"
|
|
|
|
|
|
value={campID}
|
|
|
|
|
|
onChange={(e) => setCampID(e.target.value)}
|
|
|
|
|
|
required
|
|
|
|
|
|
/>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label>Program ID</label>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<input
|
|
|
|
|
|
type="number"
|
|
|
|
|
|
value={programID}
|
|
|
|
|
|
onChange={(e) => setProgramID(e.target.value)}
|
|
|
|
|
|
required
|
|
|
|
|
|
/>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<div>
|
|
|
|
|
|
<label>App Name</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
value={appName}
|
|
|
|
|
|
onChange={(e) => setAppName(e.target.value)}
|
|
|
|
|
|
required
|
|
|
|
|
|
disabled={editingIndex !== null}
|
|
|
|
|
|
s
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
<label>Password</label>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} required />
|
2025-04-22 12:05:41 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-04-22 09:33:55 -07:00
|
|
|
|
<div>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<label>Password</label>
|
|
|
|
|
|
<input
|
|
|
|
|
|
type="password"
|
|
|
|
|
|
value={password}
|
|
|
|
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
|
|
|
|
required
|
|
|
|
|
|
/>
|
2025-04-22 09:33:55 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<label>Description</label>
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<textarea
|
|
|
|
|
|
value={description}
|
|
|
|
|
|
onChange={(e) => setDescription(e.target.value)}
|
|
|
|
|
|
required
|
|
|
|
|
|
></textarea>
|
2025-04-22 09:33:55 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
<label>File Upload (optional)</label>
|
2025-04-30 12:22:48 -07:00
|
|
|
|
<input type="file" onChange={(e) => setFile(e.target.files[0])} />
|
2025-04-22 09:33:55 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div className="modal-buttons">
|
2025-05-07 13:26:17 -07:00
|
|
|
|
<button type="submit">{editingIndex !== null ? "Update" : "Submit"}</button>
|
|
|
|
|
|
<button type="button" onClick={() => { resetForm(); setShowModal(false); }}>Cancel</button>
|
2025-04-22 09:33:55 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
2025-04-30 12:22:48 -07:00
|
|
|
|
{projects.length > 0 && (
|
|
|
|
|
|
<div className="project-list">
|
2025-05-07 13:26:17 -07:00
|
|
|
|
{projects.map((project, index) => (
|
|
|
|
|
|
<div key={index} className="project-item">
|
|
|
|
|
|
<div className="project-meta">
|
|
|
|
|
|
<strong>Student Name:</strong> {project.studentname || project.studentName} |{" "}
|
|
|
|
|
|
<strong>CampID:</strong> {project.campid || project.campID} |{" "}
|
|
|
|
|
|
<strong>ProgramID:</strong> {project.programid || project.programID}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{project.title && <h4>{project.title}</h4>}
|
|
|
|
|
|
{project.description && <p>{project.description}</p>}
|
|
|
|
|
|
{project.fileName && <p><strong>Uploaded File:</strong> {project.fileName}</p>}
|
2025-05-07 13:06:05 -07:00
|
|
|
|
|
2025-05-07 13:26:17 -07:00
|
|
|
|
{project.assignmenturl && (
|
|
|
|
|
|
<p>
|
|
|
|
|
|
<a
|
|
|
|
|
|
href={project.assignmenturl}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
|
>
|
|
|
|
|
|
View Assignment
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{project.originalfile && (
|
|
|
|
|
|
<p>
|
|
|
|
|
|
<a
|
|
|
|
|
|
href={project.originalfile}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
|
>
|
|
|
|
|
|
Original File
|
|
|
|
|
|
</a>{" "}
|
|
|
|
|
|
|{" "}
|
|
|
|
|
|
<a
|
|
|
|
|
|
href={project.editablefile}
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
|
|
>
|
|
|
|
|
|
Editable File
|
|
|
|
|
|
</a>
|
|
|
|
|
|
</p>
|
|
|
|
|
|
)}
|
2025-05-07 13:06:05 -07:00
|
|
|
|
|
|
|
|
|
|
<div className="action-buttons">
|
|
|
|
|
|
<button onClick={() => handleEdit(index)}>✏️ View Edit</button>
|
|
|
|
|
|
<button onClick={() => handleDelete(index)}>🗑️ Delete</button>
|
|
|
|
|
|
<button onClick={() => alert("QR feature coming soon!")}>🧮 Editor</button>
|
|
|
|
|
|
</div>
|
2025-04-30 12:22:48 -07:00
|
|
|
|
</div>
|
2025-05-07 13:06:05 -07:00
|
|
|
|
))}
|
2025-04-30 12:22:48 -07:00
|
|
|
|
</div>
|
2025-04-22 12:05:41 -07:00
|
|
|
|
)}
|
2025-04-22 09:33:55 -07:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default AssignmentPage;
|