Skip to content
Open
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified back_end/django_server/db.sqlite3
Binary file not shown.
Binary file not shown.
Binary file modified back_end/django_server/main/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file modified back_end/django_server/main/__pycache__/apps.cpython-310.pyc
Binary file not shown.
Binary file modified back_end/django_server/main/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified back_end/django_server/main/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file modified back_end/django_server/main/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
134 changes: 134 additions & 0 deletions front_end/rice-eats/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions front_end/rice-eats/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.4",
"react-router": "^6.4.0",
"react-router-dom": "^6.4.1",
"react-scripts": "^5.0.1",
Expand Down
4 changes: 3 additions & 1 deletion front_end/rice-eats/src/components/MealPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { getCurrentMeal, getMealString1, getMealString2, getNextMeal, getPrevMea

export default function MealPicker(props) {
// TODO: make this do something lol
const [dateMeal, setDateMeal] = useState(getCurrentMeal());
const dateMeal = props.dateMeal;
const setDateMeal = props.setDateMeal;
// const [dateMeal, setDateMeal] = useState(getCurrentMeal());
const [mealString1, setMealString1] = useState("Friday, Dinner");
const [mealString2, setMealString2] = useState("5:30 PM - 7:30 PM");

Expand Down
3 changes: 2 additions & 1 deletion front_end/rice-eats/src/components/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ export default function Text(props) {
const white = props.white ?? false;
const bold = props.bold ?? false;
const large = props.large ?? false;
const customFontSize = props.customFontSize ?? 16;

return (
<div style={{
fontWeight: bold ? "bold" : "normal",
fontSize: large ? 28 : 16,
fontSize: large ? 28 : customFontSize,
color: white ? "white" : "black",
display: "flex",
alignItems: "center"
Expand Down
4 changes: 3 additions & 1 deletion front_end/rice-eats/src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const serveryMapUrl = {
"North": "https://www.google.com/maps/place/North+Servery/@29.7219006,-95.3987426,17z/data=!3m1!4b1!4m5!3m4!1s0x8640c07f1d54ac13:0x566bbb6a63a6711d!8m2!3d29.7218276!4d-95.3963882",
"Seibel": "https://www.google.com/maps/place/Abe+and+Annie+Seibel+Servery/@29.7160065,-95.4006022,17z/data=!3m1!4b1!4m5!3m4!1s0x8640c079900c3119:0x73956ef64083be12!8m2!3d29.7160065!4d-95.3984135",
"Baker": "https://www.google.com/maps/place/Baker+College/@29.7172288,-95.4011985,17z/data=!3m1!4b1!4m5!3m4!1s0x8640c192b6342669:0x318e651a70c32638!8m2!3d29.7172288!4d-95.3990098"
}
};

export const backendUrl = "localhost:8000"; //https://rice-eats-backend.herokuapp.com

export const serveryColor = {
"South": "rgb(58, 64, 90)",
Expand Down
5 changes: 5 additions & 0 deletions front_end/rice-eats/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import NorthDetails from './pages/NorthDetails';
import WestDetails from './pages/WestDetails';
import SeibelDetails from './pages/SeibelDetails';
import BakerDetails from './pages/BakerDetails';
import ErrorPage from './pages/ErrorPage';

const router = createBrowserRouter([
{
Expand All @@ -43,6 +44,10 @@ const router = createBrowserRouter([
path: serveryUrl.Baker,
element: <BakerDetails />,
},
{
path: "*",
element: <ErrorPage />,
}
]);

const root = ReactDOM.createRoot(document.getElementById('root'));
Expand Down
18 changes: 18 additions & 0 deletions front_end/rice-eats/src/pages/ErrorPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import Button from "../components/Button";
import Text from "../components/Text";
import { useNavigate } from "react-router-dom";

export default function ErrorPage() {
const navigate = useNavigate();
const onButtonClick = () => {
navigate("/");
};
return (
<div style={{display: "flex", flexDirection: "column", alignItems: "center", height: "100vh", alignContent: "center"}}>
<Text customFontSize={120}><i class="bi bi-exclamation-triangle"/></Text>
<Text>Uh Oh! It looks like our website broke :(</Text>
<Button onClick={onButtonClick}>Return to home</Button>
</div>
)
}
9 changes: 6 additions & 3 deletions front_end/rice-eats/src/pages/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState,useEffect } from 'react';

import { serveryName, serveryUrl, serveryMapUrl, getOrderedServeryList, setOrderedServeryList, getScreenSize } from '../config/config';
import { realRetrieveMenus, RetrieveMenus } from '../utils/APICalls';
import { getCurrentMeal } from '../utils/Meals';

import ServeryCard from '../components/ServeryCard';
import TopBar from '../components/TopBar';
Expand All @@ -10,7 +11,10 @@ import MealPicker from '../components/MealPicker';
export default function LandingPage() {
const [menus, setMenus] = useState(RetrieveMenus());
const [serveries, setServeries] = useState(getOrderedServeryList());
useEffect(() => realRetrieveMenus((response) => setMenus(response.data)), [setMenus]);
const [dateMeal, setDateMeal] = useState(getCurrentMeal());
console.log(dateMeal[0]);
console.log(dateMeal[1]);
useEffect(() => realRetrieveMenus((response) => setMenus(response.data), dateMeal[0], dateMeal[1]), [setMenus, dateMeal]);
// PostReview();

const moveServeryToTop = (serveryName) => {
Expand All @@ -20,7 +24,6 @@ export default function LandingPage() {
setServeries(newServeries);
setOrderedServeryList(newServeries);
};

const screenSize = getScreenSize();
const gridTemplateColumns = screenSize === "large" ? "1fr 1fr 1fr" : screenSize === "medium" ? "1fr 1fr" : "1fr";

Expand All @@ -34,7 +37,7 @@ export default function LandingPage() {
</div>

<div style={{marginBottom: 30}}>
<MealPicker />
<MealPicker dateMeal={dateMeal} setDateMeal={setDateMeal} />
</div>

<div style={{
Expand Down
18 changes: 11 additions & 7 deletions front_end/rice-eats/src/utils/APICalls.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import axios from "axios";
import { backendUrl } from "../config/config";

export function PostReview() {
axios.post("http://127.0.0.1:8000/submitreview", {
axios.post(backendUrl + "/submitreview", {
serveryName: "South",
date: "2022-10-05",
mealType: "Breakfast",
Expand All @@ -20,14 +21,17 @@ export function PostReview() {
});
}

export function realRetrieveMenus(func) {
axios.post("http://localhost:8000/serverymenus",
// "{'hi': 'bye'}"
export function realRetrieveMenus(func, date, mealType) {
const realDate = date.substring(2);
axios.post(backendUrl + "/serverymenus",
{
date: "22-10-01",
mealType: "Dinner"
date: realDate,
mealType: mealType
}
, {'Content-Type': 'application/json'}).then(func);
, {'Content-Type': 'application/json'}).then((data) => {
console.log(data);
func(data);
});
}

export function RetrieveMenus() {
Expand Down
4 changes: 2 additions & 2 deletions front_end/rice-eats/src/utils/Meals.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ export const getNextMeal = (date, mealType) => {
const d = createDateFromDateString(date);
const newD = addDays(d, 1);
const dateString = newD.toISOString().split('T')[0];
return [dateString, "Breakfast"];
return [dateString, "Lunch"];
}
};

export const getPrevMeal = (date, mealType) => {
if (mealType === "Breakfast") {
if (mealType === "Lunch") {
const d = createDateFromDateString(date);
const newD = subDays(d, 1);
const dateString = newD.toISOString().split('T')[0];
Expand Down