2025-03-22 17:48:00 +00:00
|
|
|
import {Appbar, Portal, Button, Dialog, Menu, useTheme} from "react-native-paper";
|
|
|
|
import {Image, useColorScheme, View} from "react-native";
|
2025-02-19 20:48:02 +00:00
|
|
|
import React, {useState} from "react";
|
2025-03-08 22:49:48 +00:00
|
|
|
import styles from "@/assets/styles";
|
2025-03-22 17:46:28 +00:00
|
|
|
import About from "@/components/About";
|
2025-02-19 20:48:02 +00:00
|
|
|
|
2025-03-22 17:46:28 +00:00
|
|
|
const TopNav = ({ toggleProfile }: { toggleProfile: () => void; }) => {
|
2025-02-19 20:48:02 +00:00
|
|
|
const theme = useTheme();
|
2025-03-01 18:11:36 +00:00
|
|
|
const colorScheme = useColorScheme();
|
2025-02-19 20:48:02 +00:00
|
|
|
const [aboutVisible, setAboutVisible] = useState(false);
|
|
|
|
const [menuVisible, setMenuVisible] = useState(false);
|
|
|
|
const [menuAnchor, setMenuAnchor] = useState<{ x: number; y: number } | null>(null);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={{ backgroundColor: theme.colors.background }}>
|
2025-03-22 17:46:28 +00:00
|
|
|
<Appbar.Header style={[styles.topBar, { backgroundColor: theme.colors.primaryContainer }]}>
|
2025-02-19 20:48:02 +00:00
|
|
|
<View>
|
2025-03-01 18:11:36 +00:00
|
|
|
<Menu visible={menuVisible} onDismiss={() => setMenuVisible(false)} anchor={menuAnchor} style={{ backgroundColor: theme.colors.primaryContainer }}>
|
|
|
|
<Menu.Item onPress={() => { setMenuVisible(false); setAboutVisible(true);}} title="About Us" style={{ backgroundColor: theme.colors.primaryContainer }}/>
|
2025-02-19 20:48:02 +00:00
|
|
|
</Menu>
|
|
|
|
<Appbar.Action icon="menu"
|
|
|
|
onPressIn={(event) => {
|
|
|
|
setMenuAnchor({ x: event.nativeEvent.pageX, y: event.nativeEvent.pageY + 40 });
|
|
|
|
setMenuVisible(true);
|
|
|
|
}}
|
2025-02-22 02:56:54 +00:00
|
|
|
iconColor={theme.colors.primary} />
|
2025-02-19 20:48:02 +00:00
|
|
|
</View>
|
2025-03-02 20:32:39 +00:00
|
|
|
<View style={styles.logoContainer} >
|
2025-03-01 18:11:36 +00:00
|
|
|
<Image source={
|
|
|
|
colorScheme === 'dark' ?
|
|
|
|
require("../assets/images/pogdark_logo_inverse.png") : require("../assets/images/pogdark_logo.png")
|
2025-03-02 20:32:39 +00:00
|
|
|
} style={styles.logo} resizeMode={"contain"} />
|
2025-02-19 20:48:02 +00:00
|
|
|
</View>
|
2025-02-22 02:56:54 +00:00
|
|
|
<Appbar.Action icon="pencil" onPress={toggleProfile} iconColor={ theme.colors.primary } />
|
2025-02-19 20:48:02 +00:00
|
|
|
</Appbar.Header>
|
|
|
|
<Portal>
|
2025-03-01 18:11:36 +00:00
|
|
|
<Dialog visible={aboutVisible} onDismiss={() => setAboutVisible(false)} style={{ backgroundColor: theme.colors.primaryContainer }}>
|
|
|
|
<Dialog.Title style={{ color: theme.colors.primary, textAlign: 'center' }}>About Us</Dialog.Title>
|
2025-03-22 17:46:28 +00:00
|
|
|
<About />
|
2025-02-19 20:48:02 +00:00
|
|
|
<Dialog.Actions style={{ justifyContent: "center" }}>
|
2025-03-01 18:11:36 +00:00
|
|
|
<Button onPress={() => setAboutVisible(false)} mode="contained" style={{ backgroundColor: theme.colors.inversePrimary }} labelStyle={{ color: theme.colors.primary }}>
|
2025-02-19 20:48:02 +00:00
|
|
|
Close
|
|
|
|
</Button>
|
|
|
|
</Dialog.Actions>
|
|
|
|
</Dialog>
|
|
|
|
</Portal>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2025-03-22 17:46:28 +00:00
|
|
|
export default TopNav;
|