Skip to content

Commit

Permalink
Merge pull request #1025 from pagopa/feature/pin-5752-hide-signal-hub…
Browse files Browse the repository at this point in the history
…-eservices

hotfix/pin-5752-hide-signal-hub-eservices
  • Loading branch information
Carminepo2 authored Dec 10, 2024
2 parents c3407d4 + cdd9cf4 commit 5c219d8
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interop-dashboard-frontend",
"version": "1.0.78",
"version": "1.0.79",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
15 changes: 15 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PagoPAEnvVars } from '@/types/common.types'
import { getCurrentSelfCareProductId } from '@/utils/common.utils'

export const DEFAULT_LANG = 'it'
Expand Down Expand Up @@ -37,3 +38,17 @@ export const eserviceNamingBestPracticeLink =
'https://italia.github.io/pdnd-guida-nomenclatura-eservice/'
export const keychainGuideLink = `${documentationLink}/manuale-operativo/utilizzare-i-voucher#garanzia-dellintegrita-della-risposta`
export const keychainSetupGuideLink = `${documentationLink}/manuale-operativo/utilizzare-i-voucher#precondizioni`

export const SH_ESERVICES_TO_HIDE_TEMP: 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',
],
}
40 changes: 24 additions & 16 deletions src/pages/ConsumerEServiceCatalogPage/components/CatalogCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ import {
CardHeader,
Skeleton,
Stack,
Tooltip,
Typography,
} from '@mui/material'
import React from 'react'
import { useTranslation } from 'react-i18next'
import AccountBalanceIcon from '@mui/icons-material/AccountBalance'
import type { CatalogEService } from '@/api/api.generatedTypes'
import { useQueryClient } from '@tanstack/react-query'

interface CatalogCardProps {
eservice: CatalogEService
disabled?: boolean
}

export const CatalogCard: React.FC<CatalogCardProps> = ({ eservice }) => {
export const CatalogCard: React.FC<CatalogCardProps> = ({ eservice, disabled }) => {
const { t: tCommon } = useTranslation('common')
const { t } = useTranslation('eservice')
const queryClient = useQueryClient()

const handlePrefetch = () => {
Expand All @@ -39,6 +41,7 @@ export const CatalogCard: React.FC<CatalogCardProps> = ({ eservice }) => {
display: 'flex',
flexDirection: 'column',
minHeight: 410,
opacity: disabled ? 0.5 : 1,
}}
>
<CardHeader
Expand Down Expand Up @@ -75,20 +78,25 @@ export const CatalogCard: React.FC<CatalogCardProps> = ({ eservice }) => {

<CardActions sx={{ justifyContent: 'end', alignItems: 'end', flex: 1 }}>
<Stack direction="row" spacing={2}>
<Link
as="button"
size="small"
variant="contained"
to="SUBSCRIBE_CATALOG_VIEW"
params={{
eserviceId: eservice.id,
descriptorId: eservice.activeDescriptor?.id ?? '',
}}
onFocusVisible={handlePrefetch}
color="primary"
>
<span onPointerEnter={handlePrefetch}>{tCommon('actions.inspect')}</span>
</Link>
<Tooltip open={disabled ? undefined : false} title={t('list.disabledTooltip')} 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>
</Stack>
</CardActions>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React from 'react'
import { CatalogCard, CatalogCardSkeleton } from './CatalogCard'
import { useTranslation } from 'react-i18next'
import type { CatalogEService } from '@/api/api.generatedTypes'
import { STAGE } from '@/config/env'
import { SH_ESERVICES_TO_HIDE_TEMP } from '@/config/constants'

type EServiceCatalogGridProps = {
eservices: Array<CatalogEService> | undefined
Expand All @@ -19,7 +21,11 @@ export const EServiceCatalogGrid: React.FC<EServiceCatalogGridProps> = ({ eservi
<Grid container spacing={3}>
{eservices?.map((eservice) => (
<Grid item key={eservice.id} xs={4}>
<CatalogCard key={eservice.activeDescriptor?.id} eservice={eservice} />
<CatalogCard
key={eservice.activeDescriptor?.id}
eservice={eservice}
disabled={!!SH_ESERVICES_TO_HIDE_TEMP[STAGE]?.includes(eservice.id)}
/>
</Grid>
))}
</Grid>
Expand Down
3 changes: 2 additions & 1 deletion src/static/locales/en/eservice.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@
"ariaLabel": "Switch for acknowledgment and confirmation"
}
}
}
},
"disabledTooltip": "Test e-service archived from the catalog and not usable."
},
"read": {
"tabs": {
Expand Down
3 changes: 2 additions & 1 deletion src/static/locales/it/eservice.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@
"ariaLabel": "Switch di presa visione e conferma"
}
}
}
},
"disabledTooltip": "E-service di test archiviato dal catalogo e non utilizzabile"
},
"read": {
"tabs": {
Expand Down

0 comments on commit 5c219d8

Please sign in to comment.