Skip to content

Commit

Permalink
Simplify highlightBorderColor in product type (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattinannt committed Aug 7, 2023
1 parent 370041b commit 89dae8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
24 changes: 13 additions & 11 deletions apps/web/components/preview/MultipleChoiceMultiQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@ export default function MultipleChoiceMultiQuestion({
.map((choice) => choice.label);

useEffect(() => {
if(Array.isArray(storedResponseValue)){
if (Array.isArray(storedResponseValue)) {
const nonOtherSavedChoices = storedResponseValue?.filter((answer) =>
nonOtherChoiceLabels.includes(answer)
);
const savedOtherSpecified = storedResponseValue?.find((answer) => !nonOtherChoiceLabels.includes(answer));

setSelectedChoices(nonOtherSavedChoices ?? []);

if (savedOtherSpecified) {
setOtherSpecified(savedOtherSpecified);
setShowOther(true);
nonOtherChoiceLabels.includes(answer)
);
const savedOtherSpecified = storedResponseValue?.find(
(answer) => !nonOtherChoiceLabels.includes(answer)
);

setSelectedChoices(nonOtherSavedChoices ?? []);

if (savedOtherSpecified) {
setOtherSpecified(savedOtherSpecified);
setShowOther(true);
}
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [storedResponseValue, question.id]);

Expand Down
6 changes: 4 additions & 2 deletions packages/types/v1/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export const ZProduct = z.object({
name: z.string(),
teamId: z.string(),
brandColor: z.string().regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/),
highlightBorderColor: z.union([z.string().regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/), z.null()]),

highlightBorderColor: z
.string()
.regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)
.nullable(),
recontactDays: z.number().int(),
formbricksSignature: z.boolean(),
placement: z.enum(["bottomLeft", "bottomRight", "topLeft", "topRight", "center"]),
Expand Down

2 comments on commit 89dae8f

@vercel
Copy link

@vercel vercel bot commented on 89dae8f Aug 7, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 89dae8f Aug 7, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

formbricks-com – ./apps/formbricks-com

formbricks-com-git-main-formbricks.vercel.app
www.formbricks.com
formbricks-com-formbricks.vercel.app
formbricks-com.vercel.app
formbricks.com

Please sign in to comment.