|
1 | | -# Maize Bus - Web |
2 | | -> Dynamic site for MaizeBus built with the MERN stack |
| 1 | +# MaizeBus Frontend |
3 | 2 |
|
4 | | -[![NPM Version][npm-image]][npm-url] |
| 3 | +> Modern React frontend for MaizeBus - University of Michigan's student-run bus tracking application |
5 | 4 |
|
6 | | - |
| 5 | +[](https://reactjs.org/) |
| 6 | +[](https://www.typescriptlang.org/) |
| 7 | +[](https://vitejs.dev/) |
| 8 | +[](https://tailwindcss.com/) |
7 | 9 |
|
8 | | -## Installation |
| 10 | +## 🚀 Live Demo |
9 | 11 |
|
10 | | -```sh |
11 | | -npm install -y |
12 | | -``` |
| 12 | +- **Production**: [https://www.maizebus.com](https://www.maizebus.com) |
| 13 | +- **GitHub Pages**: [https://mbusdev.github.io/maizebus-web](https://mbusdev.github.io/maizebus-web) |
| 14 | + |
| 15 | +## 📋 Features |
| 16 | + |
| 17 | +- **Responsive Design**: Mobile-first approach with Tailwind CSS |
| 18 | +- **Modern UI Components**: Built with Radix UI primitives |
| 19 | +- **Smooth Animations**: Framer Motion for page transitions and micro-interactions |
| 20 | +- **Type Safety**: Full TypeScript implementation |
| 21 | +- **Fast Development**: Vite for lightning-fast HMR |
| 22 | +- **Accessibility**: WCAG compliant components |
| 23 | +- **SEO Optimized**: Meta tags and structured data |
| 24 | + |
| 25 | +## 🛠️ Tech Stack |
| 26 | + |
| 27 | +- **Framework**: React 18 with TypeScript |
| 28 | +- **Build Tool**: Vite |
| 29 | +- **Styling**: Tailwind CSS + CSS Modules |
| 30 | +- **UI Components**: Radix UI primitives |
| 31 | +- **Animations**: Framer Motion |
| 32 | +- **Routing**: React Router v6 |
| 33 | +- **Icons**: Lucide React |
| 34 | +- **Deployment**: GitHub Pages |
| 35 | + |
| 36 | +## 🚀 Quick Start |
| 37 | + |
| 38 | +### Prerequisites |
| 39 | + |
| 40 | +- Node.js 18+ |
| 41 | +- npm 8+ |
| 42 | + |
| 43 | +### Installation |
13 | 44 |
|
14 | | -## Development setup |
| 45 | +```bash |
| 46 | +# Clone the repository |
| 47 | +git clone https://github.com/mbusdev/maizebus-web.git |
| 48 | +cd maizebus-web/client |
15 | 49 |
|
16 | | -To run the site for development, enter this into your terminal: |
| 50 | +# Install dependencies |
| 51 | +npm install |
17 | 52 |
|
18 | | -```sh |
| 53 | +# Start development server |
19 | 54 | npm run dev |
20 | 55 | ``` |
21 | 56 |
|
22 | | -and open the localhost link given to you |
| 57 | +The app will be available at `http://localhost:5173` |
| 58 | + |
| 59 | +## 📁 Project Structure |
| 60 | + |
| 61 | +``` |
| 62 | +client/ |
| 63 | +├── public/ # Static assets |
| 64 | +│ ├── assets/ # Images and media |
| 65 | +│ │ └── profiles/ # Team member photos |
| 66 | +│ ├── logo.png # Site favicon |
| 67 | +│ └── 404.html # GitHub Pages SPA routing |
| 68 | +├── src/ |
| 69 | +│ ├── components/ # Reusable UI components |
| 70 | +│ │ ├── button/ # Button component |
| 71 | +│ │ ├── input/ # Input component |
| 72 | +│ │ ├── CardContent/ # Card wrapper |
| 73 | +│ │ └── ... # Other components |
| 74 | +│ ├── pages/ # Page components |
| 75 | +│ │ ├── home/ # Landing page |
| 76 | +│ │ ├── contact/ # Contact form |
| 77 | +│ │ ├── join/ # Application form |
| 78 | +│ │ ├── team/ # Team showcase |
| 79 | +│ │ └── tracker/ # Bus tracking |
| 80 | +│ ├── assets/ # Static assets (bundled) |
| 81 | +│ │ └── team.json # Team data |
| 82 | +│ ├── config.ts # API configuration |
| 83 | +│ ├── App.tsx # Main app component |
| 84 | +│ └── main.tsx # Entry point |
| 85 | +├── index.html # HTML template |
| 86 | +├── vite.config.ts # Vite configuration |
| 87 | +└── package.json # Dependencies |
| 88 | +``` |
| 89 | + |
| 90 | +## 🎨 Available Scripts |
| 91 | + |
| 92 | +```bash |
| 93 | +# Development |
| 94 | +npm run dev # Start dev server with HMR |
| 95 | +npm run build # Build for production |
| 96 | +npm run preview # Preview production build |
| 97 | +npm run lint # Run ESLint |
| 98 | + |
| 99 | +# Type checking |
| 100 | +npm run type-check # Check TypeScript types |
| 101 | +``` |
| 102 | + |
| 103 | +## 🌐 Environment Configuration |
| 104 | + |
| 105 | +The app automatically detects the environment and configures API endpoints: |
| 106 | + |
| 107 | +- **Development**: `http://localhost:3001` (local backend) |
| 108 | +- **Production**: `https://api.maizebus.com` (AWS EC2 backend) |
| 109 | + |
| 110 | +### Environment Variables |
| 111 | + |
| 112 | +```bash |
| 113 | +# Optional: Override API URL |
| 114 | +VITE_API_URL=https://your-api-domain.com |
| 115 | +``` |
| 116 | + |
| 117 | +## 🎯 Key Pages |
| 118 | + |
| 119 | +### Home (`/`) |
| 120 | +- Hero section with app showcase |
| 121 | +- Feature highlights |
| 122 | +- FAQ section |
| 123 | +- Download links for mobile apps |
| 124 | + |
| 125 | +### Contact (`/contact`) |
| 126 | +- Multi-purpose contact form |
| 127 | +- Inquiry type selection (General, Bug Report, Feature Request) |
| 128 | +- Social media links |
| 129 | +- Quick response guarantee |
| 130 | + |
| 131 | +### Join (`/join`) |
| 132 | +- Application form for new members |
| 133 | +- Skills and experience input |
| 134 | +- Real-time form validation |
| 135 | +- Loading states and success feedback |
| 136 | + |
| 137 | +### Team (`/team`) |
| 138 | +- Team member showcase |
| 139 | +- Role-based filtering |
| 140 | +- Social media integration |
| 141 | +- Responsive grid layout |
| 142 | + |
| 143 | +### Tracker (`/tracker`) |
| 144 | +- Real-time bus location (coming soon) |
| 145 | +- Route information |
| 146 | +- Schedule display |
| 147 | + |
| 148 | +## 🎨 Component Library |
| 149 | + |
| 150 | +### Core Components |
| 151 | + |
| 152 | +- **Button**: Multiple variants (primary, secondary, outline) |
| 153 | +- **Input**: Form inputs with validation states |
| 154 | +- **Textarea**: Multi-line text input |
| 155 | +- **Card**: Content containers with headers |
| 156 | +- **Badge**: Status indicators and tags |
| 157 | +- **Avatar**: Profile image display with fallback |
| 158 | + |
| 159 | +### Layout Components |
| 160 | + |
| 161 | +- **Nav**: Responsive navigation with mobile menu |
| 162 | +- **Footer**: Site footer with links and social media |
| 163 | +- **SpotlightCard**: Featured content cards |
| 164 | +- **ImageWithFallback**: Images with error handling |
| 165 | + |
| 166 | +## 🚀 Deployment |
| 167 | + |
| 168 | +### GitHub Pages |
| 169 | + |
| 170 | +The frontend is automatically deployed to GitHub Pages on every push to `main`: |
| 171 | + |
| 172 | +1. **Custom Domain**: `www.maizebus.com` |
| 173 | +2. **GitHub Pages**: `mbusdev.github.io/maizebus-web` |
| 174 | +3. **HTTPS**: Automatically enforced |
| 175 | +4. **SPA Routing**: Handled via `404.html` redirect |
| 176 | + |
| 177 | +### Manual Deployment |
| 178 | + |
| 179 | +```bash |
| 180 | +# Build the project |
| 181 | +npm run build |
| 182 | + |
| 183 | +# The dist/ folder contains the built files |
| 184 | +# Upload to your hosting provider |
| 185 | +``` |
| 186 | + |
| 187 | +## 🔧 Development Guidelines |
| 188 | + |
| 189 | +### Code Style |
| 190 | + |
| 191 | +- Use TypeScript for all new files |
| 192 | +- Follow React functional component patterns |
| 193 | +- Use Tailwind CSS for styling |
| 194 | +- Implement proper error boundaries |
| 195 | +- Write accessible HTML |
| 196 | + |
| 197 | +### Component Structure |
| 198 | + |
| 199 | +```tsx |
| 200 | +// Example component structure |
| 201 | +interface ComponentProps { |
| 202 | + title: string; |
| 203 | + children: React.ReactNode; |
| 204 | +} |
| 205 | + |
| 206 | +export function Component({ title, children }: ComponentProps) { |
| 207 | + return ( |
| 208 | + <div className="component-wrapper"> |
| 209 | + <h2>{title}</h2> |
| 210 | + {children} |
| 211 | + </div> |
| 212 | + ); |
| 213 | +} |
| 214 | +``` |
| 215 | + |
| 216 | +### Adding New Pages |
| 217 | + |
| 218 | +1. Create page component in `src/pages/page-name/` |
| 219 | +2. Add route to `App.tsx` |
| 220 | +3. Update navigation in `Nav` component |
| 221 | +4. Add page-specific styles |
| 222 | + |
| 223 | +## 🐛 Troubleshooting |
| 224 | + |
| 225 | +### Common Issues |
| 226 | + |
| 227 | +**Images not loading** |
| 228 | +- Check if images are in `public/assets/` directory |
| 229 | +- Verify paths use absolute URLs (`/assets/...`) |
| 230 | + |
| 231 | +**API calls failing** |
| 232 | +- Ensure backend is running on correct port |
| 233 | +- Check CORS configuration |
| 234 | +- Verify API endpoints in `config.ts` |
| 235 | + |
| 236 | +**Build errors** |
| 237 | +- Clear `node_modules` and reinstall: `rm -rf node_modules && npm install` |
| 238 | +- Check TypeScript errors: `npm run type-check` |
| 239 | + |
| 240 | +**GitHub Pages routing issues** |
| 241 | +- Ensure `404.html` exists in `public/` |
| 242 | +- Check `basename` configuration in `App.tsx` |
| 243 | + |
| 244 | +## 🤝 Contributing |
| 245 | + |
| 246 | +1. Fork the repository |
| 247 | +2. Create a feature branch: `git checkout -b feature/amazing-feature` |
| 248 | +3. Make your changes |
| 249 | +4. Test thoroughly |
| 250 | +5. Commit: `git commit -m 'Add amazing feature'` |
| 251 | +6. Push: `git push origin feature/amazing-feature` |
| 252 | +7. Open a Pull Request |
| 253 | + |
| 254 | +## 📄 License |
| 255 | + |
| 256 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 257 | + |
| 258 | +## 👥 Team |
| 259 | + |
| 260 | +Built by the MaizeBus development team at the University of Michigan. |
| 261 | + |
| 262 | +- **Frontend Lead**: Harvey Kyllonen |
| 263 | +- **Backend Lead**: Ryan Lu |
| 264 | +- **DevOps Lead**: Andrew Yu |
| 265 | +- **Executive Director**: Ishan Kumar |
| 266 | + |
| 267 | +## 📞 Support |
| 268 | + |
| 269 | +- **Email**: contact@maizebus.com |
| 270 | +- **GitHub Issues**: [Report bugs or request features](https://github.com/mbusdev/maizebus-web/issues) |
| 271 | +- **Discord**: [Join our community](https://discord.gg/maizebus) |
| 272 | + |
| 273 | +--- |
| 274 | + |
| 275 | +**Made with ❤️ by Michigan students, for Michigan students** |
0 commit comments