Skip to content

Merge frontend into the full-stack dev branch#34

Merged
xenoblade246 merged 7 commits intofeat/full-stackfrom
dev-frontend
Jun 18, 2025
Merged

Merge frontend into the full-stack dev branch#34
xenoblade246 merged 7 commits intofeat/full-stackfrom
dev-frontend

Conversation

@xenoblade246
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, featuring Home and JobDetail components. 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 (/jobs POST), listing jobs (/jobs GET), deleting jobs (/jobs/{uuid} DELETE), and retrieving specific file transcripts (/file/{uuid} GET).
  • Frontend Build & Dependencies Updates: The frontend/Dockerfile is updated to remove unused Node.js dependencies (express, multer), reflecting the shift to FastAPI serving the frontend. react-router-dom is added to package.json and package-lock.json to enable client-side routing in the React app, and a proxy setting is configured in package.json for development convenience.
  • Styling and Assets: Extensive new CSS rules are added in frontend/src/App.css to 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

  1. 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread frontend/app.py


@app.delete("/jobs/{uuid}")
async def delete_item(uuid: int) -> dict[str, str]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
async def delete_item(uuid: int) -> dict[str, str]:
async def delete_item(uuid: str) -> dict[str, str]:

Comment thread frontend/app.py
Comment on lines +9 to +10
@app.post("/jobs")
async def transcribe(file: UploadFile = File(...)) -> dict[str, str | list[dict[str, str]]]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
@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]]]:

Comment thread frontend/src/App.css
Comment on lines +44 to +186
.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;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Many hardcoded values are used for padding, margin, gap, width, border-radius, and colors throughout these new CSS rules. Extracting these into CSS variables (custom properties) would improve maintainability, making it easier to manage the theme and ensure consistency across the application.

Comment thread frontend/src/Home.js
import flowerLogo from './resources/flower.svg';

function Home() {
const [fileNames, setFileNames] = useState([]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fileNames state is initialized as an empty array [], but the fetch logic on lines 15-19 expects and sets it as an object {}. Initialize the state with {} for consistency.

Suggested change
const [fileNames, setFileNames] = useState([]);
const [fileNames, setFileNames] = useState({});

Comment thread frontend/src/Home.js
fetch("/jobs")
.then(res => res.json())
.then(data => {
console.log("Data from /jobs:", data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

console.log statements should be removed before merging to production branches.

Comment thread frontend/src/Home.js
setFileNames({});
}
})
.catch(err => console.error("Failed to fetch file names:", err));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

console.error statements should be removed or replaced with a proper logging mechanism before merging to production branches.

Comment thread frontend/src/Home.js
})
.then(res => res.json())
.then(data => setTranscription(Array.isArray(data.transcript) ? data.transcript : []))
.catch(err => console.error("Failed to fetch transcription:", err));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

console.error statements should be removed or replaced with a proper logging mechanism before merging to production branches.

Comment thread frontend/src/Home.js
<div className="file-button-container">
{Object.entries(fileNames).map(([uuid, filename], idx) => (
<button
key={idx}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When rendering lists in React, it's best practice to use a stable, unique identifier as the key prop rather than the array index (idx), especially if the list can change. The uuid is available here and serves as a stable identifier.

Suggested change
key={idx}
key={uuid}

Comment thread frontend/src/Home.js
<button
key={idx}
className="file-button"
onClick={() => window.location.href = `/file/${uuid}`}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using window.location.href causes a full page reload, which is not the standard way to navigate within a single-page application using React Router. Consider using the useNavigate hook provided by react-router-dom for programmatic navigation.

Comment thread frontend/src/JobDetail.js
Comment on lines +23 to +27
return (
<div className="job-detail">
<h2>Job: {uuid}</h2>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Currently, the JobDetail component displays the raw JSON data. This is likely a placeholder. The component should be updated to parse the data and render the transcription in a user-friendly format, similar to how it's displayed on the Home page.

@xenoblade246 xenoblade246 merged commit 92f42bc into feat/full-stack Jun 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant