From 5fe3701be1589ce1b6380d46e93feb99f0bc3479 Mon Sep 17 00:00:00 2001 From: keeryn04 Date: Wed, 1 Apr 2026 10:36:41 -0600 Subject: [PATCH 1/3] (Update) Added Organization Adding in Guest Flow --- shatter-mobile/app/UserPages/Guest.tsx | 186 ++++++++++++------ shatter-mobile/app/UserPages/GuestNoLink.tsx | 92 +++++++++ .../src/components/context/AsyncStorage.tsx | 2 +- .../src/components/context/AuthContext.tsx | 21 +- .../components/login-signup/SignupForm.tsx | 17 +- .../components/login-signup/SocialSpinner.tsx | 47 +++++ shatter-mobile/src/images/github.png | Bin 0 -> 70493 bytes shatter-mobile/src/images/linkedin.png | Bin 0 -> 9388 bytes shatter-mobile/src/images/linktree.png | Bin 0 -> 36900 bytes shatter-mobile/src/interfaces/User.tsx | 3 +- shatter-mobile/src/styling/Guest.styles.ts | 34 +++- .../src/styling/SignUpFormStyling.styles.ts | 21 +- 12 files changed, 350 insertions(+), 73 deletions(-) create mode 100644 shatter-mobile/app/UserPages/GuestNoLink.tsx create mode 100644 shatter-mobile/src/components/login-signup/SocialSpinner.tsx create mode 100644 shatter-mobile/src/images/github.png create mode 100644 shatter-mobile/src/images/linkedin.png create mode 100644 shatter-mobile/src/images/linktree.png diff --git a/shatter-mobile/app/UserPages/Guest.tsx b/shatter-mobile/app/UserPages/Guest.tsx index 7481315..1a09600 100644 --- a/shatter-mobile/app/UserPages/Guest.tsx +++ b/shatter-mobile/app/UserPages/Guest.tsx @@ -1,10 +1,12 @@ +import SocialSpinner from "@/src/components/login-signup/SocialSpinner"; import { SocialLink } from "@/src/interfaces/User"; import { colors } from "@/src/styling/constants"; import { GuestStyling as styles } from "@/src/styling/Guest.styles"; -import { useRouter } from "expo-router"; +import { Stack, useRouter } from "expo-router"; import { useState } from "react"; import { ImageBackground, + Modal, Text, TextInput, TouchableOpacity, @@ -17,12 +19,13 @@ export default function GuestPage() { const { continueAsGuest } = useAuth(); const [name, setName] = useState(""); const [contactLink, setContactLink] = useState(""); + const [showConfirmModal, setShowConfirmModal] = useState(false); const [error, setError] = useState(""); const router = useRouter(); const handleContinue = async () => { //need name and social link - if (!name.trim() || !contactLink) { + if (!name.trim() || !contactLink.trim()) { setError("Name and Social Link Cannot Be Empty"); return; } @@ -39,64 +42,133 @@ export default function GuestPage() { } setError(""); - await continueAsGuest(name.trim(), socialLink); + await continueAsGuest(name.trim(), socialLink, ""); //no organization on this page, handled on GuestConfirm router.replace("/JoinEventPage"); }; return ( - - - - Guest Access - Enter your details to continue - - - - Your Name - - - Contact Link - - - Your contact link can be your LinkedIn profile URL, a portfolio - link, or another relevant personal link. - - - {error ? {error} : null} - - - Continue - - - router.push("/UserPages/Signup")} - > - Back - - - - + <> + + + + + Guest Access + Enter your details to continue + + + + Your Name + + + Contact Link + + + Your contact link can be your LinkedIn profile URL, a portfolio + link, or another relevant personal link. + + + {error ? {error} : null} + + + Continue + + + router.push("/UserPages/Signup")} + > + Back + + + { + setShowConfirmModal(true); + }} + > + No Contact Link? + + + + + + + + Continue Without a Contact Link? + + + + + + Users tend to connect better when you include a contact link + like LinkedIn or a portfolio. + + + + Adding a contact link helps others learn more about you and + improves networking during events. + + + {/* Add link */} + setShowConfirmModal(false)} + > + Add Contact Link + + + {/* Continue anyway */} + { + setShowConfirmModal(false); + router.push("/UserPages/GuestNoLink"); + }} + > + + Continue Without Link + + + + + + + + ); } diff --git a/shatter-mobile/app/UserPages/GuestNoLink.tsx b/shatter-mobile/app/UserPages/GuestNoLink.tsx new file mode 100644 index 0000000..5a50ab4 --- /dev/null +++ b/shatter-mobile/app/UserPages/GuestNoLink.tsx @@ -0,0 +1,92 @@ +import { colors } from "@/src/styling/constants"; +import { GuestStyling as styles } from "@/src/styling/Guest.styles"; +import { Stack, useRouter } from "expo-router"; +import { useState } from "react"; +import { + ImageBackground, + Text, + TextInput, + TouchableOpacity, + View, +} from "react-native"; +import { SafeAreaView } from "react-native-safe-area-context"; +import { useAuth } from "../../src/components/context/AuthContext"; + +export default function GuestConfirm() { + const { continueAsGuest } = useAuth(); + const [name, setName] = useState(""); + const [organization, setOrganization] = useState(""); + const [error, setError] = useState(""); + const router = useRouter(); + + const handleContinue = async () => { + if (!name.trim() || !organization.trim()) { + setError("Name and Organization cannot be empty"); + return; + } + + setError(""); + + await continueAsGuest( + name.trim(), + { label: "", url: "" }, + organization.trim(), + ); + + router.replace("/JoinEventPage"); + }; + + return ( + <> + + + + + Guest Access + Continue without a contact link + + + + Your Name + + + Organization + + + {error ? {error} : null} + + + Continue + + + router.back()} + > + Back + + + + + + ); +} diff --git a/shatter-mobile/src/components/context/AsyncStorage.tsx b/shatter-mobile/src/components/context/AsyncStorage.tsx index aa0ce1d..ba17218 100644 --- a/shatter-mobile/src/components/context/AsyncStorage.tsx +++ b/shatter-mobile/src/components/context/AsyncStorage.tsx @@ -7,7 +7,7 @@ export type AuthDataStorage = { userId: string | null; accessToken: string; isGuest: boolean; - guestInfo: { name: string; socialLinks: SocialLink[] }; + guestInfo: { name: string; socialLinks?: SocialLink[], organization?: string }; }; export const getStoredAuth = async (): Promise => { diff --git a/shatter-mobile/src/components/context/AuthContext.tsx b/shatter-mobile/src/components/context/AuthContext.tsx index 031d484..723e29e 100644 --- a/shatter-mobile/src/components/context/AuthContext.tsx +++ b/shatter-mobile/src/components/context/AuthContext.tsx @@ -12,7 +12,11 @@ type AuthContextType = { accessToken: string, isGuest: boolean, ) => Promise; - continueAsGuest: (name: string, socialLink: SocialLink) => Promise; + continueAsGuest: ( + name: string, + socialLink: SocialLink, + organization: string, + ) => Promise; logout: () => Promise; updateUser: (updates: Partial) => User | undefined; }; @@ -79,18 +83,23 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { userId: user?._id, accessToken, isGuest: isGuest, - guestInfo: { name: user.name, socialLinks: user.socialLinks }, + guestInfo: { name: user.name, socialLinks: user.socialLinks || [] }, }; setAuthStorage(storageData); await saveStoredAuth(storageData); }; //when user initially creates a guest account - const continueAsGuest = async (name: string, socialLink: SocialLink) => { + const continueAsGuest = async ( + name: string, + socialLink: SocialLink, + organization: string, + ) => { const guestUser: User = { _id: null, name: name, socialLinks: [{ label: socialLink.label, url: socialLink.url }], + organization: organization, isGuest: true, }; @@ -100,7 +109,11 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => { userId: guestUser._id, accessToken: "", isGuest: true, - guestInfo: { name: guestUser.name, socialLinks: guestUser.socialLinks }, + guestInfo: { + name: guestUser.name, + socialLinks: guestUser.socialLinks || [], + organization: organization || "", + }, }; setAuthStorage(storageData); diff --git a/shatter-mobile/src/components/login-signup/SignupForm.tsx b/shatter-mobile/src/components/login-signup/SignupForm.tsx index e688c1e..dcddfea 100644 --- a/shatter-mobile/src/components/login-signup/SignupForm.tsx +++ b/shatter-mobile/src/components/login-signup/SignupForm.tsx @@ -6,7 +6,6 @@ import * as WebBrowser from "expo-web-browser"; import { useState } from "react"; import { ActivityIndicator, - Button, ImageBackground, KeyboardAvoidingView, Platform, @@ -190,11 +189,19 @@ export default function SignUpForm() { Already have an Account?{" "} Log In -