2025-02-26 16:02:55 +00:00
|
|
|
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";
|
2025-03-22 17:46:28 +00:00
|
|
|
import Profile from "@/components/Profile";
|
2025-04-27 14:09:04 +00:00
|
|
|
import LocationScreen from "@/components/Location";
|
2025-03-22 17:46:28 +00:00
|
|
|
import Status from "@/components/Status";
|
|
|
|
import TopNav from "@/components/TopNav";
|
2025-04-01 00:09:32 +00:00
|
|
|
import DrawerMenu from "@/components/DrawerMenu";
|
|
|
|
import Dialogs from "@/components/Dialogs";
|
2025-02-26 16:02:55 +00:00
|
|
|
import { useUser } from "@/context/UserContext";
|
2025-03-08 22:49:48 +00:00
|
|
|
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 = () => {
|
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,
|
2025-03-30 03:18:28 +00:00
|
|
|
isMenuActive,
|
|
|
|
setMenuActive,
|
2025-04-01 00:09:32 +00:00
|
|
|
setAboutActive,
|
|
|
|
isAboutActive,
|
|
|
|
setPrivacyActive,
|
|
|
|
isPrivacyActive,
|
|
|
|
setBugActive,
|
|
|
|
isBugActive,
|
|
|
|
setLocationActive,
|
|
|
|
isLocationActive,
|
2025-02-26 16:02:55 +00:00
|
|
|
userId,
|
|
|
|
userName,
|
|
|
|
setUserName,
|
|
|
|
userImage,
|
|
|
|
setUserImage,
|
2025-04-28 04:05:33 +00:00
|
|
|
park,
|
|
|
|
setPark,
|
2025-02-26 16:02:55 +00:00
|
|
|
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) {
|
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 }]}>
|
2025-04-01 00:09:32 +00:00
|
|
|
<DrawerMenu
|
|
|
|
isMenuActive={isMenuActive}
|
|
|
|
onClose={() => setMenuActive(false)}
|
|
|
|
toggleAbout={() => setAboutActive(!isAboutActive)}
|
|
|
|
togglePrivacy={() => setPrivacyActive(!isPrivacyActive)}
|
|
|
|
toggleBug={() => setBugActive(!isBugActive)}
|
2025-02-19 18:33:09 +00:00
|
|
|
toggleProfile={() => setProfileActive(true)}
|
2025-04-01 00:09:32 +00:00
|
|
|
toggleLocation={() => setLocationActive(true)}
|
|
|
|
/>
|
|
|
|
<Dialogs
|
|
|
|
aboutVisible={isAboutActive}
|
|
|
|
privacyVisible={isPrivacyActive}
|
|
|
|
bugVisible={isBugActive}
|
|
|
|
toggleAbout={() => setAboutActive(!isAboutActive)}
|
|
|
|
togglePrivacy={() => setPrivacyActive(!isPrivacyActive)}
|
|
|
|
toggleBug={() => setBugActive(!isBugActive)}
|
|
|
|
/>
|
|
|
|
<TopNav
|
|
|
|
toggleMenu={() => setMenuActive(!isMenuActive)}
|
2025-02-19 20:48:02 +00:00
|
|
|
/>
|
2025-03-22 17:46:28 +00:00
|
|
|
<Status
|
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}
|
2025-04-02 02:48:58 +00:00
|
|
|
isMenuActive={isMenuActive}
|
2025-02-19 18:33:09 +00:00
|
|
|
/>
|
2025-03-22 17:46:28 +00:00
|
|
|
<Profile
|
2025-02-19 18:33:09 +00:00
|
|
|
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)}
|
|
|
|
/>
|
2025-04-27 14:09:04 +00:00
|
|
|
<LocationScreen
|
|
|
|
visible={isLocationActive}
|
|
|
|
currentTheme={currentTheme}
|
2025-04-28 04:05:33 +00:00
|
|
|
park={park}
|
|
|
|
setPark={setPark}
|
2025-04-27 14:09:04 +00:00
|
|
|
setChanged={setUserDataChanged}
|
|
|
|
onClose={() => setLocationActive(false)}
|
|
|
|
/>
|
2025-02-19 18:33:09 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Index;
|