Files
2026-09-15 23:37:48 +07:00

35 lines
2.2 KiB
Markdown

# AGENTS.md
APLP LMS frontend. React 19 + Vite 8 + React Router 7 + Tailwind v4. Plain JS/JSX (no TypeScript).
## Commands
- `npm run dev` — Vite dev server
- `npm run lint` — ESLint (flat config, `eslint.config.js`); this is the only check
- `npm run build` — production build
- No test suite and no typecheck. Do not claim tests pass; verify with `npm run lint` and `npm run build`.
## Architecture
- Entry: `src/main.jsx``src/App.jsx`. All routes are declared in `App.jsx`; sidebar entries in `src/config/navigation.js`. Add both when adding a page.
- `@` is aliased to `src` (`vite.config.js`). Use `@/services/...`, `@/lib/...`.
- API layer: `src/lib/api.js` is a shared axios instance. Base URL = `VITE_API_BASE_URL`, default `http://localhost:8080`. `.env` is gitignored and there is no `.env.example`.
- Feature data access lives in `src/services/<name>Service.js` (`courseService`, `lessonService`, `sectionService`). Follow that shape: `api` + `BASE_PATH = '/api/<resource>'` + `getAll/getById/create/update/delete`. Add a new service rather than calling `axios`/`api` directly from a page.
- Pages: `src/pages/<feature>/`. Layout/nav shell: `src/layouts/MainLayout.jsx`.
## Tailwind v4
- No `tailwind.config.js`. Config is CSS-first in the `@theme` block of `src/App.css`, which is the file that `@import 'tailwindcss'` (imported from `App.jsx`, not `index.css`).
- Use the semantic tokens, not raw Kraken hex: `bg-app-primary`, `hover:bg-app-primary-dark`, `bg-app-surface-muted`, `text-app-text`, `text-app-text-muted`, `border-app-border`, `shadow-app-panel`, `shadow-app-micro`.
- Visual rules (colors, type, radii, do/don't) are in `DESIGN.md` — read it before styling.
## UI components
- `src/components/ui/*` are hand-rolled shadcn-style primitives (cva + Radix + `cn()` from `src/lib/utils.js`). There is no shadcn CLI or `components.json`; extend these files by hand.
- Icons come from `react-icons/hi2`.
## Gotchas
- `App.jsx` imports `./pages/Course/*` but the directory on disk is `src/pages/course/`. This only works on case-insensitive macOS; use the lowercase path to stay safe on Linux/CI.
- Imports are mixed: some relative (`../../components/...`), some aliased (`@/services/...`). Match the surrounding file.