pogdark-app/app/index.tsx

74 lines
2.1 KiB
TypeScript
Raw Normal View History

import React from 'react';
2025-03-02 20:32:39 +00:00
import {View, Text } from "react-native";
2025-02-19 18:33:09 +00:00
import { useTheme } from "react-native-paper";
import Profile from "@/components/Profile";
import Status from "@/components/Status";
import TopNav from "@/components/TopNav";
import BottomNav from "@/components/BottomNav"
import { useUser } from "@/context/UserContext";
import styles from "@/assets/styles";
2025-03-02 20:32:39 +00:00
import log from "@/util/log"
2025-02-19 18:33:09 +00:00
const Index = () => {
const theme = useTheme();
2025-02-19 18:33:09 +00:00
const {
isProfileActive,
setProfileActive,
userId,
userName,
setUserName,
userImage,
setUserImage,
userStatus,
setUserStatus,
setUserDataChanged,
setTheme,
currentTheme,
isLoading,
} = useUser();
2025-02-22 02:56:54 +00:00
if (isLoading) {
2025-03-02 20:32:39 +00:00
log.debug("Still loading");
2025-02-22 02:56:54 +00:00
return (
2025-03-02 20:32:39 +00:00
<View style={[styles.indexContainer, { 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-03-02 20:32:39 +00:00
<View style={[styles.indexContainer, { backgroundColor: theme.colors.background }]}>
<TopNav
2025-02-19 18:33:09 +00:00
toggleProfile={() => setProfileActive(true)}
/>
<Status
2025-02-19 18:33:09 +00:00
id={userId}
name={userName}
image={userImage}
currentStatus={userStatus}
setStatus={setUserStatus}
currentTheme={currentTheme}
2025-02-19 18:33:09 +00:00
isProfileActive={isProfileActive}
/>
<Profile
2025-02-19 18:33:09 +00:00
visible={isProfileActive}
id={userId}
name={userName}
setName={setUserName}
image={userImage}
setImage={setUserImage}
setTheme={setTheme}
currentTheme={currentTheme}
2025-02-22 02:56:54 +00:00
setChanged={setUserDataChanged}
2025-02-19 18:33:09 +00:00
onClose={() => setProfileActive(false)}
/>
<BottomNav
isProfileActive={isProfileActive}
/>
2025-02-19 18:33:09 +00:00
</View>
);
};
export default Index;