From 4cc0ea62f03bf1a706f87281e66e9c0f3ac6be3e Mon Sep 17 00:00:00 2001 From: keeryn04 Date: Tue, 24 Feb 2026 21:33:03 -0700 Subject: [PATCH 01/15] (Update) Added Profile Updating Page, Needs Backend Update --- shatter-mobile/app/(tabs)/JoinEvent.tsx | 9 +- shatter-mobile/app/(tabs)/Profile.tsx | 134 ++++++++++++------ shatter-mobile/app/GetStarted.tsx | 2 +- shatter-mobile/app/UserPages/Guest.tsx | 29 +++- .../app/UserPages/UpdateProfile.tsx | 124 ++++++++++++++++ shatter-mobile/src/api/users/user.api.tsx | 24 +++- .../src/components/context/AuthContext.tsx | 27 ++-- .../src/components/games/NameBingo.tsx | 5 +- .../src/components/login-signup/LoginForm.tsx | 3 +- .../components/login-signup/SignupForm.tsx | 15 +- shatter-mobile/src/interfaces/User.tsx | 7 +- .../responses/UpdateUserInfoResponse.tsx | 6 + shatter-mobile/src/services/user.service.tsx | 13 ++ 13 files changed, 326 insertions(+), 72 deletions(-) create mode 100644 shatter-mobile/app/UserPages/UpdateProfile.tsx create mode 100644 shatter-mobile/src/interfaces/responses/UpdateUserInfoResponse.tsx diff --git a/shatter-mobile/app/(tabs)/JoinEvent.tsx b/shatter-mobile/app/(tabs)/JoinEvent.tsx index 7f59d5d..655ca81 100644 --- a/shatter-mobile/app/(tabs)/JoinEvent.tsx +++ b/shatter-mobile/app/(tabs)/JoinEvent.tsx @@ -47,7 +47,7 @@ export default function JoinEventPage() { switch (joinRes.status) { case "event-not-found": - setErrorMessage("We couldn’t find an event with that code."); + setErrorMessage("We couldn’t find that event. Double-check the code."); break; case "no-user": setErrorMessage("Your profile is missing a name."); @@ -59,8 +59,11 @@ export default function JoinEventPage() { setErrorMessage("Something went wrong joining the event."); break; case "success": - setErrorMessage(null); - router.push({ pathname: "/Events" }); + setErrorMessage(""); + router.push({ + pathname: "/EventPages/EventLobby", + params: { eventId: joinRes.eventId }, + }); break; } }} diff --git a/shatter-mobile/app/(tabs)/Profile.tsx b/shatter-mobile/app/(tabs)/Profile.tsx index c33a8c7..5509fcc 100644 --- a/shatter-mobile/app/(tabs)/Profile.tsx +++ b/shatter-mobile/app/(tabs)/Profile.tsx @@ -1,32 +1,20 @@ import { useFocusEffect, useRouter } from "expo-router"; import { useState, useCallback, useEffect } from "react"; -import { StyleSheet, Text, TextInput, TouchableOpacity, View } from "react-native"; +import { StyleSheet, Text, TouchableOpacity, View } from "react-native"; import { useAuth } from "../../src/components/context/AuthContext"; export default function Profile() { - const { user, updateUser, logout } = useAuth(); + const { user, logout } = useAuth(); const router = useRouter(); - - //other profile info - const [linkedin, setLinkedin] = useState(user?.linkedin || ""); - const [github, setGithub] = useState(user?.github || ""); + const [socialLinks, setSocialLinks] = useState(user?.socialLinks || []); //update local form useFocusEffect( useCallback(() => { - setLinkedin(user?.linkedin || ""); - setGithub(user?.github || ""); + setSocialLinks(user?.socialLinks || []); }, [user]) ); - const handleSave = () => { - //TODO: Backend Logic --> Update user profile in backend - console.log("Saved profile info:", { linkedin, github }); - - //update auth state with new info - updateUser({ linkedin, github }); - }; - //not logged in useEffect(() => { if (!user) { @@ -45,25 +33,24 @@ export default function Profile() { Welcome, {user.name}! {user.email} - LinkedIn: - - GitHub: - + {socialLinks.length === 0 && ( + No social links added yet. + )} + + {socialLinks.map((link, index) => ( + + <> + {link.label} + {link.url} + + + ))} - - Save + router.push("/UserPages/UpdateProfile")} + > + Update Profile @@ -101,42 +88,103 @@ const styles = StyleSheet.create({ flex: 1, justifyContent: "center", padding: 24, - backgroundColor: "#A1C9F6" }, + backgroundColor: "#A1C9F6" + }, title: { fontSize: 28, fontWeight: "600", textAlign: "center", color: "#1B253A", - marginBottom: 16 }, + marginBottom: 16 + }, subtitle: { fontSize: 16, textAlign: "center", color: "#666", - marginBottom: 20 }, + marginBottom: 20 + }, label: { fontWeight: "600", - marginTop: 12 }, + marginTop: 12, + }, input: { borderWidth: 1, borderColor: "#1B253A", - color: "black", + color: "#000000", backgroundColor: "#fff", borderRadius: 8, padding: 10, - marginTop: 5 }, + marginTop: 5 + }, saveButton: { backgroundColor: "#4CAF50", padding: 14, borderRadius: 8, alignItems: "center", - marginTop: 15 }, + marginTop: 15 + }, button: { backgroundColor: "#1C1DEF", padding: 14, borderRadius: 8, - alignItems: "center" }, + alignItems: "center" + }, buttonText: { color: "#fff", fontWeight: "600", - fontSize: 16 }, + fontSize: 16 + }, + sectionTitle: { + fontSize: 18, + fontWeight: "600", + marginTop: 20, + marginBottom: 10, + }, + linkContainer: { + marginBottom: 15, + padding: 10, + backgroundColor: "#E6F0FF", + borderRadius: 8, + }, + addButton: { + backgroundColor: "#1eb4f0", + padding: 12, + borderRadius: 8, + alignItems: "center", + marginTop: 10, + }, + removeButton: { + backgroundColor: "#F44336", + padding: 10, + borderRadius: 6, + alignItems: "center", + marginTop: 5, + }, + emptyText: { + textAlign: "center", + color: "#444", + marginTop: 10, + }, + linkLabel: { + fontWeight: "600", + fontSize: 16, + }, + linkUrl: { + color: "#1C1DEF", + marginTop: 4, + }, + editButton: { + backgroundColor: "#FF9800", + padding: 14, + borderRadius: 8, + alignItems: "center", + marginTop: 15, + }, + cancelButton: { + backgroundColor: "#9E9E9E", + padding: 14, + borderRadius: 8, + alignItems: "center", + marginTop: 10, + }, }); \ No newline at end of file diff --git a/shatter-mobile/app/GetStarted.tsx b/shatter-mobile/app/GetStarted.tsx index 722ebd4..4c69725 100644 --- a/shatter-mobile/app/GetStarted.tsx +++ b/shatter-mobile/app/GetStarted.tsx @@ -25,7 +25,7 @@ export default function GetStarted() { SHATTER - Turn events into games + Break the Ice { - if (!name.trim()) return; - await continueAsGuest(name.trim(), linkedin); + //need name and social link + if (!name.trim() || !contactLink) { + setError("Name and Social Link Cannot Be Empty") + return; + } + + setError(""); + await continueAsGuest(name.trim(), "Contact Link", contactLink); router.replace("/JoinEvent"); }; @@ -31,13 +38,15 @@ export default function GuestPage() {