Skip to content
Open
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
14 changes: 9 additions & 5 deletions shatter-mobile/app/(tabs)/JoinEvent.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React, { useState } from "react";
import { View, Text, Button, StyleSheet } from "react-native";
import { useState } from "react";
import { Button, StyleSheet, Text, View } from "react-native";
import { useAuth } from "../../src/components/context/AuthContext";
import QRScannerBox from "../../src/components/new-events/QRScannerBox";
import { useAuth } from "../context/AuthContext";

export default function JoinEventPage() {
const { user, setUser } = useAuth();
const { user } = useAuth();
const [showScanner, setShowScanner] = useState(false);

return (
<View style={styles.container}>
<Text style={styles.title}>Welcome! Join an Event</Text>
{user ? (
<Text style={styles.title}>Welcome {user.name}! Join an Event</Text>
) : (
<Text style={styles.title}>Welcome! Join an Event</Text>
)}

{!showScanner && (
<Button
Expand Down
23 changes: 16 additions & 7 deletions shatter-mobile/app/(tabs)/Profile.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import { useState } from "react";
import { View, Text, TouchableOpacity, StyleSheet, TextInput } from "react-native";
import { useAuth } from "../context/AuthContext";
import { useEffect, useState } from "react";
import { StyleSheet, Text, TextInput, TouchableOpacity, View } from "react-native";
import { useAuth } from "../../src/components/context/AuthContext";
import LoginForm from "../../src/components/login-signup/LoginForm";
import SignUpForm from "../../src/components/login-signup/SignupForm";

export default function Profile() {
const { user, setUser } = useAuth();
const { user, updateUser, logout } = useAuth();
const [form, setForm] = useState<"login" | "signup">("login");

//other profile info
const [linkedin, setLinkedin] = useState(user?.linkedin || "");
const [github, setGithub] = useState(user?.github || "");

//update local form
useEffect(() => {
setLinkedin(user?.linkedin || "");
setGithub(user?.github || "");
}, [user]);

const handleSave = () => {
//TODO: Backend upload
//TODO: Backend Logic --> Update user profile in backend
console.log("Saved profile info:", { linkedin, github });

//update auth state with new info
updateUser({ linkedin, github });
};

//logged in
Expand Down Expand Up @@ -46,7 +55,7 @@ export default function Profile() {
<Text style={styles.buttonText}>Save</Text>
</TouchableOpacity>

<TouchableOpacity style={styles.button} onPress={() => setUser(null)}>
<TouchableOpacity style={styles.button} onPress={(logout)}>
<Text style={styles.buttonText}>Log Out</Text>
</TouchableOpacity>
</View>
Expand All @@ -63,7 +72,7 @@ export default function Profile() {
)}
</View>
);
}
};

const styles = StyleSheet.create({
container: {
Expand Down
2 changes: 1 addition & 1 deletion shatter-mobile/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tabs } from "expo-router";
import { AuthProvider } from "../context/AuthContext";
import { AuthProvider } from "../../src/components/context/AuthContext";

export default function RootLayout() {
return (
Expand Down
27 changes: 0 additions & 27 deletions shatter-mobile/app/context/AuthContext.tsx

This file was deleted.

Loading