-
Notifications
You must be signed in to change notification settings - Fork 2
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
hotfix/pin-5752-hide-signal-hub-eservices #1025
Conversation
src/pages/ConsumerEServiceCatalogPage/components/CatalogCard.tsx
Outdated
Show resolved
Hide resolved
const sxCardProps: SxProps = | ||
disabled === true | ||
? { | ||
height: '100%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
minHeight: 410, | ||
opacity: 0.5, | ||
} | ||
: { | ||
height: '100%', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
minHeight: 410, | ||
} |
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 sxCardProps: SxProps = | |
disabled === true | |
? { | |
height: '100%', | |
display: 'flex', | |
flexDirection: 'column', | |
minHeight: 410, | |
opacity: 0.5, | |
} | |
: { | |
height: '100%', | |
display: 'flex', | |
flexDirection: 'column', | |
minHeight: 410, | |
} | |
const sxCardProps: SxProps = { | |
height: '100%', | |
display: 'flex', | |
flexDirection: 'column', | |
minHeight: 410, | |
opacity: disabled ? 0.5 : 1, | |
} |
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.
This could be simplified as such.
Plus, since it is used just once, I would put it "inside" the prop
const linkEservice = ( | ||
<> | ||
<Tooltip key="subscribe-tooltip" title={disabled ? t('subscribeTooltip') : ''} arrow> | ||
<span> | ||
<Link | ||
as="button" | ||
size="small" | ||
variant="contained" | ||
to="SUBSCRIBE_CATALOG_VIEW" | ||
params={{ | ||
eserviceId: eservice.id, | ||
descriptorId: eservice.activeDescriptor?.id ?? '', | ||
}} | ||
onFocusVisible={handlePrefetch} | ||
color="primary" | ||
disabled={disabled} | ||
> | ||
{tCommon('actions.inspect')} | ||
</Link> | ||
</span> | ||
</Tooltip> | ||
</> | ||
) |
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.
Why did you extract it in a separate constant?
The React fragments and the key prop are not needed.
To make the Tooltip "optional" you need to pass the open prop and optionally pass false
or undefined
, you can see an example here /src/components/shared/StepActions.tsx
.
You can also remove the ternary on the title prop
src/config/constants.ts
Outdated
export const SH_ESERVICES_ATT_TEMP = ['9b6993ee-60e3-4901-9a32-e6987d690ec4'] //signal hub eservices to hide | ||
export const SH_ESERVICES_UAT_TEMP = [ | ||
//signal hub eservices to hide | ||
'7ab0a0fc-7d22-4007-b2f3-fddd68fe2f17', | ||
'e8c087eb-627b-4488-a9b7-65b70fd1301b', | ||
'407edf51-23b5-462b-af6e-128bbaa4d9ff', | ||
'3b0fbe47-2e2c-4d8b-9cff-b2381c92d003', | ||
'260e45e1-9a61-49d6-8b6d-da0643da68ac', | ||
'a2b84a6e-34cf-44ca-85a4-de21fd232668', | ||
'6b14c622-dad2-44ea-82bc-2dd4010364d5', | ||
'03c34a8a-a79a-4928-9afc-8647eefabdb1', | ||
] |
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 would make this more flexible:
export const SH_ESERVICES_TO_HIDE: Partial<Record<PagoPAEnvVars['STAGE'], Array<string>>> = {
ATT: ['9b6993ee-60e3-4901-9a32-e6987d690ec4'],
UAT: [
'7ab0a0fc-7d22-4007-b2f3-fddd68fe2f17',
'e8c087eb-627b-4488-a9b7-65b70fd1301b',
'407edf51-23b5-462b-af6e-128bbaa4d9ff',
'3b0fbe47-2e2c-4d8b-9cff-b2381c92d003',
'260e45e1-9a61-49d6-8b6d-da0643da68ac',
'a2b84a6e-34cf-44ca-85a4-de21fd232668',
'6b14c622-dad2-44ea-82bc-2dd4010364d5',
'03c34a8a-a79a-4928-9afc-8647eefabdb1',
],
}
This would also semplify the logic that uses those
{(STAGE === 'ATT' && | ||
SH_ESERVICES_ATT_TEMP.some( | ||
(shEservice) => shEservice === eservice.activeDescriptor?.id | ||
)) || | ||
(STAGE === 'UAT' && | ||
SH_ESERVICES_UAT_TEMP.some( | ||
(shEservice) => shEservice === eservice.activeDescriptor?.id | ||
)) ? ( | ||
<CatalogCard key={eservice.activeDescriptor?.id} eservice={eservice} disabled={true} /> | ||
) : ( | ||
<CatalogCard key={eservice.activeDescriptor?.id} eservice={eservice} disabled={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.
{(STAGE === 'ATT' && | |
SH_ESERVICES_ATT_TEMP.some( | |
(shEservice) => shEservice === eservice.activeDescriptor?.id | |
)) || | |
(STAGE === 'UAT' && | |
SH_ESERVICES_UAT_TEMP.some( | |
(shEservice) => shEservice === eservice.activeDescriptor?.id | |
)) ? ( | |
<CatalogCard key={eservice.activeDescriptor?.id} eservice={eservice} disabled={true} /> | |
) : ( | |
<CatalogCard key={eservice.activeDescriptor?.id} eservice={eservice} disabled={false} /> | |
)} | |
<CatalogCard | |
key={eservice.activeDescriptor?.id} | |
eservice={eservice} | |
disabled={!!SH_ESERVICES_TO_HIDE[STAGE]?.includes(eservice.id)} | |
/> |
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.
Are the SH_ESERVICES_TO_HIDE
eservice or descriptor ids?
Co-authored-by: Carmine Porricelli <[email protected]>
…om:pagopa/pdnd-interop-frontend into feature/pin-5752-hide-signal-hub-eservices
{disabled ? ( | ||
<Tooltip open={disabled ? undefined : false} title={t('subscribeTooltip')} arrow> | ||
<span> | ||
<Link | ||
as="button" | ||
size="small" | ||
variant="contained" | ||
to="SUBSCRIBE_CATALOG_VIEW" | ||
params={{ | ||
eserviceId: eservice.id, | ||
descriptorId: eservice.activeDescriptor?.id ?? '', | ||
}} | ||
onFocusVisible={handlePrefetch} | ||
color="primary" | ||
disabled={disabled} | ||
> | ||
{tCommon('actions.inspect')} | ||
</Link> | ||
</span> | ||
</Tooltip> | ||
) : ( | ||
<span> | ||
<Link | ||
as="button" | ||
size="small" | ||
variant="contained" | ||
to="SUBSCRIBE_CATALOG_VIEW" | ||
params={{ | ||
eserviceId: eservice.id, | ||
descriptorId: eservice.activeDescriptor?.id ?? '', | ||
}} | ||
onFocusVisible={handlePrefetch} | ||
color="primary" | ||
disabled={disabled} | ||
> | ||
{tCommon('actions.inspect')} | ||
</Link> | ||
</span> | ||
)} |
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 is no need to put the ternary here
Quality Gate passedIssues Measures |
Added check on eservices ids to hide signal hub eservices