Merge frontend into the full-stack dev branch#34
Merge frontend into the full-stack dev branch#34xenoblade246 merged 7 commits intofeat/full-stackfrom
Conversation
the second page seems to still be completely empty
There was a problem hiding this comment.
Summary of Changes
Hello @ThePrunerator, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request represents a significant step towards a full-stack application by merging a newly developed React frontend with a Python FastAPI backend. The changes establish the core infrastructure for serving the frontend via FastAPI and introduce dummy API endpoints to support initial frontend functionality like file uploads and transcription display, setting the stage for further development.
Highlights
- Frontend-Backend Integration: The pull request integrates a new React-based frontend application with a Python FastAPI backend. The FastAPI application now serves the React build's static files, establishing a full-stack development environment.
- New React Frontend Application: A new React application is introduced under the
frontend/directory, featuringHomeandJobDetailcomponents. It includes functionality for uploading WAV files, displaying a list of past transcriptions, and viewing detailed transcription results via client-side routing. - FastAPI Backend for Frontend: A new FastAPI application (
frontend/app.py) is added. This application is responsible for mounting and serving the React static files and provides dummy API endpoints for file uploads (/jobsPOST), listing jobs (/jobsGET), deleting jobs (/jobs/{uuid}DELETE), and retrieving specific file transcripts (/file/{uuid}GET). - Frontend Build & Dependencies Updates: The
frontend/Dockerfileis updated to remove unused Node.js dependencies (express,multer), reflecting the shift to FastAPI serving the frontend.react-router-domis added topackage.jsonandpackage-lock.jsonto enable client-side routing in the React app, and aproxysetting is configured inpackage.jsonfor development convenience. - Styling and Assets: Extensive new CSS rules are added in
frontend/src/App.cssto support the new UI layout and components, including fixed headers, side panels, and file upload sections. A new SVG logo (flower.svg) is also introduced for the frontend.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request integrates the frontend React application into the full-stack development branch. Key changes include setting up basic routing with react-router-dom, creating placeholder components for the Home and Job Detail pages, adding dummy FastAPI endpoints for frontend interaction, and styling the new layout. The changes introduce necessary structure for the frontend, but several areas require further development, particularly in the dummy API endpoints and the Job Detail page rendering. Pay attention to the type mismatch in the DELETE endpoint and the use of index as keys in lists.
|
|
||
|
|
||
| @app.delete("/jobs/{uuid}") | ||
| async def delete_item(uuid: int) -> dict[str, str]: |
There was a problem hiding this comment.
The /jobs GET endpoint returns string UUIDs (e.g., "1", "2"), but this DELETE endpoint expects an integer UUID. This type mismatch will cause errors if the frontend attempts to delete a job using the UUIDs obtained from the GET endpoint. The type hint should likely be str to match the other endpoints.
| async def delete_item(uuid: int) -> dict[str, str]: | |
| async def delete_item(uuid: str) -> dict[str, str]: |
| @app.post("/jobs") | ||
| async def transcribe(file: UploadFile = File(...)) -> dict[str, str | list[dict[str, str]]]: |
There was a problem hiding this comment.
The function name transcribe is misleading since this is a dummy endpoint that returns hardcoded data and does not perform actual transcription. Consider renaming it to something like dummy_transcribe or create_dummy_job to better reflect its purpose.
| @app.post("/jobs") | |
| async def transcribe(file: UploadFile = File(...)) -> dict[str, str | list[dict[str, str]]]: | |
| @app.post("/jobs") | |
| async def dummy_transcribe(file: UploadFile = File(...)) -> dict[str, str | list[dict[str, str]]]: |
| .main-content { | ||
| display: flex; | ||
| padding: 20px; | ||
| gap: 40px; | ||
| justify-content: flex-start; | ||
| align-items: flex-start; | ||
| max-width: 100vw; | ||
| box-sizing: border-box; | ||
| margin-left: 25vw; /* <-- This shifts the content to the right */ | ||
| } | ||
|
|
||
|
|
||
| .file-button-container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0; | ||
| width: 23vw; | ||
| } | ||
|
|
||
| .message-bubble { | ||
| padding: 10px; | ||
| margin: 5px 0; | ||
| border-radius: 10px; | ||
| background-color: #f0f0f0; | ||
| } | ||
|
|
||
| .speaker-1 { | ||
| background-color: #928f82; | ||
| align-self: flex-start; | ||
| } | ||
|
|
||
| .speaker-2 { | ||
| background-color: #737373; | ||
| align-self: flex-end; | ||
| } | ||
|
|
||
| .upload-section { | ||
| margin-top: 20px; | ||
| } | ||
|
|
||
| .left-panel { | ||
| color: white; | ||
| width: 25vw; | ||
| min-height: 100vh; | ||
| background-color: #000000; | ||
| box-sizing: border-box; | ||
| position: fixed; | ||
| left: 0; | ||
| padding-left: 1vw; | ||
| } | ||
|
|
||
| .right-panel h3, h4 { | ||
| color: white; | ||
| } | ||
|
|
||
| .left-panel, .right-panel { | ||
| padding-top: 125px; | ||
| padding-right: 1vw; | ||
| } | ||
|
|
||
| .file-button { | ||
| border: none; | ||
| text-align: left; | ||
| padding: 10px 15px; | ||
| font-size: 1rem; | ||
| border-radius: 8px; | ||
| color: #ffffff; | ||
| transition: background-color 0.2s; | ||
| cursor: pointer; | ||
| width: 100%; | ||
| box-sizing: border-box; | ||
| background-color: transparent; | ||
| } | ||
|
|
||
| .file-button:hover { | ||
| background-color: #363636; | ||
| } | ||
|
|
||
| .file-button.selected { | ||
| background-color: rgb(34, 34, 34); | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| .upload-section { | ||
| margin-top: 2rem; | ||
| padding: 1.5rem; | ||
| border-radius: 16px; | ||
| background-color: #575757; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1rem; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .upload-title { | ||
| font-size: 1.25rem; | ||
| font-weight: bold; | ||
| color: #ffffff; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .upload-form { | ||
| display: flex; | ||
| flex-direction: row; | ||
| align-items: center; | ||
| width: 100%; | ||
| max-width: 800px; | ||
| gap: 1rem; | ||
| background-color: transparent; | ||
| padding: 1rem; | ||
| border-radius: 12px; | ||
| } | ||
|
|
||
| .file-input { | ||
| flex: 1; | ||
| padding: 0.6rem 1rem; | ||
| border: 1px solid #ccc; | ||
| border-radius: 8px; | ||
| background-color: #a08f5c; | ||
| color: #ffffff; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .upload-button { | ||
| padding: 0.6rem 1.2rem; | ||
| background-color: #ccc; | ||
| color: #fff; | ||
| border: none; | ||
| border-radius: 8px; | ||
| white-space: nowrap; | ||
| cursor: not-allowed; | ||
| transition: background-color 0.3s ease; | ||
| } | ||
|
|
||
| .upload-button.active { | ||
| background-color: #007bff; | ||
| cursor: pointer; | ||
| } | ||
|
|
||
| .upload-button.active:hover { | ||
| background-color: #0056b3; | ||
| } |
There was a problem hiding this comment.
| import flowerLogo from './resources/flower.svg'; | ||
|
|
||
| function Home() { | ||
| const [fileNames, setFileNames] = useState([]); |
There was a problem hiding this comment.
| fetch("/jobs") | ||
| .then(res => res.json()) | ||
| .then(data => { | ||
| console.log("Data from /jobs:", data); |
| setFileNames({}); | ||
| } | ||
| }) | ||
| .catch(err => console.error("Failed to fetch file names:", err)); |
| }) | ||
| .then(res => res.json()) | ||
| .then(data => setTranscription(Array.isArray(data.transcript) ? data.transcript : [])) | ||
| .catch(err => console.error("Failed to fetch transcription:", err)); |
| <div className="file-button-container"> | ||
| {Object.entries(fileNames).map(([uuid, filename], idx) => ( | ||
| <button | ||
| key={idx} |
There was a problem hiding this comment.
| <button | ||
| key={idx} | ||
| className="file-button" | ||
| onClick={() => window.location.href = `/file/${uuid}`} |
| return ( | ||
| <div className="job-detail"> | ||
| <h2>Job: {uuid}</h2> | ||
| <pre>{JSON.stringify(data, null, 2)}</pre> | ||
| </div> |
No description provided.