-
Notifications
You must be signed in to change notification settings - Fork 19
Labels
FrontendFrontend Related IssueFrontend Related IssueRefactorCode ImprovementCode Improvement⚡ImportantHigh-impact issue that needs to be resolved before the next releaseHigh-impact issue that needs to be resolved before the next release
Milestone
Description
Remove any old numeric toggles (requiredUserDetailsOption), adopt typed data models (e.g. CreateDocumentLinkPayload), and dynamically render checkboxes for “Name,” “Email,” etc. from visitorFieldsConfig.ts. The user can also set alias, password (if not public), expirationTime, etc.
Detailed Tasks
-
Create or Update
CreateDocumentLinkPayload- Place it under
src/shared/models/links.tsor a similar path. - Include fields like
alias,isPublic,expirationTime,visitorFields(as an array of strings), etc.
- Place it under
-
Use
visitorFieldsConfig.ts- In
CreateLink.tsx, import the config keys (e.g.visitorFieldKeys) to render checkboxes for each potential field. - The final chosen fields become
visitorFields: string[]in the request payload.
- In
-
Typed useState
- Instead of untyped
useState({ alias: '', ... }), define an interface, e.g.CreateLinkFormValues. Example:interface CreateLinkFormValues { alias: string; isPublic: boolean; password?: string; askForVisitorInfo: boolean; [key: string]: any; // for dynamic checkboxes }
- Then do
const [values, setValues] = useState<CreateLinkFormValues>({...}).
- Instead of untyped
-
Expiration Handling
- If the user picks “days from now” or a date, the final payload should always pass
expirationTimeas an ISO string or omit it if not set.
- If the user picks “days from now” or a date, the final payload should always pass
-
Remove Numeric Toggles
- Delete references to
requiredUserDetailsOption=1|2. Use the new dynamic checkboxes approach.
- Delete references to
-
Validation (Optional)
- Use existing
useValidatedFormDataor a similar approach to ensure typed form data, minimal password length, etc.
- Use existing
Acceptance Criteria
- CreateLink.tsx no longer references numeric toggles for visitor info.
- A typed
CreateDocumentLinkPayloadmodel is defined undersrc/shared/models/links.ts. - The final payload uses an array of strings for
visitorFields. - The UI renders dynamic checkboxes from
visitorFieldsConfig.ts, storing the user’s selected fields in state. - Any errors (e.g., password too short) use typed form validations.
- Code is clean, with ephemeral styled usage removed or replaced by
sxprops or small shared components.
Metadata
Metadata
Assignees
Labels
FrontendFrontend Related IssueFrontend Related IssueRefactorCode ImprovementCode Improvement⚡ImportantHigh-impact issue that needs to be resolved before the next releaseHigh-impact issue that needs to be resolved before the next release