diff --git a/functions/src/index.ts b/functions/src/index.ts index 2fecfb18..2d43cd1d 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -273,6 +273,7 @@ export const updateSocials = functions.https.onCall(async (data, context) => { github: data.github, discord: data.discord, resumeRef: data.resumeRef, + resumeVisibility: data.resumeVisibility, }); functions.logger.info("Socials updated:", data); return response(HttpStatus.OK, { message: "ok" }); diff --git a/src/pages/Networking/Networking.page.tsx b/src/pages/Networking/Networking.page.tsx index a25a712b..c91c575a 100644 --- a/src/pages/Networking/Networking.page.tsx +++ b/src/pages/Networking/Networking.page.tsx @@ -15,8 +15,8 @@ import { uploadMentorResume, } from "@/services/utils"; import { useNotification } from "@/providers/notification.provider"; -import type { Socials } from "@/services/utils/types"; -import { Modal } from "@/components"; +import type { ResumeVisibility, Socials } from "@/services/utils/types"; +import { Modal, Select } from "@/components"; import { Cog6ToothIcon } from "@heroicons/react/24/outline"; const allowedFileTypes = [ @@ -38,6 +38,18 @@ const mediaTypes: { name: string; key: keyof Socials }[] = [ { name: "Discord", key: "discord" }, ]; +const visibilityOptions: ResumeVisibility[] = [ + "Public", + "Sponsors Only", + "Private", +]; + +const visibilityDescription = { + Public: "Your resume will be visible to anyone who scans your ticket QR code.", + Private: "Your resume will only be visible to you.", + "Sponsors Only": "Your resume will only be visible to our sponsors.", +}; + export const NetworkingPage = () => { const { currentUser, userApp } = useAuthProvider(); const [isLoading, setIsLoading] = useState(true); @@ -47,6 +59,9 @@ export const NetworkingPage = () => { const { showNotification } = useNotification(); const [socials, setSocials] = useState(null); const [isResumeSettingsOpened, setIsResumeSettingsOpened] = useState(false); + const [newVisibility, setNewVisibility] = useState( + socials?.resumeVisibility ?? "Public" + ); const [file, setFile] = useState(null); @@ -212,6 +227,37 @@ export const NetworkingPage = () => { setIsResumeSettingsOpened(false); }; + const saveResumeSettings = async () => { + try { + await updateSocials({ + ...mediaValues, + resumeVisibility: newVisibility, + }); + setSocials( + socials + ? { + ...socials, + resumeVisibility: newVisibility, + } + : null + ); + setMediaValues({ + ...mediaValues, + resumeVisibility: newVisibility, + }); + showNotification({ + title: "Resume Settings Saved", + message: "", + }); + setIsResumeSettingsOpened(false); + } catch (error) { + showNotification({ + title: "Error", + message: "Failed to save resume settings. Please try again.", + }); + } + }; + if (isLoading) return ; return ( @@ -399,7 +445,44 @@ export const NetworkingPage = () => { open={isResumeSettingsOpened} onClose={closeResumeSettings} > -
+
+
+