refactor(all): migrate from React to Next.js

This commit is contained in:
2026-05-20 09:46:17 +03:30
parent dacbd3a328
commit f23108cda3
86 changed files with 2831 additions and 2679 deletions

View File

@@ -1,43 +1,41 @@
# Frontend
## Stack
- Vite + React 18 with TypeScript.
- `@tanstack/react-query` for data fetching and caching.
- shadcn/ui primitives (button, card, tabs, dialog, etc.) with Tailwind CSS.
- Sonner & Toast UI for notifications, Markdown rendering, RTL layout, and Persian-digit helpers.
- Next.js App Router with React 18 and TypeScript.
- `@tanstack/react-query` for client-side authenticated flows.
- Tailwind CSS and shadcn/ui components.
- `next-themes`, Sonner, and toast helpers for RTL UI and notifications.
## Environment
Copy `.env.sample` to `.env`.
Required variables:
- `NEXT_PUBLIC_API_BASE_URL`
- `NEXT_PUBLIC_SITE_URL`
## Development
### Install dependencies
```bash
npm install
npm run dev
```
### Configure API base URL
```bash
cp .env.sample .env
```
The local dev server runs on `http://localhost:8080`.
### Run dev server
```bash
npm run dev -- --host
```
### Production build
## Production build
```bash
npm run build
npm run start
```
The Vite build reads `VITE_API_BASE_URL` from `.env`.
The production runtime serves on port `3000` inside Docker. Dockerfiles live only in `guilan-ace-deployment`.
## Features
- **Public site**: homepage, events list/detail, blog list, auth flows, profile, payments.
- **Admin dashboard**: staff-only portal with vertical tabs, user filtering, event filtering, popup detail with registrations/payments, and inline event editing/deletion.
- **Utils**: Persian digit formatting, price conversion (Rial → Toman), shared API client with JWT token refresh handling, and helper components (scroll area, table, dialog).
## Routes
- Public SEO pages: `/`, `/about`, `/blog`, `/blog/[slug]`, `/events`, `/events/[slug]`
- Client-heavy flows: `/auth`, `/profile`, `/logout`, `/payments/result`, `/reset-password/*`, `/verify-email/*`
- Admin: `/admin/*`
## Testing & linting
## Validation
```bash
npm run lint
npm run build
```
JavaScript/TypeScript linting is configured through ESLint + `typescript-eslint`. Run lint before commits to keep code healthy.