# SWI Frontend (Admin)

## Authentication (no SWI login page)

SWI does **not** have its own login. Users must:

1. Sign in on the **HSE portal** (SAT) at `/login`
2. Open **Master Dashboard** → click **SWI/SOP Management**

The Master Dashboard passes `?token=...` into SWI. Opening `http://localhost:5175` directly without a token redirects to HSE login.

## Run (API + UI together)

From this folder:

```bash
npm install
npm run dev
```

This starts:

1. **SWI API** — `swi_backend` on port **5001** (or `APP_PORT` from env)
2. **Vite UI** — **http://localhost:5175** (after API health is ready)

From repo root:

```bash
npm run dev-swi
```

## UI only (API already running elsewhere)

```bash
npm run dev:ui-only
```

## Sidebar

| Section | Item | Action |
|---------|------|--------|
| SWI Admin | Create / Assign document | In-app pages |
| HSE Portal | Master Dashboard | Opens SAT (`/`) with SSO token |
| HSE Portal | Personal Dashboard | Opens SAT (`/personalized-dashboard`) |

Set `VITE_SAT_PORTAL_URL=http://localhost:3000` if SAT runs on another host.

## Master Dashboard → SWI

SAT Master Dashboard opens this app with `?token=...` when `REACT_APP_SWI_URL=http://localhost:5175` is set.
