Skip to content

Commit 04256ee

Browse files
committed
chore(Restructure Project): restructre the codebase folder structure to be more readable
1 parent 0b52589 commit 04256ee

File tree

23 files changed

+93
-92
lines changed

23 files changed

+93
-92
lines changed

app/+not-found.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { Link, Stack } from 'expo-router';
2-
import { StyleSheet } from 'react-native';
1+
import { Link, Stack } from "expo-router";
32

4-
import { ThemedText } from '@/components/ThemedText';
5-
import { ThemedView } from '@/components/ThemedView';
3+
import { StyleSheet } from "react-native";
4+
import { ThemedText } from "@/components/ui/ThemedText/ThemedText";
5+
import { ThemedView } from "@/components/ui/ThemedView/ThemedView";
66

77
export default function NotFoundScreen() {
88
return (
99
<>
10-
<Stack.Screen options={{ title: 'Oops!' }} />
10+
<Stack.Screen options={{ title: "Oops!" }} />
1111
<ThemedView style={styles.container}>
1212
<ThemedText type="title">This screen doesn't exist.</ThemedText>
1313
<Link href="/" style={styles.link}>
@@ -21,8 +21,8 @@ export default function NotFoundScreen() {
2121
const styles = StyleSheet.create({
2222
container: {
2323
flex: 1,
24-
alignItems: 'center',
25-
justifyContent: 'center',
24+
alignItems: "center",
25+
justifyContent: "center",
2626
padding: 20,
2727
},
2828
link: {

app/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
View,
88
} from "react-native";
99

10-
import { Onboarding } from "@/components/Onboarding";
10+
import { Onboarding } from "@/components/OnboardingUi/Onbording/Onboarding";
1111

1212
const imagePath = require("@/assets/images/background.png");
1313

app/login.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Alert, ImageBackground, View } from "react-native";
22

3-
import Button from "@/components/Button";
3+
import Button from "@/components/ui/Button/Button";
44
import { Colors } from "@/constants/Colors";
5-
import { ContinueWith } from "@/components/ContinueWith";
6-
import { ForgetPassword } from "@/components/ForgetPassword";
5+
import { ContinueWith } from "@/components/ui/ContinueWith/ContinueWith";
6+
import { ForgetPassword } from "@/components/ui/ForgetPassword/ForgetPassword";
77
import { Ionicons } from "@expo/vector-icons";
8-
import { RememberMe } from "@/components/RememberMe";
9-
import TextInput from "@/components/TextInput";
10-
import { ThemedText } from "@/components/ThemedText";
8+
import { RememberMe } from "@/components/ui/RememberMe/RememberMe";
9+
import TextInput from "@/components/ui/TextInput/TextInput";
10+
import { ThemedText } from "@/components/ui/ThemedText/ThemedText";
1111
import sharedStyles from "../style/sharedStyles";
1212
import { useForm } from "react-hook-form";
1313
import { useState } from "react";
@@ -116,4 +116,4 @@ const Login = () => {
116116
);
117117
};
118118

119-
export default Login;
119+
export default Login;

app/signup.tsx

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { Alert, ImageBackground, StyleSheet, Text, View } from "react-native";
22
import { Controller, useForm } from "react-hook-form";
33

4-
import Button from "@/components/Button";
4+
import Button from "@/components/ui/Button/Button";
55
import { Colors } from "@/constants/Colors";
6-
import { ContinueWith } from "@/components/ContinueWith";
6+
import { ContinueWith } from "@/components/ui/ContinueWith/ContinueWith";
77
import { Feather } from "@expo/vector-icons";
88
import { Ionicons } from "@expo/vector-icons";
99
import { MaterialCommunityIcons } from "@expo/vector-icons";
10-
import { RememberMe } from "@/components/RememberMe";
11-
import TextInput from "@/components/TextInput";
12-
import { ThemedText } from "@/components/ThemedText";
10+
import { RememberMe } from "@/components/ui/RememberMe/RememberMe";
11+
import TextInput from "@/components/ui/TextInput/TextInput";
12+
import { ThemedText } from "@/components/ui/ThemedText/ThemedText";
1313
import sharedStyles from "../style/sharedStyles";
1414
import { useState } from "react";
1515
import { z } from "zod";
@@ -20,13 +20,14 @@ const phoneRegex = new RegExp(
2020
);
2121
const formSchema = z.object({
2222
email: z.string().email("Please enter a valid email"),
23-
phone: z.string().regex(phoneRegex,"Please enter a valid phone number"),
23+
phone: z.string().regex(phoneRegex, "Please enter a valid phone number"),
2424
password: z.string().min(8, "Password must be at least 8 characters"),
25-
});const imagePath = require("@/assets/images/bg2.png");
25+
});
26+
const imagePath = require("@/assets/images/bg2.png");
2627

2728
const Signup = () => {
2829
const [hidePassword, setHidePassword] = useState(true);
29-
30+
3031
const { control, handleSubmit } = useForm({
3132
defaultValues: {
3233
email: "",
@@ -117,6 +118,6 @@ const Signup = () => {
117118
</ImageBackground>
118119
</View>
119120
);
120-
}
121+
};
121122

122-
export default Signup;
123+
export default Signup;

components/ExternalLink.tsx

-24
This file was deleted.

components/ForgetPassword.tsx

-20
This file was deleted.

components/Onboarding.tsx components/OnboardingUi/Onbording/Onboarding.tsx

+6-10
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import Animated, {
1414
useSharedValue,
1515
} from "react-native-reanimated";
1616

17-
import Button from "./Button";
18-
import { OnboardingItem } from "./OnboardingItem";
19-
import { Pagination } from "./Pagination";
17+
import Button from "../../ui/Button/Button";
18+
import { OnboardingItem } from "../OnboardingItem/OnboardingItem";
19+
import { Pagination } from "../Pagination/Pagination";
2020
import React from "react";
2121
import { data } from "@/data/cards";
2222
import { router } from "expo-router";
@@ -61,12 +61,8 @@ export const Onboarding = () => {
6161
/>
6262
<Pagination data={data} x={x} screenWidth={SCREEN_WIDTH} />
6363
<View style={styles.button}>
64-
<Button
65-
title="Get Started"
66-
onPress={() => router.push('/login')}
67-
/>
64+
<Button title="Get Started" onPress={() => router.push("/login")} />
6865
</View>
69-
7066
</View>
7167
);
7268
};
@@ -78,6 +74,6 @@ const styles = StyleSheet.create({
7874
button: {
7975
paddingTop: 110,
8076
paddingBottom: 20,
81-
paddingHorizontal: 20
82-
}
77+
paddingHorizontal: 20,
78+
},
8379
});
File renamed without changes.
+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import * as React from 'react';
2-
import renderer from 'react-test-renderer';
1+
import * as React from "react";
32

4-
import { ThemedText } from '../ThemedText';
3+
import { ThemedText } from "../ui/ThemedText/ThemedText";
4+
import renderer from "react-test-renderer";
55

66
it(`renders correctly`, () => {
7-
const tree = renderer.create(<ThemedText>Snapshot test!</ThemedText>).toJSON();
7+
const tree = renderer
8+
.create(<ThemedText>Snapshot test!</ThemedText>)
9+
.toJSON();
810

911
expect(tree).toMatchSnapshot();
1012
});
File renamed without changes.

components/ContinueWith.tsx components/ui/ContinueWith/ContinueWith.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@ import { AntDesign } from "@expo/vector-icons";
44
import { Colors } from "@/constants/Colors";
55
import { Ionicons } from "@expo/vector-icons";
66
import React from "react";
7-
import SocialMediaPlatform from "./SocialMediaPlatform";
8-
import { ThemedText } from "./ThemedText";
7+
import SocialMediaPlatform from "@/components/ui/SocialMediaPlatform/SocialMediaPlatform";
8+
import { ThemedText } from "@/components/ui/ThemedText/ThemedText";
99
import { router } from "expo-router";
1010

1111
interface ContinueWithProps {
1212
title: string;
1313
subTitle: string;
14-
signOrLog: string
14+
signOrLog: string;
1515
link: string;
1616
}
17-
export const ContinueWith: React.FC<ContinueWithProps> = ({ title, subTitle, signOrLog,link }) => {
18-
17+
export const ContinueWith: React.FC<ContinueWithProps> = ({
18+
title,
19+
subTitle,
20+
signOrLog,
21+
link,
22+
}) => {
1923
const handelSocialMediaPress = () => {
2024
Alert.alert("This Feature is coming soon....");
21-
}
25+
};
2226
return (
2327
<View style={styles.container}>
2428
<View style={styles.linesWithText}>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Pressable, Text, View } from "react-native";
2+
import React, { FC } from "react";
3+
4+
import { Colors } from "@/constants/Colors";
5+
import { ThemedText } from "@/components/ui/ThemedText/ThemedText";
6+
7+
interface ForgetPasswordProps {
8+
title: string;
9+
onPress: () => void;
10+
}
11+
12+
export const ForgetPassword: React.FC<ForgetPasswordProps> = ({
13+
title,
14+
onPress,
15+
}) => {
16+
return (
17+
<Pressable onPress={onPress}>
18+
<View>
19+
<ThemedText lightColor={Colors.light.gray}>{title}</ThemedText>
20+
</View>
21+
</Pressable>
22+
);
23+
};

components/RememberMe.tsx components/ui/RememberMe/RememberMe.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useState } from "react";
33

44
import { Colors } from "@/constants/Colors";
55
import { Fontisto } from "@expo/vector-icons";
6-
import { ThemedText } from "./ThemedText";
6+
import { ThemedText } from "@/components/ui/ThemedText/ThemedText";
77

88
interface RememberMeProps {
99
title: string;
@@ -14,8 +14,8 @@ interface RememberMeProps {
1414
export const RememberMe: React.FC<RememberMeProps> = ({ title, onPress }) => {
1515
const [rememberMe, setRememberMe] = useState(true);
1616
const handelRememberMePress = () => {
17-
setRememberMe(!rememberMe)
18-
}
17+
setRememberMe(!rememberMe);
18+
};
1919
return (
2020
<Pressable onPress={handelRememberMePress}>
2121
<View style={styles.container}>
File renamed without changes.
File renamed without changes.
File renamed without changes.

locales/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// this folder contains the app translations for the 18next lib
2+
3+
export const en = {
4+
welcome: "Welcome",
5+
home: "Home",
6+
};
7+
8+
export const ar = {
9+
welcome: "اهلا",
10+
home: "الرئيسية",
11+
};

services/serviceName.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// this folder contains any services for the app like api services and other services like react context

stores/nameStore.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// use zustand for lib for state management solution between the app

theme/theme.ts

Whitespace-only changes.

types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// contains app's typescript data types
2+
export type KindOfType = {
3+
id: string;
4+
name: string;
5+
number: number;
6+
}

0 commit comments

Comments
 (0)