Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History Page and Change from Expo Router to React Stack Navigation #85

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ source/backend/receipt_parsing.ipynb
app.log
receiptplusenv/
__pycache__
.pyc
*.pyc
*.cpython*
Binary file modified source/backend/__pycache__/config.cpython-312.pyc
Binary file not shown.
113 changes: 106 additions & 7 deletions source/backend/call_api_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -37,7 +37,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand All @@ -48,7 +48,7 @@
"{\n",
" \"message\": \"Togekiss logged in successfully.\"\n",
"}\n",
"<RequestsCookieJar[<Cookie session=.eJwlzjsOwjAMANC7ZGbIz3Hcc7BXdmxDxYDU0An17lRiefP7htV3m8-wfPbDbmHdNCwheRKu0TJkvnTvmRScmUttLUoGbVw0qZReB4sOQkPEZpl7Q4BCCRhYxTtmcncSGZQIpREMMEct0FOP5nUo4SgNYx85cgSrFK7IMW3_b-7vh722OcP5A2ymMv0.ZsjZ5w.jXekCTDa3xl0J-lBeQTxrNDOEHY for 127.0.0.1/>]>\n"
"<RequestsCookieJar[<Cookie session=.eJwlzjsOwjAMANC7ZGbIz3Hcc7BXdmxDxYDU0An17lRiefP7htV3m8-wfPbDbmHdNCwheRKu0TJkvnTvmRScmUttLUoGbVw0qZReB4sOQkPEZpl7Q4BCCRhYxTtmcncSGZQIpREMMEct0FOP5nUo4SgNYx85cgSrFK7IMW3_b-7vh722OcP5A2ymMv0.ZtDneA.tW2hxua77GLVohpI5IKt7Kg3xcw for 127.0.0.1/>]>\n"
]
}
],
Expand Down Expand Up @@ -134,7 +134,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -145,7 +145,7 @@
"{\n",
" \"message\": \"Togekiss logged in successfully.\"\n",
"}\n",
"<RequestsCookieJar[<Cookie session=.eJwlzjEOwjAMQNG7ZGaIHdeOew52lMQ2VAxILZ0QdycS89OX_ifdYvfjkdb3fvol3TZLayLskCkyj8agS1ciZ5JaW3SRilBcaywcylhY1B0CbSh3YpxdVSM07FlYDEaZ2rgheORCZarlHCWYu4K1jgKOjiS2aCvNRpoj5-H7_-b6uvtzO470_QGoMzGk.ZsjdAQ.3wC0wLatrECDJzKWAJeFDLemcUI for receiptplus.pythonanywhere.com/>]>\n"
"<RequestsCookieJar[<Cookie session=.eJwlzjEOwjAMQNG7ZGaIHdeOew52lMQ2VAxILZ0QdycS89OX_ifdYvfjkdb3fvol3TZLayLskCkyj8agS1ciZ5JaW3SRilBcaywcylhY1B0CbSh3YpxdVSM07FlYDEaZ2rgheORCZarlHCWYu4K1jgKOjiS2aCvNRpoj5-H7_-b6uvtzO470_QGoMzGk.ZtDj0w.1PntknUAbLUJdrKRMHO61pXH9iM for receiptplus.pythonanywhere.com/>]>\n"
]
}
],
Expand Down Expand Up @@ -271,7 +271,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -446,7 +446,106 @@
" response = requests.post(url, files=files, cookies = session_cookie)\n",
"\n",
"print('Response code: ' + str(response.status_code))\n",
"print(json.dumps(response.json(), indent=4))\n"
"print(json.dumps(response.json(), indent=4))\n",
"# print(response.json().keys())\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'location': '2746 NE 45th Street',\n",
" 'purchases': [{'name': 'TWIN BROOK MILK', 'price': 6.99, 'quantity': 1.0},\n",
" {'name': 'BTI DEPOSIT', 'price': 2.15, 'quantity': 1.0},\n",
" {'name': 'PROG SOUP', 'price': 1.49, 'quantity': 1.0},\n",
" {'name': 'PROGRESSO SOUP', 'price': 1.49, 'quantity': 1.0},\n",
" {'name': 'NEXCARE TAPE', 'price': 6.49, 'quantity': 1.0},\n",
" {'name': 'DAVES KILLER BREADQA', 'price': 4.99, 'quantity': 1.0},\n",
" {'name': 'GRAPES BLACK', 'price': 3.49, 'quantity': 2.33},\n",
" {'name': 'GRAPES BLACK', 'price': 3.49, 'quantity': 1.75},\n",
" {'name': 'EGGPLANT', 'price': 2.89, 'quantity': 1.0},\n",
" {'name': 'NAVELS CA', 'price': 1.99, 'quantity': 3.66},\n",
" {'name': 'DRIS STRWBRY', 'price': 7.99, 'quantity': 1.0},\n",
" {'name': 'GREEN BEANS', 'price': 2.99, 'quantity': 1.0},\n",
" {'name': 'ROMA TOMATO', 'price': 1.99, 'quantity': 1.58},\n",
" {'name': 'EGGPLANT', 'price': 2.89, 'quantity': 1.0},\n",
" {'name': 'BARTLETT ORG QA', 'price': 1.99, 'quantity': 3.64},\n",
" {'name': 'AVOCADO HASS', 'price': 2.99, 'quantity': 1.0},\n",
" {'name': 'CALB CRUNCHY LOOPS<+', 'price': 1.99, 'quantity': 1.0},\n",
" {'name': 'CALB LENTIL SNAPS <+', 'price': 1.99, 'quantity': 1.0},\n",
" {'name': 'CALB LENTIL SNAPS <t', 'price': 1.99, 'quantity': 1.0},\n",
" {'name': 'CALB CRUNCHY LOOPS<+', 'price': 1.99, 'quantity': 1.0},\n",
" {'name': 'TLMK SNCKNG CHEESEQA', 'price': 4.99, 'quantity': 1.0},\n",
" {'name': 'NTSW TOMATOES', 'price': 4.99, 'quantity': 1.0},\n",
" {'name': 'RASPBERRIES RED QA', 'price': 2.99, 'quantity': 1.0},\n",
" {'name': 'BANANAS', 'price': 0.69, 'quantity': 2.75},\n",
" {'name': 'BANA BAKING', 'price': 0.49, 'quantity': 3.82},\n",
" {'name': 'SIMPLE TRUTH EGGS', 'price': 5.49, 'quantity': 1.0},\n",
" {'name': 'CELSSN ICE TEA', 'price': 4.99, 'quantity': 1.0},\n",
" {'name': 'BROCCOL CROWNS', 'price': 2.99, 'quantity': 1.28}],\n",
" 'receipt_date': '10/21/23',\n",
" 'store': 'jobs.qfc.com',\n",
" 'total': 119.31}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"receipt"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Response code: 500\n",
"{\n",
" \"error\": \"An unexpected error occurred\"\n",
"}\n"
]
}
],
"source": [
"url = 'https://receiptplus.pythonanywhere.com/api/receipts'\n",
"# url = 'http://127.0.0.1:5000/api/receipts'\n",
"receipt = response.json()\n",
"# seesion_cookie = ''\n",
"response = requests.post(url, json=receipt, cookies = session_cookie)\n",
"print('Response code: ' + str(response.status_code))\n",
"print(json.dumps(response.json(), indent=4))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-10-21 00:00:00\n"
]
}
],
"source": [
"from datetime import datetime\n",
"\n",
"date_str = '10/21/23'\n",
"date_obj = datetime.strptime(date_str, '%m/%d/%y')\n",
"print(date_obj)"
]
},
{
Expand Down
Binary file modified source/backend/model/__pycache__/receipt.cpython-312.pyc
Binary file not shown.
Binary file modified source/backend/model/__pycache__/user.cpython-312.pyc
Binary file not shown.
11 changes: 11 additions & 0 deletions source/frontend/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import AuthStackNavigator from "./app/AuthStackNavigator";

export default function App() {
return (
<NavigationContainer>
<AuthStackNavigator />
</NavigationContainer>
);
}
4 changes: 1 addition & 3 deletions source/frontend/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"plugins": [
"expo-router"
],
"plugins": ["expo-router"],
"experiments": {
"typedRoutes": true
}
Expand Down
24 changes: 0 additions & 24 deletions source/frontend/app/(tabs)/AccountTab.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions source/frontend/app/(tabs)/HistoryTab.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions source/frontend/app/(tabs)/PriceWatchTab.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions source/frontend/app/(tabs)/SummaryTab.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions source/frontend/app/(tabs)/UserValidTab.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions source/frontend/app/(tabs)/_layout.tsx

This file was deleted.

24 changes: 24 additions & 0 deletions source/frontend/app/AuthStackNavigator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { SignUp } from "@/pages/signup";
import { Login } from "@/pages/login";
import { NavigationContainer } from "@react-navigation/native";
import MyTabs from "./MainNavigator";
import StartPage from "@/pages/startpage";

const AuthStack = createStackNavigator();
function AuthStackNavigator() {
return (
<AuthStack.Navigator
initialRouteName="StartPage"
screenOptions={{ headerShown: false }}
>
<AuthStack.Screen name="StartPage" component={StartPage} />
<AuthStack.Screen name="SignUp" component={SignUp} />
<AuthStack.Screen name="Login" component={Login} />
<AuthStack.Screen name="Main" component={MyTabs} />
</AuthStack.Navigator>
);
}

export default AuthStackNavigator;
Loading
Loading