-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* query refactor for now * update yml files * made backend a submodule * sync for backend * seperate frontend and backend * query functionality v1 * fix query form * add request schema * cleanup schema & add command to readme * add go to next page from query & use user id, refactor ngram page * add save query button & post request to backend * query page styling * remove footed & add logic for loading saved queries * ngram page cleanup & save & load * upload saved query * added user login & dynamic loading of specific users saved queries. Also scrapped nav and put all content on landing page * display and save query * added back removed query params * update query to be posts or comments or both * refator query + ngram page for styling purposes * ngram save and display buttons * ngram viz force graph * successful v1 of ngram ts viz!! * ngram visualizations are at a good stopping point for now, will now focus on group ngram divergence visualizations * remove saving and loading logic * added group allotax selection & group search functionality, TODO : ALLOTAX BEE SWARM PLOTS * allotax viz & plots v1 * update lock file * update actions * delete unused pages * fix linting bugs * refactor to have sessionID instead of sessionStorage data, deployment still not working * fuggetaboutit i got it to work * test for updated backend ip * update port
- Loading branch information
Showing
27 changed files
with
23,651 additions
and
1,435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "babycenter-backend"] | ||
path = babycenter-backend | ||
url = https://github.com/Jayman391/babycenter-backend.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1 @@ | ||
<p align="center"> | ||
<a href="https://nextjs-flask-starter.vercel.app/"> | ||
<img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> | ||
<h3 align="center">Next.js Flask Starter</h3> | ||
</a> | ||
</p> | ||
|
||
<p align="center">Simple Next.js boilerplate that uses <a href="https://flask.palletsprojects.com/">Flask</a> as the API backend.</p> | ||
|
||
<br/> | ||
|
||
## Introduction | ||
|
||
This is a hybrid Next.js + Python app that uses Next.js as the frontend and Flask as the API backend. One great use case of this is to write Next.js apps that use Python AI libraries on the backend. | ||
|
||
## How It Works | ||
|
||
The Python/Flask server is mapped into to Next.js app under `/api/`. | ||
|
||
This is implemented using [`next.config.js` rewrites](https://github.com/vercel/examples/blob/main/python/nextjs-flask/next.config.js) to map any request to `/api/:path*` to the Flask API, which is hosted in the `/api` folder. | ||
|
||
On localhost, the rewrite will be made to the `127.0.0.1:5328` port, which is where the Flask server is running. | ||
|
||
In production, the Flask server is hosted as [Python serverless functions](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/python) on Vercel. | ||
|
||
## Demo | ||
|
||
https://nextjs-flask-starter.vercel.app/ | ||
|
||
## Deploy Your Own | ||
|
||
You can clone & deploy it to Vercel with one click: | ||
|
||
[](https://vercel.com/new/clone?demo-title=Next.js%20Flask%20Starter&demo-description=Simple%20Next.js%20boilerplate%20that%20uses%20Flask%20as%20the%20API%20backend.&demo-url=https%3A%2F%2Fnextjs-flask-starter.vercel.app%2F&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F795TzKM3irWu6KBCUPpPz%2F44e0c6622097b1eea9b48f732bf75d08%2FCleanShot_2023-05-23_at_12.02.15.png&project-name=Next.js%20Flask%20Starter&repository-name=nextjs-flask-starter&repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fpython%2Fnextjs-flask&from=vercel-examples-repo) | ||
|
||
## Developing Locally | ||
|
||
You can clone & create this repo with the following command | ||
|
||
```bash | ||
npx create-next-app nextjs-flask --example "https://github.com/vercel/examples/tree/main/python/nextjs-flask" | ||
``` | ||
|
||
## Getting Started | ||
|
||
First, install the dependencies: | ||
|
||
```bash | ||
npm install | ||
# or | ||
yarn | ||
# or | ||
pnpm install | ||
``` | ||
|
||
Then, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
The Flask server will be running on [http://127.0.0.1:5328](http://127.0.0.1:5328) – feel free to change the port in `package.json` (you'll also need to update it in `next.config.js`). | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
- [Flask Documentation](https://flask.palletsprojects.com/en/1.1.x/) - learn about Flask features and API. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
npx @openapitools/openapi-generator-cli generate -i requestSchema.yaml -g ruby -o babycenter-frontend |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React, { useState, useRef, useEffect } from 'react'; | ||
|
||
interface CustomSelectProps { | ||
options: { value: string; label: string }[]; | ||
selectedValue: string; | ||
onChange: (value: string) => void; | ||
placeholder?: string; | ||
} | ||
|
||
export const CustomSelect: React.FC<CustomSelectProps> = ({ | ||
options, | ||
selectedValue, | ||
onChange, | ||
placeholder = '-- Select an Option --', | ||
}) => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
const ref = useRef<HTMLDivElement>(null); | ||
|
||
const handleOptionClick = (value: string) => { | ||
onChange(value); | ||
setIsOpen(false); | ||
}; | ||
|
||
// Close the dropdown when clicking outside | ||
useEffect(() => { | ||
const handleClickOutside = (event: MouseEvent) => { | ||
if (ref.current && !ref.current.contains(event.target as Node)) { | ||
setIsOpen(false); | ||
} | ||
}; | ||
document.addEventListener('mousedown', handleClickOutside); | ||
return () => { | ||
document.removeEventListener('mousedown', handleClickOutside); | ||
}; | ||
}, []); | ||
|
||
const selectedLabel = | ||
options.find((option) => option.value === selectedValue)?.label || placeholder; | ||
|
||
return ( | ||
<div className="custom-select" ref={ref}> | ||
<div className="custom-select__selected" onClick={() => setIsOpen(!isOpen)}> | ||
{selectedLabel} | ||
<span className="custom-select__arrow">▾</span> | ||
</div> | ||
{isOpen && ( | ||
<ul className="custom-select__options"> | ||
{options.map((option) => ( | ||
<li | ||
key={option.value} | ||
className="custom-select__option" | ||
onClick={() => handleOptionClick(option.value)} | ||
> | ||
{option.label} | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
|
||
<style jsx>{` | ||
.custom-select { | ||
position: relative; | ||
width: 100%; | ||
} | ||
.custom-select__selected { | ||
padding: 8px; | ||
border: 1px solid #ccc; | ||
border-radius: 3px; | ||
background-color: #fff; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
color: black; | ||
} | ||
.custom-select__arrow { | ||
margin-left: 10px; | ||
} | ||
.custom-select__options { | ||
position: absolute; | ||
width: 100%; | ||
max-height: 200px; | ||
overflow-y: auto; | ||
border: 1px solid #ccc; | ||
border-radius: 3px; | ||
background-color: #fff; | ||
z-index: 1000; | ||
margin-top: 5px; | ||
} | ||
.custom-select__option { | ||
padding: 8px; | ||
cursor: pointer; | ||
color: black; | ||
} | ||
.custom-select__option:hover { | ||
background-color: #f1f1f1; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// app/config.ts | ||
|
||
export const BACKEND_IP = "http://127.0.0.1:5328"; | ||
export const BACKEND_IP = "http://0.0.0.0:8000"; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.