-
Notifications
You must be signed in to change notification settings - Fork 0
Manage multiple cta in service create update #1363
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
base: master
Are you sure you want to change the base?
Manage multiple cta in service create update #1363
Conversation
🦋 Changeset detectedLatest commit: 94e83a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Coverage Report for App Backend (./apps/app-backend)
File CoverageNo changed files found. |
Coverage Report for Backoffice Backend (./apps/backoffice)
File Coverage
|
Coverage Report for Webapp (./apps/io-services-cms-webapp)
File CoverageNo changed files found. |
Coverage Report for External Clients (./packages/external-clients)
File CoverageNo changed files found. |
Coverage Report for Models (./packages/io-services-cms-models)
File CoverageNo changed files found. |
apps/backoffice/src/components/services/service-create-update/service-extra-configurator.tsx
Outdated
Show resolved
Hide resolved
Like this #1352, avoid inserting video in PR body, use a dedicated single comment to insert sample video, and provide a PR description if you find it useful. |
double_cta_complete.mp4 |
apps/backoffice/src/components/cta-manager/service-cta-manager.tsx
Outdated
Show resolved
Hide resolved
urlPrefix: "", | ||
} as const; | ||
|
||
export const SELECT_ITEMS = (t: TFunction) => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SELECT_ITEMS
, of what? Maybe CTA_KIND_SELECT_ITEMS
is more self-explanatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { t } = useTranslation(); | ||
const { setValue, watch } = useFormContext(); | ||
|
||
const hasCta2UrlPrefix = watch("metadata.cta.cta_2.urlPrefix"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'has' assumes a boolean but in this case it returns a string value...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const kind = watch(`metadata.cta.${slot}.urlPrefix`); | ||
const showAddRemove = !(isRemoveActionVisible && slot === "cta_1"); | ||
|
||
const helperCtaInternal = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the need to do a kind check in the const declaration rather than in the component logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/> | ||
) : undefined; | ||
|
||
const labelCtaInternal = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question as helperCtaInternal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Grid item md={6} xs={12}> | ||
<UrlFieldController | ||
hideCheckUrl={ | ||
kind === CTA_PREFIX_URL_SCHEMES.EXTERNAL ? false : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
briefly: kind !== CTA_PREFIX_URL_SCHEMES.EXTERNAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, this is enough: kind !== CTA_PREFIX_URL_SCHEMES.EXTERNAL
(this is yet a boolean response)
There's no need to use the ternary operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
); | ||
}; | ||
|
||
const configureSecondaryCta = (isActionAddEnable: boolean) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little "tricky" to understand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { setValue, watch } = useFormContext(); | ||
|
||
const cta2UrlPrefixValue = watch("metadata.cta.cta_2.urlPrefix"); | ||
const isRemoveActionVisible = cta2UrlPrefixValue !== "" ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here: cta2UrlPrefixValue !== ""
it's enought, is yet a boolean result.
There's no need to use the ternary operator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Resolves IOPAE-2071