# Project export: Plates

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: TreeHacks 2024
- Tagline: Plates transforms dining into a social adventure, connecting people through curated local and healthy dining experiences, one plate at a time.
- Devpost: https://devpost.com/software/plates-y3drbe
- GitHub: https://github.com/Edgar-Roman/plates
- Team: 3 GitHub contributor(s) — Kazen Gallman (19 commits), Edgar-Roman (18 commits), alinachou (9 commits)

## Devpost submission (written by the team)

### Overview

Plates is a web-based platform dedicated to enriching lives by bringing people together through the universal language of food. Our mission is to create meaningful social connections by facilitating shared dining experiences that cater to diverse tastes and preferences. By integrating with the Yelp for restaurant selections and using Stripe for identity verification, we prioritize local dining options to support community businesses and promote healthier lifestyles. With every meal, Plates offers an opportunity to discover, connect, and savor, making it more than just a web app—it's a movement towards a more connected, healthful, and vibrant community, one plate at a time.

### Inspiration

The concept of Plates was inspired by a freshmen year tradition at Stanford, where Resident Assistants organized 'Plates' or platonic dates, pairing people within the dorm to foster friendships over coffee or meals. This experience highlighted the power of food in bringing people together, not for romance, but for genuine connections and shared experiences. In today's app-driven world, where the focus often leans towards romantic connections, we saw an opportunity to fill a gap—creating a space for individuals seeking companionship and community through the joy of dining together.

### What it does

Plates connects individuals looking to explore culinary delights with like-minded dining companions. Leveraging the Yelp, users can discover local restaurants and arrange group meals, ensuring a variety of options to suit all tastes. The integration of Stripe ensures identity verification, allowing for peace of mind when attending events. Whether it's a casual brunch or a gourmet dinner, Plates makes organizing and joining dining experiences effortless, fostering a sense of community with every bite.

### How we built it

Plates was developed as a web application using React for the frontend to provide a dynamic and responsive user interface. The backend is powered by Flask, offering a lightweight yet powerful framework for server-side operations. User data and event information are managed through a SQLite database, chosen for its simplicity and reliability. The integration with Yelp API enriches the app with diverse dining options, while Stripe API facilitates secure ID verification and transactions, ensuring user safety and trust.

### Challenges we ran into

A significant challenge we faced was ensuring user safety, particularly when events involve personal interactions. To address this, we implemented ID certification through the Stripe API during registration, adding an extra layer of security and verification. Balancing the social aspect of the app with functionality, such as seamless restaurant bookings and event management, also posed challenges, requiring careful design and integration of third-party APIs.

### Accomplishments we're proud of

We're proud of creating a platform that not only encourages culinary exploration but also emphasizes community building and safety.

### What we learned

Working on Plates has been a transformative experience, deepening our understanding of how technology can facilitate real-world connections and community building. The project taught us the intricacies of crafting engaging user experiences and the importance of thoughtful application design in fostering meaningful social interactions. It highlighted the value of collaboration, bringing together diverse perspectives to overcome challenges and innovate. Through Plates, we've seen firsthand the potential of digital platforms to not only connect people but also to enrich lives through shared culinary adventures, reinforcing our belief in the positive impact technology can have on society.

### What's next

Moving forward, we plan to enhance Plates with features like event rating systemsand more robust community tools to share experiences and reviews. Expanding our restaurant database and exploring partnerships with local eateries for exclusive dining events are also on our roadmap. Our goal is to make Plates a global community that celebrates the art of dining and the joy of connection, one meal at a time.

## README (from the GitHub repository)

**Plates** is a web-based platform dedicated to enriching lives by bringing people together through the universal language of food. Our mission is to create meaningful social connections by facilitating shared dining experiences that cater to diverse tastes and preferences. By integrating with the Yelp for restaurant selections and using Stripe for identity verification, we prioritize local dining options to support community businesses and promote healthier lifestyles. With every meal, Plates offers an opportunity to discover, connect, and savor, making it more than just a web app—it's a movement towards a more connected, healthful, and vibrant community, one plate at a time.


## Detected evidence (automated analysis)

Indexed codebase: 1713 recognized source files, 25433 KB.
- C (language) — detected in the code
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Flask (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (120 of 1915)

```
.DS_Store
.gitignore
algorithm.py
app.py
client/.gitignore
client/package.json
client/public/index.html
client/public/manifest.json
client/public/robots.txt
client/README.md
client/src/App.css
client/src/App.js
client/src/App.test.js
client/src/components/Header.js
client/src/components/IdentitySecure.js
client/src/components/LoginForm.js
client/src/components/LoginLanding.js
client/src/components/OptionsForm.js
client/src/components/PreferencesForm.js
client/src/components/RegistrationForm.js
client/src/components/SchedulerForm.js
client/src/index.css
client/src/index.js
client/src/reportWebVitals.js
client/src/setupTests.js
demofile2.txt
identitySecure.py
instance/.DS_Store
instance/hackathon.db
plates/bin/activate
plates/bin/activate.csh
plates/bin/activate.fish
plates/bin/Activate.ps1
plates/bin/flask
plates/bin/normalizer
plates/bin/pip
plates/bin/pip3
plates/bin/pip3.11
plates/bin/python
plates/bin/python3
plates/bin/python3.11
plates/lib/python3.11/site-packages/_distutils_hack/__init__.py
plates/lib/python3.11/site-packages/_distutils_hack/override.py
plates/lib/python3.11/site-packages/blinker-1.7.0.dist-info/INSTALLER
plates/lib/python3.11/site-packages/blinker-1.7.0.dist-info/LICENSE.rst
plates/lib/python3.11/site-packages/blinker-1.7.0.dist-info/METADATA
plates/lib/python3.11/site-packages/blinker-1.7.0.dist-info/RECORD
plates/lib/python3.11/site-packages/blinker-1.7.0.dist-info/WHEEL
plates/lib/python3.11/site-packages/blinker/__init__.py
plates/lib/python3.11/site-packages/blinker/_saferef.py
plates/lib/python3.11/site-packages/blinker/_utilities.py
plates/lib/python3.11/site-packages/blinker/base.py
plates/lib/python3.11/site-packages/blinker/py.typed
plates/lib/python3.11/site-packages/certifi-2024.2.2.dist-info/INSTALLER
plates/lib/python3.11/site-packages/certifi-2024.2.2.dist-info/LICENSE
plates/lib/python3.11/site-packages/certifi-2024.2.2.dist-info/METADATA
plates/lib/python3.11/site-packages/certifi-2024.2.2.dist-info/RECORD
plates/lib/python3.11/site-packages/certifi-2024.2.2.dist-info/top_level.txt
plates/lib/python3.11/site-packages/certifi-2024.2.2.dist-info/WHEEL
plates/lib/python3.11/site-packages/certifi/__init__.py
plates/lib/python3.11/site-packages/certifi/__main__.py
plates/lib/python3.11/site-packages/certifi/cacert.pem
plates/lib/python3.11/site-packages/certifi/core.py
plates/lib/python3.11/site-packages/certifi/py.typed
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/entry_points.txt
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/INSTALLER
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/LICENSE
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/METADATA
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/RECORD
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/top_level.txt
plates/lib/python3.11/site-packages/charset_normalizer-3.3.2.dist-info/WHEEL
plates/lib/python3.11/site-packages/charset_normalizer/__init__.py
plates/lib/python3.11/site-packages/charset_normalizer/__main__.py
plates/lib/python3.11/site-packages/charset_normalizer/api.py
plates/lib/python3.11/site-packages/charset_normalizer/cd.py
plates/lib/python3.11/site-packages/charset_normalizer/cli/__init__.py
plates/lib/python3.11/site-packages/charset_normalizer/cli/__main__.py
plates/lib/python3.11/site-packages/charset_normalizer/constant.py
plates/lib/python3.11/site-packages/charset_normalizer/legacy.py
plates/lib/python3.11/site-packages/charset_normalizer/md.py
plates/lib/python3.11/site-packages/charset_normalizer/models.py
plates/lib/python3.11/site-packages/charset_normalizer/py.typed
plates/lib/python3.11/site-packages/charset_normalizer/utils.py
plates/lib/python3.11/site-packages/charset_normalizer/version.py
plates/lib/python3.11/site-packages/click-8.1.7.dist-info/INSTALLER
plates/lib/python3.11/site-packages/click-8.1.7.dist-info/LICENSE.rst
plates/lib/python3.11/site-packages/click-8.1.7.dist-info/METADATA
plates/lib/python3.11/site-packages/click-8.1.7.dist-info/RECORD
plates/lib/python3.11/site-packages/click-8.1.7.dist-info/top_level.txt
plates/lib/python3.11/site-packages/click-8.1.7.dist-info/WHEEL
plates/lib/python3.11/site-packages/click/__init__.py
plates/lib/python3.11/site-packages/click/_compat.py
plates/lib/python3.11/site-packages/click/_termui_impl.py
plates/lib/python3.11/site-packages/click/_textwrap.py
plates/lib/python3.11/site-packages/click/_winconsole.py
plates/lib/python3.11/site-packages/click/core.py
plates/lib/python3.11/site-packages/click/decorators.py
plates/lib/python3.11/site-packages/click/exceptions.py
plates/lib/python3.11/site-packages/click/formatting.py
plates/lib/python3.11/site-packages/click/globals.py
plates/lib/python3.11/site-packages/click/parser.py
plates/lib/python3.11/site-packages/click/py.typed
plates/lib/python3.11/site-packages/click/shell_completion.py
plates/lib/python3.11/site-packages/click/termui.py
plates/lib/python3.11/site-packages/click/testing.py
plates/lib/python3.11/site-packages/click/types.py
plates/lib/python3.11/site-packages/click/utils.py
plates/lib/python3.11/site-packages/distutils-precedence.pth
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/INSTALLER
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/LICENSE
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/METADATA
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/RECORD
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/REQUESTED
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/top_level.txt
plates/lib/python3.11/site-packages/Flask_Cors-4.0.0.dist-info/WHEEL
plates/lib/python3.11/site-packages/flask_cors/__init__.py
plates/lib/python3.11/site-packages/flask_cors/core.py
plates/lib/python3.11/site-packages/flask_cors/decorator.py
plates/lib/python3.11/site-packages/flask_cors/extension.py
plates/lib/python3.11/site-packages/flask_cors/version.py
[1795 more files omitted for size]
```

### Dependencies

- client/package.json: @date-io/date-fns@^3.0.0, @emotion/react@^11.11.3, @emotion/styled@^11.11.0, @mui/icons-material@^5.15.10, @mui/material@^5.15.10, @mui/x-date-pickers@^6.19.4, @stripe/react-stripe-js@^2.5.0, @stripe/stripe-js@^3.0.3, @testing-library/jest-dom@^5.17.0, @testing-library/react@^13.4.0, @testing-library/user-event@^13.5.0, date-fns@^3.3.1, dayjs@^1.11.10, react@^18.2.0, react-dom@^18.2.0, react-scripts@5.0.1, web-vitals@^2.1.4

### Recent commits (newest first)

- Merge branch 'master' of https://github.com/Edgar-Roman/plates
- worked on number of people at restaraunts
- Update README.md
- Merge branch 'master' of https://github.com/Edgar-Roman/plates
- schedule button back
- plate pt.2
- Merge remote-tracking branch 'refs/remotes/plates/master'
- plate
- small visual changes
- fixed schedule moving
- no upcoming plates!
- changed flow of website a little bit
- Merge remote-tracking branch 'refs/remotes/plates/master'
- changed user journey
- fixed zero issue
- noice
- added restaurants column
- Merge branch 'master' of https://github.com/Edgar-Roman/plates
- add availability col in db; get availability
- got restaurant database working

## Key source files (fetched from GitHub, selected and truncated for size)

### plates/lib/python3.11/site-packages/idna-3.6.dist-info/LICENSE.md

```markdown
BSD 3-Clause License

Copyright (c) 2013-2023, Kim Davies and contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

```

### plates/lib/python3.11/site-packages/werkzeug/debug/shared/ICON_LICENSE.md

```markdown
Silk icon set 1.3 by Mark James <mjames@gmail.com>

http://www.famfamfam.com/lab/icons/silk/

License: [CC-BY-2.5](https://creativecommons.org/licenses/by/2.5/)
or [CC-BY-3.0](https://creativecommons.org/licenses/by/3.0/)

```

### client/package.json

```
{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@date-io/date-fns": "^3.0.0",
    "@emotion/react": "^11.11.3",
    "@emotion/styled": "^11.11.0",
    "@mui/icons-material": "^5.15.10",
    "@mui/material": "^5.15.10",
    "@mui/x-date-pickers": "^6.19.4",
    "@stripe/react-stripe-js": "^2.5.0",
    "@stripe/stripe-js": "^3.0.3",
    "@testing-library/jest-dom": "^5.17.0",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "date-fns": "^3.3.1",
    "dayjs": "^1.11.10",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

```

### app.py

```python
from datetime import datetime
from flask import Flask, request, jsonify, session
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from werkzeug.security import generate_password_hash, check_password_hash
import requests

API_KEY = 'FmpIZiUz_dOYjUVcMNX62wD1Hvzv-EOLrgcpzlFqKjKl0icOPpzwAyEpksXOGwIyonqKB18SsXetQ2DM12UXAiNsvI4xseFYfzBfF6yxt4vQpApJd5rKS9IvdvfQZXYx'
ENDPOINT = 'https://api.yelp.com/v3/businesses/search'
HEADERS = {'Authorization': 'bearer %s' % API_KEY}

from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user

from flask import Flask, redirect, render_template, jsonify, request, send_from_directory
from sqlalchemy.ext.mutable import MutableList
import json
import stripe
import os
import json

app = Flask(__name__)
CORS(app, supports_credentials=True)
app.config['SECRET_KEY'] = 'your-secret-key'  # Add a secret key for sessions and Flask-Login

stripe.api_version = '2020-08-27'
stripe.api_key = os.getenv('STRIPE_SECRET_KEY')

# Database configuration (using SQLite for simplicity)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///hackathon.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)

login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'

class LocationDetails(db.Model):
    id = db.Column(db.String(300), primary_key=True)
    image = db.Column(db.String(400))
    yelp = db.Column(db.String(400))
    name = db.Column(db.String(100))
    rating = db.Column(db.String(30))
    address = db.Column(db.String(100))

    # def set_location(self, location):
    #     self.location = location

    # def get_pair(self):
    #     return {"location": self.location, "time": self.time}

class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80), unique=True, nullable=False)
    cuisines = db.Column(db.String(300), default="")
    distance = db.Column(db.Integer, default=-1)
    price = db.Column(db.String(100), default="")
    groupSize = db.Column(db.String(100), default="")
    password_hash = db.Column(db.String(128))
    locations = db.Column(db.String(300), default="")
    date = db.Column(db.String(300), default="")
    availability = db.Column(MutableList.as_mutable(db.JSON), default=[])
    completePref = db.Column(db.String(50), default="false") 
    restaurants = db.Column(MutableList.as_mutable(db.JSON), default=[])

    def set_restaurants(self, restaurants):
        self.restaurants = restaurants
        
    def set_password(self, password):
        self.password_hash = generate_password_hash(password)

    def check_password(self, password):
        return check_password_hash(self.password_hash, password)

    def set_preferences(self, data):
        # Adjusted to check and join only if the key exists in data
        self.cuisines = " ".join(data["cuisines"]) if "cuisines" in data else self.cuisines
        self.distance = int(data["distance"]) if "distance" in data else self.distance
        self.price = " ".join(data["price"]) if "price" in data else self.price
        self.groupSize = " ".join(data["groupSize"]) if "groupSize" in data else self.groupSize
        db.session.commit()

    def get_preferences(self):
        return {"cuisines": self.cuisines, "distance": self.distance,
                "price": self.price, "groupSize": self.groupSize}
    
    def add_locationPairs(self, locationPairs):
        self.locations += " " + str(locationPairs)
        db.session.commit()
    
    def delete_locationPairs(self, locationPairs):
        locationList = self.locations.split(" ")
        locationList = list(filter(lambda a: a != locationPairs, self.locations))
        self.locations = " ".join(locationList)
        db.session.commit()
    
    def getLocationPairs(self):
        return self.locations.split(" ")

    def set_date(self, date):
        self.date = date

    def set_availability(self, availability):
        self.availability = availability

    def setCompletePref(self, val):
        self.completePref = val

    def getCompletePref(self):
        return self.completePref

@login_manager.user_loader
def load_user(user_id):
    return User.query.get(int(user_id))

@app.route('/register', methods=['POST'])
def register():
    data = request.get_json()

    if User.query.filter_by(username=data['username']).count() != 0:
        return jsonify({'message': 'Username taken'}), 401

    user = User(username=data['username'])
    user.set_password(data['password'])
    db.session.add(user)
    db.session.commit()
    return jsonify({'message': 'User registered successfully!'}), 200

@app.route('/login', methods=['POST'])
def login():
    data = request.get_json()
    user = User.query.filter_by(username=data['username']).first()
    if user and user.check_password(data['password']):
        login_user(user)
        return jsonify({'message': 'Login successful!'}), 200
    return jsonify({'message': 'Invalid username or password'}), 401

# @app.route('/preferences', methods=['POST'])
# def preferences():
#     data = request.get_json()
#     user = User.query.filter_by(username=data['username']).first()
#     print(data)
#     if user:
#         user.set_preferences(data)
#         db.session.commit()
#         return jsonify({'message': 'Preferences updated successfully'}), 200
#     return jsonify({'message': 'User not found'}), 404

@app.route('/preferences', methods=['GET'])
def get_preferences():
    data = request.get_json()
    user = User.query.filter_by(username=data['username']).first()
    if user:
        return jsonify(user.get_preferences()), 200
    else:
        return jsonify({'message': 'User not found'}), 404

@app.route('/locationChoose', methods=['POST'])
def locationChoose():
    data = request.get_json()

    user = User.query.filter_by(username=data['username']).first()

    user.add_locationPairs(data["id"])
    db.session.commit()
    return jsonif
[truncated — 7496 more characters]
```

### client/src/index.js

```javascript
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

if (typeof window !== 'undefined') {
  window.React = React;
}

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

```

### client/src/App.js

```javascript
import React, { useState } from 'react';
import RegistrationForm from './components/RegistrationForm';
import LoginForm from './components/LoginForm';
import LoginLanding from './components/LoginLanding';
import PreferencesForm from './components/PreferencesForm';
import SchedulerForm from './components/SchedulerForm';
import OptionsForm from './components/OptionsForm';
import { AppBar, Toolbar, Typography, Container, Box, Button, IconButton, createTheme, ThemeProvider } from '@mui/material';
import AccountCircleIcon from '@mui/icons-material/AccountCircle'; // Importing AccountCircle icon

import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import IdentitySecure from './components/IdentitySecure';

const theme = createTheme({
  palette: {
    primary: {
      main: '#ed5f74',
    },
    secondary: {
      main: '#ffab91',
    },
  },
  typography: {
    fontFamily: 'Quicksand, sans-serif',
    h2: {
      fontWeight: 700,
      fontSize: '3.5rem',
    },
  },
});

function App() {
  const [isNewUser, setIsNewUser] = useState(true);
  const [view, setView] = useState('auth');
  const [selectedTime, setSelectedTime] = useState(null);
  const [isLoggedIn, setIsLoggedIn] = useState(false);
  const [selectedOption, setSelectedOption] = useState(null);
  const [username, setUsername] = useState(null);
  const [prefComplete, setPrefComplete] = useState(false);
  const [loginVsRegister, setLoginVsRegister] = useState("");

  const handleAuthSuccess = (lvr) => {
    setIsLoggedIn(true); // Set isLoggedIn to true upon successful authentication

    if (lvr === "login") {
      setView("options");
    } else {
      setView('identity');
    }
  };
  

  const handlePreferencesSubmit = () => setView('options');

  const handleGoToSchedule = () => setView('scheduler');

  const handleSchedulerSubmit = (time) => {
    setSelectedTime(time);
    setPrefComplete("true")
    setView('options');
  };

  const handleOptionsSubmit = (option) => {
    setSelectedOption(option);
    setView('options');
  };

  const handleLoginLandingClick = (clicked) => {
    if (clicked === "matches") {
      setView('options');
    } else if (clicked === "preferences") {
      setView('preferences');
    }
  };

  const handleIconPress = () => {
    if (username !== null) {
      setView("landingLogin");
    }
  };

  const handleIdentitySubmit = () => {
    setView('preferences');
  };

  return (
    <ThemeProvider theme={theme}>
      <LocalizationProvider dateAdapter={AdapterDayjs}>
      <AppBar position="static" color="transparent" elevation={0} sx={{ backdropFilter: 'blur(10px)' }}>
        <Toolbar sx={{ minHeight: '100px', justifyContent: 'flex-start', pt: '20px', pl: '20px' }}>
          <Typography variant="h2" color="primary" noWrap sx={{ flexGrow: 1 }}>
            Plates
          </Typography>
          {isLoggedIn && (
            <IconButton color="primary" onClick={handleIconPress}>
              <AccountCircleIcon fontSize="large"/> {/* Profile icon with primary color */}
            </IconButton>
          )}
        </Toolbar>
      </AppBar>
        <Container component="main" sx={{ display: 'flex', height: 'calc(100vh - 100px)', alignItems: 'center', justifyContent: 'center' }}>
        <Box sx={{
  display: 'flex',
  justifyContent: 'center',
  alignItems: 'center',
  bgcolor: 'background.default',
  p: 5,
  borderRadius: '50%',
  width: 700,
  height: 700,
  boxShadow: '0px 0px 20px rgba(0, 0, 0, 0.15)',
}}>
  <Box sx={{
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    justifyContent: 'center',
    width: '87%',
    height: '87%',
    bgcolor: 'background.paper',
    borderRadius: '50%',
    boxShadow: 'inset 0px 4px 4px rgba(0, 0, 0, 0.1)',
    p: 2, // Added padding inside the inner Box for spacing
  }}>
    {view === 'auth' && (
      <>
        <Typography component="h1" variant="h5" sx={{ mt: 2, mb: 3 }}> {/* Added margin for spacing */}
          {isNewUser ? 'Register' : 'Login'}
        </Typography>
        {isNewUser ? <RegistrationForm onAuthSuccess={handleAuthSuccess} setUsername={setUsername} setLoginVsRegister={setLoginVsRegister}/> : <LoginForm onAuthSuccess={handleAuthSuccess} setUsername={setUsername} setLoginVsRegister={setLoginVsRegister} setPrefComplete={setPrefComplete}/>}
        <Box sx={{ width: '50%', mt: 3 }}> {/* Control the width of the button by wrapping it in a Box */}
          <Button
            fullWidth // Button will fill the width of the Box it's contained within
            variant="outlined"
            onClick={() => setIsNewUser(!isNewUser)}
          >
            {isNewUser ? 'Existing User? Login' : 'New User? Register'}
          </Button>
        </Box>
      </>
    )}
            {view === 'preferences' && <PreferencesForm onSubmit={handlePreferencesSubmit} username={username} setPrefComplete={setPrefComplete}/>}
            {view === 'scheduler' && <SchedulerForm onSubmit={handleSchedulerSubmit} username={username} setPrefComplete={setPrefComplete}/>}
            {view === 'options' && <OptionsForm selectedTime={selectedTime} onSubmit={handleOptionsSubmit} username={username} goToSchedule={handleGoToSchedule}/>}
            {view === 'landingLogin' && <LoginLanding prefComplete={prefComplete} handleLoginLandingClick={handleLoginLandingClick}/>}
            {view === 'identity' && <IdentitySecure username={username} onSubmit={handleIdentitySubmit}/>}
          </Box>
          </Box>
        </Container>
      </LocalizationProvider>
    </ThemeProvider>
  );
}

export default App;
```

### plates/lib/python3.11/site-packages/flask_sqlalchemy/cli.py

```python
from __future__ import annotations

import typing as t

from flask import current_app


def add_models_to_shell() -> dict[str, t.Any]:
    """Registered with :meth:`~flask.Flask.shell_context_processor` if
    ``add_models_to_shell`` is enabled. Adds the ``db`` instance and all model classes
    to ``flask shell``.
    """
    db = current_app.extensions["sqlalchemy"]
    out = {m.class_.__name__: m.class_ for m in db.Model._sa_registry.mappers}
    out["db"] = db
    return out

```

### plates/lib/python3.11/site-packages/pip/_internal/main.py

```python
from typing import List, Optional


def main(args: Optional[List[str]] = None) -> int:
    """This is preserved for old console scripts that may still be referencing
    it.

    For additional details, see https://github.com/pypa/pip/issues/7498.
    """
    from pip._internal.utils.entrypoints import _wrapper

    return _wrapper(args)

```

### plates/lib/python3.11/site-packages/flask/cli.py

```python
from __future__ import annotations

import ast
import collections.abc as cabc
import importlib.metadata
import inspect
import os
import platform
import re
import sys
import traceback
import typing as t
from functools import update_wrapper
from operator import itemgetter
from types import ModuleType

import click
from click.core import ParameterSource
from werkzeug import run_simple
from werkzeug.serving import is_running_from_reloader
from werkzeug.utils import import_string

from .globals import current_app
from .helpers import get_debug_flag
from .helpers import get_load_dotenv

if t.TYPE_CHECKING:
    import ssl

    from _typeshed.wsgi import StartResponse
    from _typeshed.wsgi import WSGIApplication
    from _typeshed.wsgi import WSGIEnvironment

    from .app import Flask


class NoAppException(click.UsageError):
    """Raised if an application cannot be found or loaded."""


def find_best_app(module: ModuleType) -> Flask:
    """Given a module instance this tries to find the best possible
    application in the module or raises an exception.
    """
    from . import Flask

    # Search for the most common names first.
    for attr_name in ("app", "application"):
        app = getattr(module, attr_name, None)

        if isinstance(app, Flask):
            return app

    # Otherwise find the only object that is a Flask instance.
    matches = [v for v in module.__dict__.values() if isinstance(v, Flask)]

    if len(matches) == 1:
        return matches[0]
    elif len(matches) > 1:
        raise NoAppException(
            "Detected multiple Flask applications in module"
            f" '{module.__name__}'. Use '{module.__name__}:name'"
            " to specify the correct one."
        )

    # Search for app factory functions.
    for attr_name in ("create_app", "make_app"):
        app_factory = getattr(module, attr_name, None)

        if inspect.isfunction(app_factory):
            try:
                app = app_factory()

                if isinstance(app, Flask):
                    return app
            except TypeError as e:
                if not _called_with_wrong_args(app_factory):
                    raise

                raise NoAppException(
                    f"Detected factory '{attr_name}' in module '{module.__name__}',"
                    " but could not call it without arguments. Use"
                    f" '{module.__name__}:{attr_name}(args)'"
                    " to specify arguments."
                ) from e

    raise NoAppException(
        "Failed to find Flask application or factory in module"
        f" '{module.__name__}'. Use '{module.__name__}:name'"
        " to specify one."
    )


def _called_with_wrong_args(f: t.Callable[..., Flask]) -> bool:
    """Check whether calling a function raised a ``TypeError`` because
    the call failed or because something in the factory raised the
    error.

    :param f: The function that was called.
    :return: ``True`` if the call failed.
    """
    tb = sys.exc_info()[2]

    try:
        while tb is not None:
            if tb.tb_frame.f_code is f.__code__:
                # In the function, it was called successfully.
                return False

            tb = tb.tb_next

        # Didn't reach the function.
        return True
    finally:
        # Delete tb to break a circular reference.
        # https://docs.python.org/2/library/sys.html#sys.exc_info
        del tb


def find_app_by_string(module: ModuleType, app_name: str) -> Flask:
    """Check if the given string is a variable name or a function. Call
    a function to get the app instance, or return the variable directly.
    """
    from . import Flask

    # Parse app_name as a single expression to determine if it's a valid
    # attribute name or function call.
    try:
        expr = ast.parse(app_name.strip(), mode="eval").body
    except SyntaxError:
        raise NoAppException(
            f"Failed to parse {app_name!r} as an attribute name or function call."
        ) from None

    if isinstance(expr, ast.Name):
        name = expr.id
        args = []
        kwargs = {}
    elif isinstance(expr, ast.Call):
        # Ensure the function name is an attribute name only.
        if not isinstance(expr.func, ast.Name):
            raise NoAppException(
                f"Function reference must be a simple name: {app_name!r}."
            )

        name = expr.func.id

        # Parse the positional and keyword arguments as literals.
        try:
            args = [ast.literal_eval(arg) for arg in expr.args]
            kwargs = {
                kw.arg: ast.literal_eval(kw.value)
                for kw in expr.keywords
                if kw.arg is not None
            }
        except ValueError:
            # literal_eval gives cryptic error messages, show a generic
            # message with the full expression instead.
            raise NoAppException(
                f"Failed to parse arguments as literal values: {app_name!r}."
            ) from None
    else:
        raise NoAppException(
            f"Failed to parse {app_name!r} as an attribute name or function call."
        )

    try:
        attr = getattr(module, name)
    except AttributeError as e:
        raise NoAppException(
            f"Failed to find attribute {name!r} in {module.__name__!r}."
        ) from e

    # If the attribute is a function, call it with any args and kwargs
    # to get the real application.
    if inspect.isfunction(attr):
        try:
            app = attr(*args, **kwargs)
        except TypeError as e:
            if not _called_with_wrong_args(attr):
                raise

            raise NoAppException(
                f"The factory {app_name!r} in module"
                f" {module.__name__!r} could not be called with the"
                " specified arguments."
            ) from e
    else:
        app = attr

    if isinstance(app, Flask):
        return app

    raise NoAppException(
        "A valid Flask application 
[truncated — 29833 more characters]
```

### plates/lib/python3.11/site-packages/pip/_internal/models/index.py

```python
import urllib.parse


class PackageIndex:
    """Represents a Package Index and provides easier access to endpoints"""

    __slots__ = ["url", "netloc", "simple_url", "pypi_url", "file_storage_domain"]

    def __init__(self, url: str, file_storage_domain: str) -> None:
        super().__init__()
        self.url = url
        self.netloc = urllib.parse.urlsplit(url).netloc
        self.simple_url = self._url_for_path("simple")
        self.pypi_url = self._url_for_path("pypi")

        # This is part of a temporary hack used to block installs of PyPI
        # packages which depend on external urls only necessary until PyPI can
        # block such packages themselves
        self.file_storage_domain = file_storage_domain

    def _url_for_path(self, path: str) -> str:
        return urllib.parse.urljoin(self.url, path)


PyPI = PackageIndex("https://pypi.org/", file_storage_domain="files.pythonhosted.org")
TestPyPI = PackageIndex(
    "https://test.pypi.org/", file_storage_domain="test-files.pythonhosted.org"
)

```

[1558 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]