Conversation
c94248b to
0573974
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes and refactors the form preview/fillout experience by renaming the user fillout page component, extracting reusable UI subcomponents (header/structure/preview section), and updating admin form detail actions to better reflect draft vs published behavior.
Changes:
- Rename user fillout page from
FormDetailPagetoFormFilloutPageand update routing/exports accordingly. - Extract
FormHeader,FormStructure, andFormPreviewSectioncomponents and reuse them in user fillout + admin preview pages. - Update admin form detail actions: draft shows preview; published shows view + copy-link button.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/UserRouter.tsx | Route /forms/:formId/:responseId now renders FormFilloutPage. |
| src/features/form/components/index.ts | Barrel export updated: remove FormDetailPage, add FormFilloutPage. |
| src/features/form/components/FormQuestionRenderer.tsx | Switch CSS module import to FormFilloutPage.module.css. |
| src/features/form/components/FormFilloutPage.tsx | Refactor to use extracted header/structure/preview components; rename export. |
| src/features/form/components/FormFilloutPage.module.css | Remove header/structure styles moved into extracted component CSS modules. |
| src/features/form/components/FormDetail/components/FormHeader/FormHeader.tsx | New reusable header component for form title/description/section header/save state. |
| src/features/form/components/FormDetail/components/FormHeader/FormHeader.module.css | Styles for FormHeader. |
| src/features/form/components/FormDetail/components/FormStructure/FormStructure.tsx | New reusable form-structure/workflow navigation component. |
| src/features/form/components/FormDetail/components/FormStructure/FormStructure.module.css | Styles for FormStructure. |
| src/features/form/components/FormDetail/components/FormPreviewSection/FormPreviewSection.tsx | New reusable preview section for both response-backed and local preview modes. |
| src/features/form/components/FormDetail/components/FormPreviewSection/FormPreviewSection.module.css | Styles for FormPreviewSection. |
| src/features/form/components/AdminFormPreviewPage.tsx | Reuse extracted components; align styling with FormFilloutPage. |
| src/features/form/components/AdminFormDetailPage.tsx | Add “copy fillout link” action for published forms; adjust draft/published button logic. |
Comments suppressed due to low confidence (1)
src/features/form/components/AdminFormPreviewPage.tsx:132
- The inline comment says this is the same layout as
FormDetailPage, but the user-facing page/component was renamed toFormFilloutPagein this PR. Please update the comment to match the current component name to avoid confusion during future maintenance.
{/* Same visual layout as FormDetailPage */}
<div className={styles.content}>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <h1 className={styles.title}>{title}</h1> | ||
| {currentStep === 0 && formDescription && <div className={styles.description} dangerouslySetInnerHTML={{ __html: formDescription }} />} | ||
| <h2 className={styles.sectionHeader}>{currentSection?.title}</h2> | ||
| {currentSection?.description && <div className={styles.sectionDescription} dangerouslySetInnerHTML={{ __html: currentSection.description }} />} |
There was a problem hiding this comment.
FormHeader renders formDescription/currentSection.description via dangerouslySetInnerHTML without any sanitization. In this PR it’s now used by AdminFormPreviewPage too (previously plain text), which increases stored-XSS risk if those fields can contain user-controlled HTML. Consider sanitizing before rendering or rendering as plain text/Markdown with a sanitizer.
elvisdragonmao
left a comment
There was a problem hiding this comment.
然後請問 component 可以幫我搬出來不要多一個資料夾嗎?
| font-size: 0.9rem; | ||
| } | ||
|
|
||
| .spinningIcon { |
There was a problem hiding this comment.
有 LoadingSpinner component 喔
Type of changes
Purpose