Skip to content

Add react for frontend#1

Open
srzainab wants to merge 1 commit intomainfrom
add-react-for-web
Open

Add react for frontend#1
srzainab wants to merge 1 commit intomainfrom
add-react-for-web

Conversation

@srzainab
Copy link
Collaborator

@srzainab srzainab commented Apr 24, 2025

Replaced static HTML frontend with a modern React application for NeuralInk. Added component-based architecture, improved state management, and enhanced UX with loading states and error handling. Includes production-ready setup with concurrent development servers and proper API integration. Built with React 18, Tailwind CSS, and Axios for API calls!

…cluding article generation component, and updating server to serve static files. Introduce new scripts for development and client start in package.json.
@srzainab srzainab requested a review from wanda-carlson April 24, 2025 22:35
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR implements a modern React frontend for NeuralInk, replacing the static HTML implementation with a component-based architecture that includes state management, loading states, and error handling.

  • Implemented /client/src/components/ArticleGenerator.js with proper error handling, loading states, and API integration using axios
  • Added production deployment configuration in server.js to serve React build files
  • Configured concurrent development environment with dev:full script in root package.json to run both frontend and backend servers
  • Removed unused useState import in /client/src/App.js
  • Integrated Tailwind CSS for responsive styling across all components

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

8 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -0,0 +1,18 @@
import React, { useState } from 'react'
Copy link

Choose a reason for hiding this comment

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

style: useState is imported but never used in this component

Suggested change
import React, { useState } from 'react'
import React from 'react'

"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"tailwindcss": "^3.3.5",
Copy link

Choose a reason for hiding this comment

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

logic: Missing PostCSS and autoprefixer dependencies required by Tailwind CSS

Suggested change
"tailwindcss": "^3.3.5",
"tailwindcss": "^3.3.5",
"postcss": "^8.4.0",
"autoprefixer": "^10.4.0",

Comment on lines +39 to +46
<input
type="text"
id="topic"
value={topic}
onChange={(e) => setTopic(e.target.value)}
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
placeholder="e.g., Artificial Intelligence, Climate Change, etc."
/>
Copy link

Choose a reason for hiding this comment

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

style: Missing maxLength attribute to prevent excessively long topics that could overload the API

Comment on lines +53 to +58
if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, 'client/build')))
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'client/build', 'index.html'))
})
}
Copy link

Choose a reason for hiding this comment

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

logic: No fallback route for development environment - client requests may 404 when not in production

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