Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(form-v2/design-2): logo radio buttons and form color theme selection #4271

Merged
merged 26 commits into from
Jul 25, 2022

Conversation

justynoh
Copy link
Contributor

@justynoh justynoh commented Jul 22, 2022

Problem

This PR implements the form logo uploader tool and color theme selection in the design drawer.

Makes progress towards #3362 and provides parity with angular.

Solution

Breaking Changes

  • No - this PR is backwards compatible

Features:

FileHandlerService.ts, EditImage.tsx, UploadImageInput.tsx

  • Updated type of UploadedFileData.size in FileHandlerService.ts from string to number. As a result, moved stringification of size into EditImage.tsx itself. (Necessary due to form.startPage.logo.fileSizeInBytes being of type number.)
  • Separated attachment type into its own UploadedImage type for reusability with design store.

useFormHeader.tsx

  • Separated color theme computation into a new function getTitleBg for reusability with design store.

StartPageView.tsx, DesignDrawer.tsx, useDesignStore.tsx

  • Update design store types to include customLogoMeta.
  • Add logo and color fields to design drawer.
  • Start page now shows uploaded custom logo preview.

Before & After Screenshots

image

Notes

  • Instructions still not shown in form itself - see issue [[React] Display instructions for form #4236]
  • There is currently still a bug with edit image field and design drawer logo uploads: 1) blob preview returns error due to CSP, and 2) after the field is saved and image uploaded to S3, the image is not loaded in builder due to 403 when fetching from S3 (as tested on staging).

justynoh added 22 commits July 13, 2022 13:51
…om public header for computation of design constants
…to reuse the same FormHeader and FormBannerLogo components.
@justynoh justynoh marked this pull request as ready for review July 22, 2022 06:15
@justynoh justynoh requested review from karrui and timotheeg July 22, 2022 06:25
Comment on lines +16 to +20
export type UploadedImage = {
file?: File
srcUrl?: string
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this type is descriptive enough 🤔? The definition allows a completely empty object, but is that really valid? Or is UploadedImage a union of 2 types, where at least one of the field is present in each?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we can fix this in a separate PR? The type was originally Partial<{ file: File srcUrl: ImageFieldBase['url'] }> which this is equivalent to. But I agree that this type should be more restrictive. This fix would require edits to the startpage and editimage.

@justynoh justynoh requested a review from timotheeg July 25, 2022 05:38
Copy link
Contributor

@timotheeg timotheeg left a comment

Choose a reason for hiding this comment

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

lgtm

@justynoh justynoh merged commit bed00ce into form-v2/develop Jul 25, 2022
@justynoh justynoh deleted the form-v2/feat/builder-startpage-2-new branch July 25, 2022 05:58
@justynoh justynoh mentioned this pull request Oct 5, 2022
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.

2 participants