-
Notifications
You must be signed in to change notification settings - Fork 78
Description
⚠️ Before implementing, read and follow the Implementation Rules in the epic issue #5364. These rules cover mandatory patterns for React component structure, BAI component usage, reactToWebComponent bridge, state management, i18n, error handling, styling, and code quality. The reference implementation isreact/src/components/SignupModal.tsx.Goal: Complete Lit file removal. Each migration must fully replace the Lit source file with React — not just the dialog parts. The migrated Lit
.tsfile and its type declarations must be deleted. This epic is a critical step toward removing all Lit/MWC/Vaadin dependencies from the codebase.
Description
Migrate lablup-terms-of-service.ts (Lit-Element) to a React component. This component displays Terms of Service and Privacy Policy documents with language selection, loaded dynamically from HTML files.
Part of epic #5364 — Phase 2 (Auth-adjacent components)
Current Implementation
File: src/components/lablup-terms-of-service.ts
Dialog: #terms-of-service-dialog
- Attributes:
fixed,blockscrolling,persistent,scrollable - Header action:
mwc-selectfor language selection (Korean, English) - Content: DOMPurify-sanitized HTML loaded from
/resources/documents/{entry}.{lang}.html - Footer: Close button
State:
tosEntry:'terms-of-service'|'privacy-policy'tosLanguage:'en'|'ko'tosLanguages: Array of{code, text}tosContent: HTML string (sanitized)title: Dynamic titleshow,block: boolean flags
Dynamic Property Updates:
dialog.backdrop = true;
dialog.scrimClickAction = '';Data Loading Flow:
- Parent calls
receiveTOSAgreement()orreceivePPAgreement() - Set
tosEntryandtitle - Fetch
/resources/documents/{tosEntry}.{tosLanguage}.html - Sanitize with DOMPurify
- Inject into content div
- Show dialog
Event Listeners:
didShow/didHidefor state synchronization
Note: A React TermsOfServiceModal already exists at react/src/components/TermsOfServiceModal.tsx — review and extend if needed rather than creating from scratch.
Migration Plan
- Review existing
react/src/components/TermsOfServiceModal.tsx - Ensure it supports both TOS and Privacy Policy modes
- Add language selector (BAISelect with language options)
- Implement dynamic HTML content loading with DOMPurify
- Register as
<backend-ai-react-terms-of-service>viareactToWebComponent - Update parent components (backend-ai-signup, backend-ai-login) to use the React version
- Remove Lit version
Component Mapping
| Current (Lit) | Target (React) |
|---|---|
backend-ai-dialog |
BAIModal |
mwc-select + mwc-list-item |
BAISelect or Ant Design Select |
mwc-button |
BAIButton |
| Manual HTML injection | dangerouslySetInnerHTML with DOMPurify |
| Dynamic property updates | React state + props |
Acceptance Criteria
- TermsOfServiceModal supports both TOS and Privacy Policy
- Language selection works (at minimum: English, Korean)
- HTML content loaded dynamically and sanitized
- Scrollable content area
- Registered as web component for backward compatibility
- Used by both signup and login flows
- i18n translations preserved