A React-based frontend for the Rapid Aid Matcher disaster relief application. This application allows users to submit aid requests and responders to view and coordinate relief efforts.
- Submit Aid Requests: Users can submit requests with their location and aid needs
- Responder Dashboard: View categorized aid requests with filtering, sorting, and status management
- Request Status System: Track requests through unclaimed → claimed → completed workflow
- AI-Powered Categorization: Gemini 2.0 Flash AI categorizes requests (Food, Water, Shelter, Medical, Other)
- Status-based Analytics: Dashboard shows response progress and completion metrics
- Mobile-Responsive Design: Works seamlessly on desktop and mobile devices
- Clean Component Architecture: Reusable, maintainable React components
- Framework: React 18 with functional components and hooks
- Routing: React Router v6
- Styling: Plain CSS with CSS Modules approach
- Build Tool: Vite
- Package Manager: npm
src/
├── components/ # Reusable UI components
│ ├── Header.jsx # Navigation header
│ ├── Header.css
│ ├── RequestForm.jsx # AI-powered request submission form with Gemini integration
│ ├── RequestForm.css
│ ├── RequestList.jsx # List of aid requests with filtering
│ ├── RequestList.css
│ ├── RequestCard.jsx # Individual request display with status actions
│ ├── RequestCard.css
│ ├── CategoryBadge.jsx # Category display badge (medical, food, shelter, water, other)
│ ├── CategoryBadge.css
│ ├── StatusBadge.jsx # Request status badge (unclaimed/claimed/completed)
│ └── StatusBadge.css
├── pages/ # Page components
│ ├── SubmitRequestPage.jsx # Submit request page with AI categorization
│ ├── SubmitRequestPage.css
│ ├── DashboardPage.jsx # Responder dashboard with status analytics
│ └── DashboardPage.css
├── services/ # Business logic and API integration
| └── databaseService.js
│ └── geminiService.js # Gemini 2.0 Flash AI service for request categorization
├── assets/ # Static assets
│ ├── logo.png
│ └── react.svg
├── App.jsx # Main app component with routing
├── App.css
├── index.css # Global styles
└── main.jsx # App entry point
- Primary Function: AI-powered request submission with real-time categorization
- Integration: Direct Gemini 2.0 Flash API integration (no server required)
- Features: Form validation, error handling, console logging for testing
- Output: Processes requests with AI categorization and timestamps
- Primary Function: Manages Gemini AI API communication and request processing
- Features: Environment variable configuration, error handling, fallback categorization
- Categories: Automatically categorizes into medical, food, shelter, water, or other
- Testing: Comprehensive console logging for development and debugging
- Self-contained: Each component manages its own state and styling
- Reusable: Badge components for categories and status indicators
- Responsive: Mobile-first design with CSS Grid and Flexbox
- Accessible: Semantic HTML structure with proper ARIA labels
- Node.js (version 16 or higher)
- npm
-
Clone the repository:
git clone <repository-url> cd Shellhacks_2025
-
Install dependencies:
npm install
-
Set up Gemini AI integration:
- Get your Gemini API key from Google AI Studio
- Create a .env file under the main directory
- Add your API key to the
.envfile:VITE_GEMINI_API_KEY=your_actual_api_key_here
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
This application uses Gemini 2.0 Flash for real-time request categorization directly in the frontend.
- Form Submission: Users submit aid requests through the form
- AI Processing: Gemini AI analyzes the request text in real-time
- Categorization: AI automatically categorizes requests into predefined categories
- Console Output: Detailed processing information is logged to browser console for testing
When a request is processed, it creates the following data structure:
{
"id": "1735123456789",
"name": "John Doe",
"location": "123 Main St, City, State",
"request_text": "Need food and water for family of 4",
"category": "food",
"status": "unclaimed",
"created_at": "2024-12-25T15:30:45.123Z"
}id: Unique timestamp-based identifiername: Requester's name (optional, defaults to "Anonymous")location: Required location informationrequest_text: Required description of aid neededcategory: AI-generated category (food, water, shelter, medical, other)status: Always "unclaimed" for new requestscreated_at: ISO timestamp of request creation
Gemini AI classifies requests into these categories:
food- Food and nutrition needswater- Clean water and hydrationshelter- Housing and temporary sheltermedical- Healthcare and medical suppliesother- Everything else
Navigation component with links to Submit Request and Dashboard pages.
Form component for submitting aid requests. Includes validation and loading states.
- Calls Gemini API directly to process requests in JSON formatW
- Handles form validation (required: location, request_text)
- Name field is optional
Displays list of requests with filtering and sorting options.
- Category Filter: All, Food, Water, Shelter, Medical, Other
- Status Filter: All, Unclaimed, Claimed, Completed
- Sort Options: Newest First, Oldest First
- Accepts
onStatusChangecallback for status updates
Individual request display with category badges, timestamps, contact info, and status actions.
- Shows CategoryBadge and StatusBadge
- Action Buttons:
- Unclaimed requests: "Claim Request" button
- Claimed requests: "Mark Complete" and "Unclaim" buttons
- Completed requests: "✓ Request fulfilled" indicator
- Calls
onStatusChange(requestId, newStatus)when buttons are clicked
Reusable badge component for displaying request categories with color coding:
- Food: Green
- Water: Blue
- Shelter: Purple
- Medical: Red
- Other: Gray
New component for displaying request status with color coding:
- Unclaimed: Passive yellow
- Claimed: Light blue
- Completed: Green
- Unknown: Gray
Main dashboard with analytics and request management:
- Response Status Statistics: Shows unclaimed, claimed, completed counts and completion rate
- Handles status updates via
handleStatusChange()function - Sends PATCH requests to
/api/requests/{id}/status - Updates local state optimistically (works even if API call fails)
- Global styles in
index.cssfor common elements (buttons, forms, containers) - Component-specific CSS files for component styling
- Mobile-first responsive design using CSS Grid and Flexbox
- CSS custom properties for consistent colors and spacing
- Map integration for location visualization
- Real-time updates using WebSockets
- User authentication and profiles
- Advanced filtering and search
- Multi-language support
- Offline support with service workers
- Push notifications for urgent requests
- Component Organization: Each component should have its own CSS file
- Responsive Design: Test on mobile devices and use relative units
- Accessibility: Include proper ARIA labels and semantic HTML
- Performance: Lazy load components and optimize images
- Error Handling: Implement proper error boundaries and user feedback
- Follow the existing code style and component structure - Look at
RequestForm.jsx(Gemini integration) andDashboardPage.jsx - Add CSS files for new components
- Test responsive design on multiple screen sizes
- Update documentation for new features
- Alec Gomez - Frontend / DevOps