Initial Commit
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
# OpenSpec Change: enterprise-react-drive-sharing
|
||||
|
||||
- **Change ID**: enterprise-react-drive-sharing
|
||||
- **Package**: `@suaveplan/drive-react-sharing`
|
||||
- **Category**: react
|
||||
- **Target path**: `packages/drive/drive-react-sharing`
|
||||
- **Status**: PROPOSED
|
||||
- **Date**: 2026-04-24
|
||||
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/react-drive-sharing.md`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Deliver `@suaveplan/drive-react-sharing` on genesis from scratch at enterprise quality. React UI for shared drive resource management: `ShareDialog` (recipients list, permission picker, add/remove), `PartitionBadge` (type + encryption indicator), `FileAccessList` (read-only list with revoke), and `useSharing` hook. Genesis consolidates the three overlapping permission type names into one canonical union, adds a `useSharing` Storybook demo, wires `useSharing` to the real `@suaveplan/drive-sharing` engine, adds OTel counters for share actions, full accessibility, and Playwright E2E.
|
||||
|
||||
---
|
||||
|
||||
## Current-state audit (genesis)
|
||||
|
||||
Package does not exist on genesis — fresh build.
|
||||
|
||||
---
|
||||
|
||||
## Available workspace deps on genesis
|
||||
|
||||
| Package | Role |
|
||||
|---|---|
|
||||
| `@suaveplan/error` (`workspace:^`) | `DriveSharingError` |
|
||||
| `@suaveplan/drive-sharing` (`workspace:^`) | Sharing engine + canonical permission types |
|
||||
| `@suaveplan/react-translate` (`workspace:^`) | i18n for all UI strings |
|
||||
| `@opentelemetry/api` (`catalog:observability`) | `drive.share.*` counters + spans |
|
||||
| `zod` (`catalog:forms`) | Prop validation |
|
||||
| `tslib` (`catalog:build`) | TS helpers |
|
||||
|
||||
External: React 18 peer.
|
||||
|
||||
---
|
||||
|
||||
## Preserved public API surface
|
||||
|
||||
```ts
|
||||
// Components
|
||||
ShareDialog, PartitionBadge, FileAccessList
|
||||
|
||||
// Hook
|
||||
useSharing
|
||||
|
||||
// Types (consolidated from three overlapping names)
|
||||
SharePermission, ShareRecipient, AccessEntry, PartitionType,
|
||||
ShareDialogProps, PartitionBadgeProps, FileAccessListProps,
|
||||
UseSharingOptions, UseSharingReturn
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## New additions for genesis
|
||||
|
||||
1. **`DriveSharingError`** — codes: `SHARING_ADD_FAILED`, `SHARING_REVOKE_FAILED`, `SHARING_PERMISSION_FAILED`.
|
||||
2. **Consolidated permission types** — `SharePermission` re-exported from `@suaveplan/drive-sharing`; `AccessPermission` and `SharingPermission` aliases removed.
|
||||
3. **Real engine integration** — `useSharing` calls `@suaveplan/drive-sharing` engine (not an in-memory stub).
|
||||
4. **`useSharing` Storybook demo** — hooks playground story (main branch had none).
|
||||
5. **OTel counters** — `drive.share.add`, `drive.share.revoke`, `drive.share.permission.change` spans.
|
||||
6. **Accessibility** — `ShareDialog` focus trap, ESC-to-close, `aria-modal`, `aria-labelledby`; axe-core in all stories.
|
||||
7. **Playwright E2E** — add recipient, remove recipient, change permission, keyboard-only, mobile viewport.
|
||||
8. **Link sharing** — generate/revoke shareable links with scope, expiry, and password.
|
||||
|
||||
---
|
||||
|
||||
## File layout
|
||||
|
||||
```text
|
||||
packages/drive/drive-react-sharing/
|
||||
package.json
|
||||
tsconfig.json
|
||||
vitest.config.ts
|
||||
src/
|
||||
index.ts
|
||||
types/
|
||||
components/
|
||||
share-dialog/ (tsx + types + md + test + stories + index)
|
||||
partition-badge/ (tsx + types + md + test + stories + index)
|
||||
file-access-list/ (tsx + types + md + test + stories + index)
|
||||
share-link-dialog/ (tsx + types + md + test + stories + index)
|
||||
hooks/
|
||||
use-sharing/ (ts + md + test + stories + index)
|
||||
e2e/
|
||||
drive-sharing.spec.ts
|
||||
```
|
||||
@@ -0,0 +1,76 @@
|
||||
# Tasks: enterprise-react-drive-sharing
|
||||
|
||||
**Change ID**: enterprise-react-drive-sharing
|
||||
**Package**: `@suaveplan/drive-react-sharing`
|
||||
**Target path**: `packages/drive/drive-react-sharing`
|
||||
**Prerequisite packages on Verdaccio**: `@suaveplan/error`, `@suaveplan/drive-sharing`, `@suaveplan/react-translate`
|
||||
|
||||
---
|
||||
|
||||
## 1. Scaffold
|
||||
|
||||
- [ ] Create directory tree. Write `package.json` at `0.1.0`, `tsconfig.json`, `vitest.config.ts`, scripts.
|
||||
- [ ] Dependencies: `@suaveplan/error workspace:^`, `@suaveplan/drive-sharing workspace:^`, `@suaveplan/react-translate workspace:^`, `@opentelemetry/api catalog:observability`, `zod catalog:forms`, `tslib catalog:build`.
|
||||
|
||||
---
|
||||
|
||||
## 2. Error codes and types
|
||||
|
||||
- [ ] Define `DriveSharingError`; codes: `SHARING_ADD_FAILED`, `SHARING_REVOKE_FAILED`, `SHARING_PERMISSION_FAILED`.
|
||||
- [ ] Re-export `SharePermission` from `@suaveplan/drive-sharing` (no local divergence). Define: `ShareRecipient`, `AccessEntry`, `PartitionType`, `ShareDialogProps`, `PartitionBadgeProps`, `FileAccessListProps`, `UseSharingOptions`, `UseSharingReturn`, `ShareLinkDialogProps`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Hooks
|
||||
|
||||
### useSharing
|
||||
|
||||
- [ ] Manages recipients array; calls real `@suaveplan/drive-sharing` engine for `addRecipient`, `removeRecipient`, `updatePermission`. OTel spans: `drive.share.add`, `drive.share.revoke`, `drive.share.permission.change`.
|
||||
- [ ] Write `use-sharing.test.ts` (≤500 lines): add recipient calls engine, remove recipient calls engine, permission update calls engine, error states. DI-injected engine. `{ timeout: 10000 }`.
|
||||
- [ ] Write `use-sharing.md`.
|
||||
- [ ] Write `use-sharing.stories.tsx` (hooks playground with live recipient management).
|
||||
|
||||
---
|
||||
|
||||
## 4. Components
|
||||
|
||||
### PartitionBadge
|
||||
|
||||
- [ ] Displays partition type (`personal` / `communal` / `vault` / `public`) with encryption lock icon. All labels via `useTranslation`.
|
||||
- [ ] Write test, stories (all-four-types, encrypted, playground), md.
|
||||
|
||||
### FileAccessList
|
||||
|
||||
- [ ] Read-only list with revoke buttons. Each revoke button has `aria-label` naming the recipient via `useTranslation`. OTel `drive.share.revoke` counter on revoke.
|
||||
- [ ] Write test, stories (default, with-owner, empty, playground), md.
|
||||
|
||||
### ShareDialog
|
||||
|
||||
- [ ] Modal dialog with recipients list, permission picker, add-recipient form. Focus trap on open. ESC-to-close. `aria-modal`, `aria-labelledby`. All labels via `useTranslation`.
|
||||
- [ ] Write `share-dialog.test.tsx` (≤500 lines): renders recipients, add fires useSharing.addRecipient, remove fires removeRecipient, ESC closes, axe-clean. `{ timeout: 10000 }`.
|
||||
- [ ] Write stories (default, with-recipients, vault-partition, empty, playground), md.
|
||||
|
||||
### ShareLinkDialog
|
||||
|
||||
- [ ] Generate / revoke shareable link. Accepts `scope: SharePermission`, `expiry?: Date`, `password?: boolean`. Copy-to-clipboard button with `aria-live` announcement.
|
||||
- [ ] Write test, stories (default, with-expiry, with-password, playground), md.
|
||||
|
||||
---
|
||||
|
||||
## 5. E2E
|
||||
|
||||
- [ ] `e2e/drive-sharing.spec.ts` — Playwright:
|
||||
- Open `ShareDialog`; add a recipient; verify they appear in the list.
|
||||
- Change a recipient's permission; verify dropdown updates.
|
||||
- Revoke a recipient; verify they are removed.
|
||||
- Navigate the dialog using keyboard only; verify no focus escapes.
|
||||
- Test on mobile viewport.
|
||||
|
||||
---
|
||||
|
||||
## 6. Verify and publish
|
||||
|
||||
- [ ] `bunx turbo lint typecheck test --filter=@suaveplan/drive-react-sharing` — green.
|
||||
- [ ] `bunx turbo test:coverage --filter=@suaveplan/drive-react-sharing` — 100%.
|
||||
- [ ] `bun scripts/publish.ts --package @suaveplan/drive-react-sharing`.
|
||||
- [ ] Archive change folder.
|
||||
Reference in New Issue
Block a user