Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

app/delivery: add base features #110

Merged
merged 8 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/delivery/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
EXPO_PUBLIC_API_URL=""
EXPO_PUBLIC_GOOGLE_MAPS_APIKEY=""
41 changes: 41 additions & 0 deletions apps/delivery/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli
40 changes: 40 additions & 0 deletions apps/delivery/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"expo": {
"name": "delivery",
"slug": "delivery",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"web": {
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router",
"expo-font"
],
"experiments": {
"typedRoutes": true
}
}
}
158 changes: 158 additions & 0 deletions apps/delivery/app/(app)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
import { useAuth } from "@/hooks/useAuth";
import { DataProvider } from "@/hooks/useData";
import { MaterialIcons } from "@expo/vector-icons";
import { DrawerContentScrollView, DrawerItem } from "@react-navigation/drawer";
import { Image } from "expo-image";
import { useNavigation } from "expo-router";
import { Drawer } from "expo-router/drawer";
import { StyleSheet, Text, View } from "react-native";

export default function Layout() {
return (
// <GestureHandlerRootView style={{ flex: 1 }}>
<DataProvider>
{/* @ts-ignore */}
<Drawer drawerContent={(props) => <DrawerContent {...props} />}>
<Drawer.Screen
name="index"
options={{
drawerLabel: "Home",
drawerIcon: ({ color, size }) => (
<MaterialIcons name="home" {...{ color, size }} />
),
title: "overview",
headerShown: false,
}}
/>
<Drawer.Screen
name="order/[id]"
options={{
drawerLabel: "Order",
drawerIcon: ({ color, size }) => (
<MaterialIcons name="list" {...{ color, size }} />
),
title: "order",
headerShown: false,
}}
/>

<Drawer.Screen
name="settings"
options={{
drawerLabel: "Paramètres",
drawerIcon: ({ color, size }) => (
<MaterialIcons name="settings" {...{ color, size }} />
),
title: "Paramètres",
headerShown: false,
}}
/>
<Drawer.Screen
name="profile"
options={{
drawerLabel: "Profil",
drawerIcon: ({ color, size }) => (
<MaterialIcons name="account-circle" {...{ color, size }} />
),
title: "Profil",
headerShown: false,
}}
/>
</Drawer>
</DataProvider>
// </GestureHandlerRootView>
);
}

function DrawerContent({ ...props }: typeof DrawerContentScrollView) {
const { user, logout } = useAuth();
const navigation = useNavigation() as {
navigate: (href: string, params?: any) => void;
};

return (
<DrawerContentScrollView {...props}>
<View style={styles.drawerContent}>
<View style={styles.userInfoSection}>
<Image
source={require("@/assets/images/tmp/user.png")}
style={{ width: 64, height: 64 }}
/>
<Text style={styles.title}>{user?.firstName}</Text>
{/*<Caption style={styles.caption}>@trensik</Caption>*/}
</View>
<View style={styles.drawerSection}>
<DrawerItem
icon={({ color, size }) => (
<MaterialIcons name="home" {...{ color, size }} />
)}
label="Accueil"
onPress={() => navigation.navigate("index")}
/>
<DrawerItem
icon={({ color, size }) => (
<MaterialIcons name="account-circle" {...{ color, size }} />
)}
label="Profil"
onPress={() => navigation.navigate("profile", { id: user?.id })}
/>
</View>
<View>
<DrawerItem
icon={({ color, size }) => (
<MaterialIcons name="settings" {...{ color, size }} />
)}
label="Paramètres"
onPress={() => navigation.navigate("settings")}
/>
</View>

<View>
<DrawerItem
icon={({ color, size }) => (
<MaterialIcons name="logout" {...{ color, size }} />
)}
label="Se déconnecter"
onPress={() => logout()}
/>
</View>
</View>
</DrawerContentScrollView>
);
}

const styles = StyleSheet.create({
drawerContent: {
flex: 1,
},
userInfoSection: {
paddingLeft: 20,
flexDirection: "column",
},
title: {
marginTop: 20,
fontWeight: "900",
fontSize: 32,
},
caption: {
fontSize: 14,
lineHeight: 14,
},
row: {
marginTop: 20,
flexDirection: "row",
alignItems: "center",
},
section: {
flexDirection: "row",
alignItems: "center",
marginRight: 15,
},
paragraph: {
fontWeight: "bold",
marginRight: 3,
},
drawerSection: {
marginTop: 15,
},
});
Loading
Loading