pull/4/head
Anthony RICHARD 5 months ago
parent 4621a3012e
commit 668babdef5

@ -1,46 +0,0 @@
import React from "react";
import FontAwesome from "@expo/vector-icons/FontAwesome";
import { Link, Tabs } from "expo-router";
import { Pressable } from "react-native";
// You can explore the built-in icon families and icons on the web at https://icons.expo.fyi/
function TabBarIcon(props: {
name: React.ComponentProps<typeof FontAwesome>["name"];
color: string;
}) {
return <FontAwesome size={28} style={{ marginBottom: -3 }} {...props} />;
}
export default function TabLayout() {
return (
<Tabs>
<Tabs.Screen
name="index"
options={{
title: "Tab One",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
headerRight: () => (
<Link href="/modal" asChild>
<Pressable>
{({ pressed }) => (
<FontAwesome
name="info-circle"
size={25}
style={{ marginRight: 15, opacity: pressed ? 0.5 : 1 }}
/>
)}
</Pressable>
</Link>
),
}}
/>
<Tabs.Screen
name="two"
options={{
title: "Tab Two",
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
}}
/>
</Tabs>
);
}

@ -1,40 +0,0 @@
import { Button, StyleSheet } from "react-native";
import { Text } from "@/components/ui/text";
import { View } from "react-native";
import { useSession } from "@/ctx";
export default function TabOneScreen() {
const { signOut, session } = useSession();
return (
<View style={styles.container}>
<Text style={styles.title}>Tab One</Text>
<Text>Welcome, {session}</Text>
<View style={styles.separator} />
<Button
title="Sign Out"
onPress={() => {
// The `app/(app)/_layout.tsx` will redirect to the sign-in screen.
signOut();
}}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
title: {
fontSize: 20,
fontWeight: "bold",
},
separator: {
marginVertical: 30,
height: 1,
width: "80%",
},
});

@ -1,64 +0,0 @@
import { Text } from "../../../components/ui/text";
import {
Button,
ButtonGroup,
ButtonIcon,
ButtonText,
} from "../../../components/ui/button";
import { VStack } from "../../../components/ui/vstack";
import React from "react";
import {
ArrowRightIcon,
LockIcon,
MailIcon,
MessageCircleIcon,
} from "../../../components/ui/icon";
import BackButton from "../../../components/BackButton";
import Screen from "../../../components/Screen";
import { Heading } from "../../../components/ui/heading";
import { Link } from "expo-router";
const resetButtons: IResetButton[] = [
{ icon: MailIcon, text: "Envoyer par email" },
{ icon: LockIcon, text: "Envoyer par 2FA" },
{ icon: MessageCircleIcon, text: "Envoyer par SMS" },
];
interface IResetButton {
icon: React.ElementType;
text: string;
}
export default function ResetPasswordPage() {
return (
<Screen>
<BackButton link={"/LoginPage"} />
<VStack space="2xl">
<VStack space="sm">
<Heading className="text-center" size="3xl">
Réinitialisation de ton mot de passe
</Heading>
<Text size="lg" className="text-center">
Selectionne une méthode pour recevoir ton code temporaire
</Text>
</VStack>
<ButtonGroup space="xl">
{resetButtons.map((resetButton) => (
<Link key={resetButton.text} href={"/CodeSentPage"} asChild>
<Button
className="justify-between"
size="2xl"
action="primary"
variant="outline"
>
<ButtonIcon as={resetButton.icon} />
<ButtonText>{resetButton.text}</ButtonText>
<ButtonIcon as={ArrowRightIcon} />
</Button>
</Link>
))}
</ButtonGroup>
</VStack>
</Screen>
);
}

@ -1,30 +0,0 @@
import { StyleSheet } from "react-native";
import { Text } from "@/components/ui/text";
import { View } from "react-native";
export default function TabTwoScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Tab Two</Text>
<View style={styles.separator} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
title: {
fontSize: 20,
fontWeight: "bold",
},
separator: {
marginVertical: 30,
height: 1,
width: "80%",
},
});

@ -1,25 +1,15 @@
import { Redirect, Stack } from "expo-router";
import { Slot, Stack} from "expo-router";
import { useSession } from "@/ctx";
import { Text } from "@/components/ui/text";
import {SafeAreaView, View} from "react-native";
export default function AppLayout() {
const { session, isLoading } = useSession();
// You can keep the splash screen open, or render a loading screen like we do here.
if (isLoading) {
return <Text>Loading...</Text>;
}
// Only require authentication within the (app) group's layout as users
// need to be able to access the (auth) group and sign in again.
if (!session) {
return <Redirect href="/login" />;
}
export default function AuthLayout() {
return (
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="modal" options={{ presentation: "modal" }} />
<Stack.Screen name="code-send" options={{headerShown: false}}/>
<Stack.Screen name="sign-in" options={{headerShown: false}}/>
<Stack.Screen name="login" options={{headerShown: false}}/>
<Stack.Screen name="reset-password" options={{headerShown: false}}/>
</Stack>
);
}

@ -1,13 +1,13 @@
import BackButton from "../../../components/BackButton";
import BackButton from "@/components/BackButton";
import React from "react";
import { Card } from "../../../components/ui/card";
import Screen from "../../../components/Screen";
import { Heading } from "../../../components/ui/heading";
import { Card } from "@/components/ui/card";
import Screen from "@/components/Screen";
import { Heading } from "@/components/ui/heading";
import { AntDesign } from "@expo/vector-icons";
import { VStack } from "../../../components/ui/vstack";
import { Text } from "../../../components/ui/text";
import { Button, ButtonIcon, ButtonText } from "../../../components/ui/button";
import { LockIcon } from "../../../components/ui/icon";
import { VStack } from "@/components/ui/vstack";
import { Text } from "@/components/ui/text";
import { Button, ButtonIcon, ButtonText } from "@/components/ui/button";
import { LockIcon } from "@/components/ui/icon";
function truncateEmail(email: string) {
const splitedEmail = email.split("@");
@ -23,7 +23,7 @@ type props = { email?: string };
export default function CodeSentPage({ email }: props) {
return (
<Screen>
<BackButton icon="close" link={"/(auth)/log-in"} action="primary" />
<BackButton icon="close" link={"/login"} action="primary" />
<Card className="rounded-3xl mt-16">
<VStack space="lg">
<AntDesign

@ -1,16 +1,15 @@
import { Text } from "../components/ui/text";
import { VStack } from "../components/ui/vstack";
import { Button, ButtonGroup } from "../components/ui/button";
import { Text } from "@/components/ui/text";
import { VStack } from "@/components/ui/vstack";
import { Button, ButtonGroup } from "@/components/ui/button";
import { Feather } from "@expo/vector-icons";
import { HStack } from "../components/ui/hstack";
import { HStack } from "@/components/ui/hstack";
import React from "react";
import { FeatherIconNames } from "@expo/vector-icons/build/Feather";
import { Box } from "../components/ui/box";
import { Heading } from "../components/ui/heading";
import { Box } from "@/components/ui/box";
import { Heading } from "@/components/ui/heading";
import { Link } from "expo-router";
import { LinkText } from "../components/ui/link";
import LoginForm from "../components/form/LoginForm";
import Screen from "../components/Screen";
import { LinkText } from "@/components/ui/link";
import LoginForm from "@/components/form/LoginForm";
import Screen from "@/components/Screen";
const socialNetworkButtons: ISocialNetworkButtons[] = [
{ icon: "instagram" },
@ -19,7 +18,7 @@ const socialNetworkButtons: ISocialNetworkButtons[] = [
];
interface ISocialNetworkButtons {
icon: FeatherIconNames;
icon: any;
}
export default function LoginPage() {
@ -56,7 +55,7 @@ export default function LoginPage() {
<LinkText bold={true}>Inscris-toi !</LinkText>
</Link>
</HStack>
<Link className="text-center" href="/(auth)/reset-password">
<Link className="text-center" href="/reset-password">
<LinkText bold={true}>Mot de passe oublié ?</LinkText>
</Link>
</VStack>

@ -1,34 +0,0 @@
import { StatusBar } from "expo-status-bar";
import { Platform, StyleSheet } from "react-native";
import { Text } from "@/components/ui/text";
import { View } from "react-native";
export default function ModalScreen() {
return (
<View style={styles.container}>
<Text style={styles.title}>Modal</Text>
<View style={styles.separator} />
{/* Use a light status bar on iOS to account for the black space above the modal */}
<StatusBar style={Platform.OS === "ios" ? "light" : "auto"} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
title: {
fontSize: 20,
fontWeight: "bold",
},
separator: {
marginVertical: 30,
height: 1,
width: "80%",
},
});

@ -0,0 +1,67 @@
import {Text} from "@/components/ui/text";
import {
Button,
ButtonGroup,
ButtonIcon,
ButtonText,
} from "@/components/ui/button";
import {VStack} from "@/components/ui/vstack";
import React from "react";
import {
ArrowRightIcon,
LockIcon,
MailIcon,
MessageCircleIcon,
} from "@/components/ui/icon";
import BackButton from "@/components/BackButton";
import Screen from "@/components/Screen";
import {Heading} from "@/components/ui/heading";
import {Link} from "expo-router";
import {SafeAreaView} from "react-native";
const resetButtons: IResetButton[] = [
{icon: MailIcon, text: "Envoyer par email"},
{icon: LockIcon, text: "Envoyer par 2FA"},
{icon: MessageCircleIcon, text: "Envoyer par SMS"},
];
interface IResetButton {
icon: React.ElementType;
text: string;
}
export default function ResetPasswordPage() {
return (
<SafeAreaView>
<Screen>
<BackButton link={"/login"}/>
<VStack space="2xl">
<VStack space="sm">
<Heading className="text-center" size="3xl">
Réinitialisation de ton mot de passe
</Heading>
<Text size="lg" className="text-center">
Selectionne une méthode pour recevoir ton code temporaire
</Text>
</VStack>
<ButtonGroup space="xl">
{resetButtons.map((resetButton) => (
<Link key={resetButton.text} href={"/sign-in"} asChild>
<Button
className="justify-between"
size="2xl"
action="primary"
variant="outline"
>
<ButtonIcon as={resetButton.icon}/>
<ButtonText>{resetButton.text}</ButtonText>
<ButtonIcon as={ArrowRightIcon}/>
</Button>
</Link>
))}
</ButtonGroup>
</VStack>
</Screen>
</SafeAreaView>
);
}

@ -1,13 +1,13 @@
import { Text } from "../../../components/ui/text";
import { VStack } from "../../../components/ui/vstack";
import { Box } from "../../../components/ui/box";
import { HStack } from "../../../components/ui/hstack";
import { Text } from "@/components/ui/text";
import { VStack } from "@/components/ui/vstack";
import { Box } from "@/components/ui/box";
import { HStack } from "@/components/ui/hstack";
import React from "react";
import SigninForm from "../../../components/form/SigninForm";
import Screen from "../../../components/Screen";
import { Heading } from "../../../components/ui/heading";
import SigninForm from "@/components/form/SigninForm";
import Screen from "@/components/Screen";
import { Heading } from "@/components/ui/heading";
import { Link } from "expo-router";
import { LinkText } from "../../../components/ui/link";
import { LinkText } from "@/components/ui/link";
export default function SigninPage() {
return (

@ -1,9 +0,0 @@
import { Stack } from "expo-router";
export default function RootLayout() {
return (
<Stack>
<Stack.Screen name="ProfileScreen" />
</Stack>
);
}

@ -1,9 +1,9 @@
import { Stack } from "expo-router";
export default function RootLayout() {
export default function RootoLayout() {
return (
<Stack>
<Stack.Screen name="HomeScreen" />
<Stack.Screen name="index" />
</Stack>
);
}

@ -0,0 +1,9 @@
import { Stack } from "expo-router";
export default function KRootLayout() {
return (
<Stack>
<Stack.Screen name="profile" />
</Stack>
);
}

@ -0,0 +1,41 @@
import {Redirect, Tabs} from "expo-router";
import {useSession} from "@/ctx";
import {Text} from "react-native"
export default function TabBarLayout() {
const { session, isLoading } = useSession();
// You can keep the splash screen open, or render a loading screen like we do here.
if (isLoading) {
return <Text>Loading...</Text>;
}
// Only require authentication within the (app) group's layout as users
// need to be able to access the (auth) group and sign in again.
if (!session) {
// On web, static rendering will stop here as the user is not authenticated
// in the headless Node process that the pages are rendered in.
return <Redirect href="/reset-password" />;
}
return (
<Tabs
screenOptions={{
headerShown: false,
}}
initialRouteName={"(home)"}
>
<Tabs.Screen
name="(home)"
options={{
title: 'Home',
}}
/>
<Tabs.Screen
name="(profile)"
options={{
title: 'Profile',
}}
/>
</Tabs>
);
}

@ -1,38 +0,0 @@
import { ScrollViewStyleReset } from 'expo-router/html';
// This file is web-only and used to configure the root HTML for every
// web page during static rendering.
// The contents of this function only run in Node.js environments and
// do not have access to the DOM or browser APIs.
export default function Root({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
{/*
Disable body scrolling on web. This makes ScrollView components work closer to how they do on native.
However, body scrolling is often nice to have for mobile web. If you want to enable it, remove this line.
*/}
<ScrollViewStyleReset />
{/* Using raw CSS styles as an escape-hatch to ensure the background color never flickers in dark-mode. */}
<style dangerouslySetInnerHTML={{ __html: responsiveBackground }} />
{/* Add any additional <head> elements that you want globally available on web... */}
</head>
<body>{children}</body>
</html>
);
}
const responsiveBackground = `
body {
background-color: #fff;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #000;
}
}`;

@ -1,19 +1,16 @@
import { Link, Stack } from "expo-router";
import { StyleSheet } from "react-native";
import { Link, Stack, usePathname } from 'expo-router';
import {StyleSheet, Text, View} from 'react-native';
import { Text } from "@/components/ui/text";
import { View } from "react-native";
export default function NotFoundScreen() {
const pathname = usePathname();
return (
<>
<Stack.Screen options={{ title: "Oops!" }} />
<Stack.Screen options={{ title: 'Oops!' }} />
<View style={styles.container}>
<Text style={styles.title}>This screen doesn't exist.</Text>
<Link href="/" style={styles.link}>
<Text style={styles.linkText}>Go to home screen!</Text>
</Link>
<Text>This screen doesn't exist: {pathname}</Text>
<Text>Go to home screen!</Text>
</View>
</>
);
@ -22,20 +19,12 @@ export default function NotFoundScreen() {
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
alignItems: 'center',
justifyContent: 'center',
padding: 20,
},
title: {
fontSize: 20,
fontWeight: "bold",
},
link: {
marginTop: 15,
paddingVertical: 15,
},
linkText: {
fontSize: 14,
color: "#2e78b7",
},
});

@ -3,18 +3,9 @@ import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { useEffect } from "react";
import { SessionProvider } from "@/ctx";
import { Slot } from "expo-router";
import { Slot, Stack } from "expo-router";
import { GluestackUIProvider } from "@/components/ui/gluestack-ui-provider";
export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from "expo-router";
export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.
initialRouteName: "login",
};
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
@ -25,10 +16,6 @@ export default function RootLayout() {
...FontAwesome.font,
});
// Expo Router uses Error Boundaries to catch errors in the navigation tree.
useEffect(() => {
if (error) throw error;
}, [error]);
useEffect(() => {
if (loaded) {
@ -40,15 +27,11 @@ export default function RootLayout() {
return null;
}
return <RootLayoutNav />;
}
function RootLayoutNav() {
return (
<SessionProvider>
<GluestackUIProvider>
<Slot/>
</GluestackUIProvider>
</SessionProvider>
);
}
);}

@ -1,10 +1,9 @@
import { AntDesign } from "@expo/vector-icons";
import { Button, ButtonActions } from "./ui/button";
import { AntDesignIconNames } from "@expo/vector-icons/build/AntDesign";
import { Href, Link } from "expo-router";
type props = {
icon?: AntDesignIconNames;
icon?: any;
link: Href;
action?: ButtonActions;
};

@ -1,106 +1,106 @@
import HomeScreen from "@/app/(home)/home";
import {
AntDesign,
Entypo,
MaterialCommunityIcons,
MaterialIcons,
} from "@expo/vector-icons";
import ProfileScreen from "@/app/(profile)/profile";
import React from "react";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
export default function NavBar() {
const BottomTabNavigator = createBottomTabNavigator();
return (
<BottomTabNavigator.Navigator
initialRouteName="Home"
screenOptions={{
headerShown: false,
tabBarShowLabel: false,
tabBarStyle: {
height: 75,
backgroundColor: "#f9f9f9",
},
tabBarActiveTintColor: "black",
tabBarInactiveTintColor: "#8e8e93",
tabBarItemStyle: {
borderRadius: 50,
},
}}
>
<BottomTabNavigator.Screen
name="Home"
component={HomeScreen}
options={{
tabBarIcon: ({ color, size, focused }) => (
<MaterialIcons
name="home"
color={focused ? "black" : color}
size={focused ? size + 4 : size}
/>
),
}}
/>
<BottomTabNavigator.Screen
name="Exercice"
component={ProfileScreen}
options={{
tabBarIcon: ({ color, size, focused }) => (
<MaterialCommunityIcons
name="dumbbell"
size={focused ? size + 4 : size}
color={focused ? "black" : color}
/>
),
}}
/>
<BottomTabNavigator.Screen
name="Add"
component={ProfileScreen}
options={{
tabBarIcon: ({ color, size, focused }) => (
<Entypo
name="plus"
size={focused ? size + 6 : size}
color="white"
/>
),
tabBarItemStyle: {
borderRadius: 50,
backgroundColor: "orange",
},
}}
/>
<BottomTabNavigator.Screen
name="Help"
component={ProfileScreen}
options={{
tabBarIcon: ({ color, size, focused }) => (
<AntDesign
name="question"
size={focused ? size + 2 : size} // Augmente la taille si actif
color={focused ? "black" : color}
/>
),
}}
/>
<BottomTabNavigator.Screen
name="Settings"
component={ProfileScreen}
options={{
tabBarIcon: ({ color, size, focused }) => (
<MaterialIcons
name="account-circle"
size={focused ? size + 3 : size}
color={focused ? "black" : color}
/>
),
}}
/>
</BottomTabNavigator.Navigator>
);
}
// import HomeScreen from "@/app/(tabs)/(home)/home";
// import {
// AntDesign,
// Entypo,
// MaterialCommunityIcons,
// MaterialIcons,
// } from "@expo/vector-icons";
// import ProfileScreen from "@/app/(tabs)/(profile)/profile";
// import React from "react";
// import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
//
// export default function NavBar() {
// const BottomTabNavigator = createBottomTabNavigator();
// return (
// <BottomTabNavigator.Navigator
// initialRouteName="Home"
// screenOptions={{
// headerShown: false,
// tabBarShowLabel: false,
// tabBarStyle: {
// height: 75,
// backgroundColor: "#f9f9f9",
// },
// tabBarActiveTintColor: "black",
// tabBarInactiveTintColor: "#8e8e93",
// tabBarItemStyle: {
// borderRadius: 50,
// },
// }}
// >
// <BottomTabNavigator.Screen
// name="Home"
// component={HomeScreen}
// options={{
// tabBarIcon: ({ color, size, focused }) => (
// <MaterialIcons
// name="home"
// color={focused ? "black" : color}
// size={focused ? size + 4 : size}
// />
// ),
// }}
// />
//
// <BottomTabNavigator.Screen
// name="Exercice"
// component={ProfileScreen}
// options={{
// tabBarIcon: ({ color, size, focused }) => (
// <MaterialCommunityIcons
// name="dumbbell"
// size={focused ? size + 4 : size}
// color={focused ? "black" : color}
// />
// ),
// }}
// />
//
// <BottomTabNavigator.Screen
// name="Add"
// component={ProfileScreen}
// options={{
// tabBarIcon: ({ color, size, focused }) => (
// <Entypo
// name="plus"
// size={focused ? size + 6 : size}
// color="white"
// />
// ),
// tabBarItemStyle: {
// borderRadius: 50,
// backgroundColor: "orange",
// },
// }}
// />
//
// <BottomTabNavigator.Screen
// name="Help"
// component={ProfileScreen}
// options={{
// tabBarIcon: ({ color, size, focused }) => (
// <AntDesign
// name="question"
// size={focused ? size + 2 : size} // Augmente la taille si actif
// color={focused ? "black" : color}
// />
// ),
// }}
// />
//
// <BottomTabNavigator.Screen
// name="Settings"
// component={ProfileScreen}
// options={{
// tabBarIcon: ({ color, size, focused }) => (
// <MaterialIcons
// name="account-circle"
// size={focused ? size + 3 : size}
// color={focused ? "black" : color}
// />
// ),
// }}
// />
// </BottomTabNavigator.Navigator>
// );
// }

@ -2,7 +2,7 @@ import React from "react";
import { Button, ButtonIcon, ButtonText } from "../ui/button";
import { ArrowRightIcon } from "../ui/icon";
import { Link } from "expo-router";
import {Text} from "react-native";
export default function LoginForm() {
const REQUIRED_ERROR = "Au moins un des champs requis est vide !";
const [emailValue, setEmailValue] = React.useState("");
@ -70,11 +70,12 @@ export default function LoginForm() {
// </Button>
// </VStack>
// </FormControl>
<Link href={"/sign-in"} asChild>
<Button size="xl" onPress={handleSubmit}>
<ButtonText>Se connecter</ButtonText>
<ButtonIcon as={ArrowRightIcon} />
</Button>
</Link>
// <Link href={"/sign-in"} asChild>
// <Button size="xl" onPress={handleSubmit}>
// <ButtonText>Se connecter</ButtonText>
// <ButtonIcon as={ArrowRightIcon} />
// </Button>
// </Link>
<Text>sdf</Text>
);
}

@ -2,6 +2,7 @@
"extends": "expo/tsconfig.base",
"compilerOptions": {
"strict": true,
"baseUrl": "./",
"paths": {
"@/*": ["./*"]
}
@ -12,6 +13,5 @@
".expo/types/**/*.ts",
"expo-env.d.ts",
"nativewind-env.d.ts",
"app/(app)/index.tsx"
]
}

Loading…
Cancel
Save