Overhaul CreateLink Modal with Typed Models & Dynamic Checkboxes #225
Labels
Frontend
Frontend Related Issue
⚡Important
High-impact issue that needs to be resolved before the next release
Refactor
Code Improvement
Milestone
Remove any old numeric toggles (
requiredUserDetailsOption
), adopt typed data models (e.g.CreateDocumentLinkPayload
), and dynamically render checkboxes for “Name,” “Email,” etc. fromvisitorFieldsConfig.ts
. The user can also set alias, password (if not public), expirationTime, etc.Detailed Tasks
Create or Update
CreateDocumentLinkPayload
src/shared/models/links.ts
or a similar path.alias
,isPublic
,expirationTime
,visitorFields
(as an array of strings), etc.Use
visitorFieldsConfig.ts
CreateLink.tsx
, import the config keys (e.g.visitorFieldKeys
) to render checkboxes for each potential field.visitorFields: string[]
in the request payload.Typed useState
useState({ alias: '', ... })
, define an interface, e.g.CreateLinkFormValues
. Example:const [values, setValues] = useState<CreateLinkFormValues>({...})
.Expiration Handling
expirationTime
as an ISO string or omit it if not set.Remove Numeric Toggles
requiredUserDetailsOption=1|2
. Use the new dynamic checkboxes approach.Validation (Optional)
useValidatedFormData
or a similar approach to ensure typed form data, minimal password length, etc.Acceptance Criteria
CreateDocumentLinkPayload
model is defined undersrc/shared/models/links.ts
.visitorFields
.visitorFieldsConfig.ts
, storing the user’s selected fields in state.sx
props or small shared components.The text was updated successfully, but these errors were encountered: