2025-02-26 16:02:55 +00:00
|
|
|
import React from 'react';
|
|
|
|
import {View, StyleSheet, Text } from "react-native";
|
2025-02-19 18:33:09 +00:00
|
|
|
import { useTheme } from "react-native-paper";
|
|
|
|
import ProfileScreen from "@/app/ProfileScreen";
|
|
|
|
import StatusPage from "@/app/StatusPage";
|
2025-02-19 20:48:02 +00:00
|
|
|
import Nav from "@/app/Nav";
|
2025-02-26 16:02:55 +00:00
|
|
|
import { useUser } from "@/context/UserContext";
|
2025-02-19 18:33:09 +00:00
|
|
|
|
|
|
|
const Index = () => {
|
2025-02-25 14:38:59 +00:00
|
|
|
const theme = useTheme();
|
2025-02-19 18:33:09 +00:00
|
|
|
|
2025-02-26 16:02:55 +00:00
|
|
|
const {
|
|
|
|
isProfileActive,
|
|
|
|
setProfileActive,
|
|
|
|
userId,
|
|
|
|
userName,
|
|
|
|
setUserName,
|
|
|
|
userImage,
|
|
|
|
setUserImage,
|
|
|
|
userStatus,
|
|
|
|
setUserStatus,
|
|
|
|
setUserDataChanged,
|
|
|
|
setTheme,
|
2025-02-26 16:23:00 +00:00
|
|
|
currentTheme,
|
2025-02-26 16:02:55 +00:00
|
|
|
isLoading,
|
|
|
|
} = useUser();
|
2025-02-25 00:50:06 +00:00
|
|
|
|
2025-02-22 02:56:54 +00:00
|
|
|
if (isLoading) {
|
|
|
|
console.log("Still loading");
|
|
|
|
return (
|
2025-02-25 14:38:59 +00:00
|
|
|
<View style={[styles.container, { backgroundColor: theme.colors.background, justifyContent: 'center', alignItems: 'center' }]}>
|
2025-02-22 02:56:54 +00:00
|
|
|
<Text>Loading...</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2025-02-19 18:33:09 +00:00
|
|
|
|
|
|
|
return (
|
2025-02-25 14:38:59 +00:00
|
|
|
<View style={[styles.container, { backgroundColor: theme.colors.background }]}>
|
2025-02-19 20:48:02 +00:00
|
|
|
<Nav
|
2025-02-19 18:33:09 +00:00
|
|
|
toggleProfile={() => setProfileActive(true)}
|
2025-02-19 20:48:02 +00:00
|
|
|
/>
|
|
|
|
<StatusPage
|
2025-02-19 18:33:09 +00:00
|
|
|
id={userId}
|
|
|
|
name={userName}
|
|
|
|
image={userImage}
|
2025-02-21 17:27:59 +00:00
|
|
|
currentStatus={userStatus}
|
|
|
|
setStatus={setUserStatus}
|
2025-02-26 17:12:24 +00:00
|
|
|
currentTheme={currentTheme}
|
2025-02-19 18:33:09 +00:00
|
|
|
isProfileActive={isProfileActive}
|
|
|
|
/>
|
|
|
|
<ProfileScreen
|
|
|
|
visible={isProfileActive}
|
|
|
|
id={userId}
|
|
|
|
name={userName}
|
|
|
|
setName={setUserName}
|
|
|
|
image={userImage}
|
|
|
|
setImage={setUserImage}
|
2025-02-26 16:02:55 +00:00
|
|
|
setTheme={setTheme}
|
2025-02-26 16:23:00 +00:00
|
|
|
currentTheme={currentTheme}
|
2025-02-22 02:56:54 +00:00
|
|
|
setChanged={setUserDataChanged}
|
2025-02-19 18:33:09 +00:00
|
|
|
onClose={() => setProfileActive(false)}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: { flex: 1, alignItems: "stretch" },
|
2025-02-21 17:27:59 +00:00
|
|
|
imageBackground: {
|
|
|
|
position: "absolute", // Allows child elements to layer on top
|
|
|
|
width: "100%", // Ensure full coverage of the column
|
|
|
|
height: "100%", // Fully stretches to column height
|
|
|
|
resizeMode: "cover", // Ensures it fits well
|
|
|
|
opacity: 0.3, // Fades the image
|
|
|
|
},
|
2025-02-19 18:33:09 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export default Index;
|