diff --git a/frontend/app/(app)/(tabs)/_layout.js b/frontend/app/(app)/(tabs)/_layout.js
index 43cdec3..be70c82 100644
--- a/frontend/app/(app)/(tabs)/_layout.js
+++ b/frontend/app/(app)/(tabs)/_layout.js
@@ -20,7 +20,7 @@ export default function TabLayout() {
backgroundColor: colors.darkSecondary,
},
tabBarActiveTintColor: colors.gold,
- headerShown: false,
+ headerShown: true,
}}
sceneContainerStyle={{ backgroundColor: colors.dark }}
>
@@ -62,7 +62,10 @@ export default function TabLayout() {
/>
{/* Hide following routes from bottom bar */}
-
+
);
diff --git a/frontend/app/(app)/(tabs)/beer/add.js b/frontend/app/(app)/(tabs)/beer/add.js
index 85a6822..5fcb041 100644
--- a/frontend/app/(app)/(tabs)/beer/add.js
+++ b/frontend/app/(app)/(tabs)/beer/add.js
@@ -1,10 +1,86 @@
-import { View } from "react-native";
-import Text from "@components/Text";
+import { StyleSheet, TextInput, View } from "react-native";
+import { useState } from "react";
+import Button from "@components/Button";
+import { colors } from "@components/style";
export default function BeerAdd() {
+ const [b_name, setBName] = useState("");
+ const [b_degree, setBDegree] = useState("");
+ const [b_packaging, setBPackaging] = useState("");
+ const [b_brand, setBBrand] = useState("");
+
+ async function addBeer() {
+ // TODO: after the request - redirect to /beer/{new_beer_id}?; plus some modal about successful state
+ const req = await fetch(`${process.env.EXPO_PUBLIC_API_URL}/beer/add`, {
+ method: "POST",
+ credentials: "include",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ brand: b_brand,
+ name: b_name,
+ degree: b_degree,
+ packaging: b_packaging,
+ photos: null,
+ }),
+ });
+ const res = await req.json();
+ }
+
return (
-
- Beer Add
+
+
+ setBName(text)}
+ placeholderTextColor="#aaaaaa"
+ />
+ setBBrand(text)}
+ placeholderTextColor="#aaaaaa"
+ />
+ setBDegree(text)}
+ placeholderTextColor="#aaaaaa"
+ />
+ setBPackaging(text)}
+ placeholderTextColor="#aaaaaa"
+ />
+
+
);
}
+
+const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ },
+ form: {
+ flex: 1,
+ alignItems: "center",
+ paddingTop: "10%",
+ gap: 15,
+ },
+ input: {},
+ input: {
+ height: "auto",
+ width: "60%",
+ borderColor: "gray",
+ borderWidth: 1,
+ borderRadius: 5,
+ padding: 10,
+ color: "#fff",
+ },
+});
diff --git a/frontend/app/(app)/(tabs)/beer/index.js b/frontend/app/(app)/(tabs)/beer/index.js
index 0b2176a..06399c8 100644
--- a/frontend/app/(app)/(tabs)/beer/index.js
+++ b/frontend/app/(app)/(tabs)/beer/index.js
@@ -1,21 +1,74 @@
-import { View } from "react-native";
+import { StyleSheet, View, FlatList } from "react-native";
import Text from "@components/Text";
import Button from "@components/Button";
import { colors } from "@components/style";
import { router } from "expo-router";
+import { useEffect, useState } from "react";
export default function Tab() {
- return (
-
- Tab BEER
+ const [data, setData] = useState([]);
+ useEffect(() => {
+ fetchData();
+ }, []);
+ async function fetchData() {
+ try {
+ const res = await fetch(`${process.env.EXPO_PUBLIC_API_URL}/beer/get`, {
+ method: "GET",
+ credentials: "include",
+ });
+ const data = await res.json();
+ setData(data.data);
+ } catch (err) {
+ console.error(err);
+ alert("Something went wrong");
+ }
+ }
+
+ return (
+
);
}
+
+export const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ justifyContent: "center",
+ alignItems: "center",
+ marginTop: "5%",
+ },
+ beerList: {
+ width: "100%",
+ paddingHorizontal: "15%",
+ marginTop: "5%",
+ },
+ item: {
+ borderColor: "gray",
+ borderWidth: 1,
+ borderRadius: 10,
+ padding: 13,
+ marginBottom: "5%",
+ },
+});
diff --git a/frontend/app/(app)/_layout.js b/frontend/app/(app)/_layout.js
index 3d37098..f859ea2 100644
--- a/frontend/app/(app)/_layout.js
+++ b/frontend/app/(app)/_layout.js
@@ -1,7 +1,6 @@
import { Redirect, Stack, Slot } from "expo-router";
import { useAuth } from "@context/AuthContext";
import { View, Text, StyleSheet } from "react-native";
-import { StatusBar } from "expo-status-bar";
export default function AppLayout() {
const { authState } = useAuth();
@@ -14,10 +13,12 @@ export default function AppLayout() {
);
}
+
if (!authState.authenticated) {
console.log("get the fuck out");
return ;
}
+
return (