Add authentication #17

Manually merged
Webmaster merged 225 commits from auth into main 2025-03-08 10:37:06 +00:00
Showing only changes of commit cca038397c - Show all commits

View file

@ -182,7 +182,6 @@ const majorsList: string[] = allMajors
<button <button
id="previewResume" id="previewResume"
class="btn btn-sm btn-ghost" class="btn btn-sm btn-ghost"
onclick="showResumePreview(resumeUrl, fileName)"
> >
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -266,21 +265,15 @@ const majorsList: string[] = allMajors
const resumeDisplay = document.getElementById("resumeDisplay"); const resumeDisplay = document.getElementById("resumeDisplay");
const previewResume = document.getElementById("previewResume"); const previewResume = document.getElementById("previewResume");
// Function to show resume in FileViewerModal // Helper function to get file type
const showResumePreview = (url: string, fileName: string) => { const getFileType = (fileName: string): string => {
// Create and dispatch custom event for FileViewerModal const extension = fileName.split(".").pop()?.toLowerCase() || "";
const showFileViewerEvent = new CustomEvent("showFileViewer", { const mimeTypes: Record<string, string> = {
detail: { pdf: "application/pdf",
files: { doc: "application/msword",
url, docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
name: fileName, };
type: fileName.toLowerCase().endsWith(".pdf") return mimeTypes[extension] || "application/octet-stream";
? "application/pdf"
: "application/octet-stream",
},
},
});
window.dispatchEvent(showFileViewerEvent);
}; };
// Load current user data // Load current user data
@ -311,7 +304,20 @@ const majorsList: string[] = allMajors
// Update preview button to use new modal // Update preview button to use new modal
if (previewResume) { if (previewResume) {
previewResume.onclick = () => { previewResume.onclick = () => {
showResumePreview(resumeUrl, fileName); // Dispatch custom event for FileViewerModal
const showFileViewerEvent = new CustomEvent(
"showFileViewer",
{
detail: {
files: {
url: resumeUrl,
name: fileName,
type: getFileType(fileName),
},
},
}
);
window.dispatchEvent(showFileViewerEvent);
}; };
} }
} else { } else {