This repository has been archived on 2026-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
Gishen-B2B/docs/features/quick-search.md
kirukib 3778801ef5 Ship Gishen B2B institutional portal with polished layout and mock-backed flows.
Deliver role-aware shell (sidebar, breadcrumbs, quick search, tables, detail/create layouts), locale-ready pages, shared backend/feature docs, and Vercel project config so HR, finance, and members can demo against typed mocks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-06 21:18:23 +03:00

42 lines
1.7 KiB
Markdown

# Feature: Quick search / command directory
Keyboard-friendly portal navigation from the top bar (Cmd/Ctrl+K).
**Workspace:** `/Users/kirukib/Desktop/Yaltopia Project/Gishen-B2B`
## Surfaces
| Location | Control |
|----------|---------|
| Portal topbar | Search trigger (desktop) / search icon (mobile) |
| Global shortcut | `⌘K` / `Ctrl+K` opens the directory dialog |
## Implementation
| Path | Role |
|------|------|
| `src/lib/nav/quick-directory.ts` | **Canonical directory** — ids, label keys, hrefs, keywords, roles, groups |
| `src/components/layout/quick-search.tsx` | Dialog UI: filter, arrow keys, Enter navigate, Esc close |
| `src/components/layout/app-topbar.tsx` | Wires `QuickSearch` into the top bar |
| `src/messages/en.json` / `am.json` | `quickSearch.*` strings |
Role visibility uses `roleAllows` from `src/lib/auth/session.ts` (same SUPER_USER bypass pattern as `src/lib/auth/nav.ts`).
## Standing rule
**When you add a portal route or primary create action, add an entry to `QUICK_DIRECTORY` in `src/lib/nav/quick-directory.ts`.** Reuse `nav.*` label keys when the item mirrors sidebar nav; use `quickSearch.actions.*` for create/import actions. Update en + am message files for any new keys.
Do not leave orphan routes out of the directory — this is the maintainable “command map” for the portal.
## Groups
| Group | Typical entries |
|-------|-----------------|
| `navigation` | Dashboard, org, departments, members, packages, migration |
| `create` | `/…/new`, import members |
| `finance` | Finance, statements, approvals |
| `member` | My benefits, orders, prescriptions |
| `settings` | Verification |
Dynamic detail URLs (`/members/[id]`, etc.) are intentionally omitted; users open the list then the record.