Skip to content

[CORE-232] Fix form preview page#31

Merged
elvisdragonmao merged 6 commits intomainfrom
fix/CORE-232-form-preview-page
Mar 9, 2026
Merged

[CORE-232] Fix form preview page#31
elvisdragonmao merged 6 commits intomainfrom
fix/CORE-232-form-preview-page

Conversation

@nikkalin1008
Copy link
Contributor

Type of changes

  • Fix

Purpose

  • Change button logic of draft and published forms
  • Add link copy button
  • Refactor page name and split component
  • Fix other preview page problems

@nikkalin1008 nikkalin1008 changed the title Fix/core 232 form preview page [CORE-232] Fix form preview page Mar 5, 2026
@nikkalin1008 nikkalin1008 force-pushed the fix/CORE-232-form-preview-page branch from c94248b to 0573974 Compare March 5, 2026 09:17
@nikkalin1008 nikkalin1008 marked this pull request as ready for review March 5, 2026 15:15
Copilot AI review requested due to automatic review settings March 5, 2026 15:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FormDetailPage to FormFilloutPage and update routing/exports accordingly.
  • Extract FormHeader, FormStructure, and FormPreviewSection components 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 to FormFilloutPage in 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.

Comment on lines +47 to +50
<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 }} />}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@elvisdragonmao elvisdragonmao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

然後請問 component 可以幫我搬出來不要多一個資料夾嗎?

font-size: 0.9rem;
}

.spinningIcon {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有 LoadingSpinner component 喔

@elvisdragonmao elvisdragonmao merged commit 4fa6985 into main Mar 9, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants