Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 129 additions & 57 deletions shatter-mobile/app/UserPages/Guest.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
}
Expand All @@ -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 (
<ImageBackground
source={require("../../src/images/getStartedImage.png")}
style={styles.background}
resizeMode="cover"
>
<SafeAreaView style={styles.safe}>
<View style={styles.header}>
<Text style={styles.pageTitle}>Guest Access</Text>
<Text style={styles.subtitle}>Enter your details to continue</Text>
</View>

<View style={styles.container}>
<Text style={styles.label}>Your Name</Text>
<TextInput
style={styles.input}
placeholder="Your Name"
placeholderTextColor={colors.lightGrey2}
value={name}
onChangeText={setName}
/>

<Text style={styles.label}>Contact Link</Text>
<TextInput
style={styles.input}
placeholder="LinkedIn, portfolio, etc."
placeholderTextColor={colors.lightGrey2}
value={contactLink}
onChangeText={setContactLink}
autoCapitalize="none"
keyboardType="url"
/>
<Text style={styles.inputInfo}>
Your contact link can be your LinkedIn profile URL, a portfolio
link, or another relevant personal link.
</Text>

{error ? <Text style={styles.error}>{error}</Text> : null}

<TouchableOpacity
style={styles.primaryButton}
onPress={handleContinue}
>
<Text style={styles.buttonText}>Continue</Text>
</TouchableOpacity>

<TouchableOpacity
style={styles.secondaryButton}
onPress={() => router.push("/UserPages/Signup")}
>
<Text style={styles.buttonText}>Back</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
</ImageBackground>
<>
<Stack.Screen options={{ animation: "slide_from_left" }} />
<ImageBackground
source={require("../../src/images/getStartedImage.png")}
style={styles.background}
resizeMode="cover"
>
<SafeAreaView style={styles.safe}>
<View style={styles.header}>
<Text style={styles.pageTitle}>Guest Access</Text>
<Text style={styles.subtitle}>Enter your details to continue</Text>
</View>

<View style={styles.container}>
<Text style={styles.label}>Your Name</Text>
<TextInput
style={styles.input}
placeholder="Your Name"
placeholderTextColor={colors.lightGrey2}
value={name}
onChangeText={setName}
/>

<Text style={styles.label}>Contact Link</Text>
<TextInput
style={styles.input}
placeholder="LinkedIn, portfolio, etc."
placeholderTextColor={colors.lightGrey2}
value={contactLink}
onChangeText={setContactLink}
autoCapitalize="none"
keyboardType="url"
/>
<Text style={styles.inputInfo}>
Your contact link can be your LinkedIn profile URL, a portfolio
link, or another relevant personal link.
</Text>

{error ? <Text style={styles.error}>{error}</Text> : null}

<TouchableOpacity
style={styles.primaryButton}
onPress={handleContinue}
>
<Text style={styles.buttonText}>Continue</Text>
</TouchableOpacity>

<TouchableOpacity
style={styles.secondaryButton}
onPress={() => router.push("/UserPages/Signup")}
>
<Text style={styles.buttonText}>Back</Text>
</TouchableOpacity>

<TouchableOpacity
style={styles.secondaryButtonNoBack}
onPress={() => {
setShowConfirmModal(true);
}}
>
<Text style={styles.buttonTextWarning}>No Contact Link?</Text>
</TouchableOpacity>
</View>

<Modal visible={showConfirmModal} transparent animationType="slide">
<View
style={{
flex: 1,
backgroundColor: "rgba(0,0,0,0.6)",
justifyContent: "center",
alignItems: "center",
}}
>
<View
style={{
width: "85%",
backgroundColor: colors.lightGrey,
borderRadius: 16,
padding: 20,
}}
>
<Text style={styles.confirmTitle}>
Continue Without a Contact Link?
</Text>

<SocialSpinner />

<Text style={styles.confirmSubtitle}>
Users tend to connect better when you include a contact link
like LinkedIn or a portfolio.
</Text>

<Text style={styles.inputInfo}>
Adding a contact link helps others learn more about you and
improves networking during events.
</Text>

{/* Add link */}
<TouchableOpacity
style={styles.primaryButton}
onPress={() => setShowConfirmModal(false)}
>
<Text style={styles.buttonText}>Add Contact Link</Text>
</TouchableOpacity>

{/* Continue anyway */}
<TouchableOpacity
style={styles.secondaryButtonNoBack}
onPress={() => {
setShowConfirmModal(false);
router.push("/UserPages/GuestNoLink");
}}
>
<Text style={styles.buttonTextWarning}>
Continue Without Link
</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
</SafeAreaView>
</ImageBackground>
</>
);
}
92 changes: 92 additions & 0 deletions shatter-mobile/app/UserPages/GuestNoLink.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<>
<Stack.Screen options={{ animation: "fade" }} />
<ImageBackground
source={require("../../src/images/getStartedImage.png")}
style={styles.background}
resizeMode="cover"
>
<SafeAreaView style={styles.safe}>
<View style={styles.header}>
<Text style={styles.pageTitle}>Guest Access</Text>
<Text style={styles.subtitle}>Continue without a contact link</Text>
</View>

<View style={styles.container}>
<Text style={styles.label}>Your Name</Text>
<TextInput
style={styles.input}
placeholder="Your Name"
placeholderTextColor={colors.lightGrey2}
value={name}
onChangeText={setName}
/>

<Text style={styles.label}>Organization</Text>
<TextInput
style={styles.input}
placeholder="Your Organization"
placeholderTextColor={colors.lightGrey2}
value={organization}
onChangeText={setOrganization}
/>

{error ? <Text style={styles.error}>{error}</Text> : null}

<TouchableOpacity
style={styles.primaryButton}
onPress={handleContinue}
>
<Text style={styles.buttonText}>Continue</Text>
</TouchableOpacity>

<TouchableOpacity
style={styles.secondaryButton}
onPress={() => router.back()}
>
<Text style={styles.buttonText}>Back</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
</ImageBackground>
</>
);
}
Loading
Loading