feat(frontend): Replace React with Blazor frontend
This commit is contained in:
@@ -1,69 +1,127 @@
|
||||
# React + TypeScript + Vite
|
||||
# NimbusFlow Frontend - Blazor Server Application
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
A modern web application built with .NET 8 Blazor Server for managing member scheduling in the NimbusFlow system.
|
||||
|
||||
Currently, two official plugins are available:
|
||||
## Features
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
||||
- **Dashboard**: Overview of system statistics and recent activities
|
||||
- **Member Management**: Complete CRUD operations for choir members
|
||||
- **Schedule Management**: View, accept, decline, and manage member schedules
|
||||
- **Service Management**: Create and manage service events
|
||||
- **Real-time Updates**: Server-side rendering with SignalR for real-time updates
|
||||
- **Responsive Design**: Bootstrap-based UI that works on all devices
|
||||
|
||||
## Expanding the ESLint configuration
|
||||
## Architecture
|
||||
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||
This Blazor Server application follows a clean architecture pattern:
|
||||
|
||||
```js
|
||||
export default tseslint.config([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
- **Components/Pages**: Razor components for each major feature
|
||||
- **Services**: HTTP client services for backend API communication
|
||||
- **Models**: C# data models matching the Python backend schema
|
||||
- **Layout**: Consistent navigation and layout components
|
||||
|
||||
// Remove tseslint.configs.recommended and replace with this
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
// Alternatively, use this for stricter rules
|
||||
...tseslint.configs.strictTypeChecked,
|
||||
// Optionally, add this for stylistic rules
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
## Prerequisites
|
||||
|
||||
// Other configs...
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
- .NET 8.0 SDK
|
||||
- Python backend API running on http://localhost:8000/api/
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. **Restore packages**:
|
||||
```bash
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
2. **Run the application**:
|
||||
```bash
|
||||
dotnet watch # with hot reload
|
||||
# or
|
||||
dotnet run # without hot reload
|
||||
```
|
||||
|
||||
3. **Access the application**:
|
||||
- HTTPS: https://localhost:5001
|
||||
- HTTP: http://localhost:5000
|
||||
|
||||
## API Configuration
|
||||
|
||||
The application is configured to communicate with the Python backend API. Update the base URL in `Program.cs` if your backend runs on a different port:
|
||||
|
||||
```csharp
|
||||
builder.Services.AddHttpClient<IApiService, ApiService>(client =>
|
||||
{
|
||||
client.BaseAddress = new Uri("http://localhost:8000/api/");
|
||||
});
|
||||
```
|
||||
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||
## Project Structure
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import reactX from 'eslint-plugin-react-x'
|
||||
import reactDom from 'eslint-plugin-react-dom'
|
||||
|
||||
export default tseslint.config([
|
||||
globalIgnores(['dist']),
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
// Other configs...
|
||||
// Enable lint rules for React
|
||||
reactX.configs['recommended-typescript'],
|
||||
// Enable lint rules for React DOM
|
||||
reactDom.configs.recommended,
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
// other options...
|
||||
},
|
||||
},
|
||||
])
|
||||
```
|
||||
├── Components/
|
||||
│ ├── Layout/
|
||||
│ │ ├── MainLayout.razor # Main page layout
|
||||
│ │ └── NavMenu.razor # Navigation menu
|
||||
│ └── Pages/
|
||||
│ ├── Home.razor # Dashboard page
|
||||
│ ├── Members.razor # Member management
|
||||
│ ├── Schedules.razor # Schedule management
|
||||
│ └── Services.razor # Service management
|
||||
├── Models/
|
||||
│ └── Member.cs # Data models
|
||||
├── Services/
|
||||
│ ├── IApiService.cs # Service interface
|
||||
│ └── ApiService.cs # HTTP API client
|
||||
├── wwwroot/ # Static files
|
||||
├── Program.cs # Application startup
|
||||
└── appsettings.json # Configuration
|
||||
```
|
||||
|
||||
## Key Features
|
||||
|
||||
### Dashboard
|
||||
- System statistics (active members, pending schedules, etc.)
|
||||
- Recent schedule activities
|
||||
- Quick action buttons
|
||||
|
||||
### Member Management
|
||||
- List all members with filtering options
|
||||
- Add/edit member information
|
||||
- View member scheduling history
|
||||
- Manage member classifications
|
||||
|
||||
### Schedule Management
|
||||
- View all schedules with filtering
|
||||
- Accept/decline pending schedules
|
||||
- Remove schedules
|
||||
- View schedule details
|
||||
|
||||
### Service Management
|
||||
- Create and manage service events
|
||||
- View service schedules and assignments
|
||||
- Filter by date and service type
|
||||
|
||||
## Development
|
||||
|
||||
The application uses Blazor Server which provides:
|
||||
|
||||
- Real-time UI updates via SignalR
|
||||
- Server-side rendering for better performance
|
||||
- C# development throughout the stack
|
||||
- Automatic state management
|
||||
|
||||
## Deployment
|
||||
|
||||
To build for production:
|
||||
|
||||
```bash
|
||||
dotnet publish -c Release
|
||||
```
|
||||
|
||||
The published application will be in `bin/Release/net8.0/publish/`.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- ASP.NET Core 8.0
|
||||
- Blazor Server
|
||||
- Bootstrap 5 (included in template)
|
||||
- System.Text.Json for API serialization
|
||||
Reference in New Issue
Block a user