Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/components/shared/DelegationTooltip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { type DelegationWithCompactTenants } from '@/api/api.generatedTypes'
import { AuthHooks } from '@/api/auth'
import { AltRoute } from '@mui/icons-material'
import { Tooltip } from '@mui/material'
import React from 'react'
import { useTranslation } from 'react-i18next'

type DelegationTooltipProps = {
delegation: DelegationWithCompactTenants
}

export const DelegationTooltip: React.FC<DelegationTooltipProps> = ({ delegation }) => {
const { t } = useTranslation('shared-components', { keyPrefix: 'delegationTooltip' })
const { jwt } = AuthHooks.useJwt()

const isDelegator = Boolean(delegation.delegator.id === jwt?.organizationId)
const delegator = delegation.delegator.name
const delegate = delegation.delegate.name

const label = isDelegator
? t('label.delegator', { delegate })
: t('label.delegate', { delegator })

return (
<Tooltip title={label}>
<AltRoute
color="primary"
sx={{
rotate: '90deg',
height: 18,
width: 18,
}}
/>
</Tooltip>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
} from '@pagopa/interop-fe-commons'
import type { GetProducerEServicesParams } from '@/api/api.generatedTypes'
import { AuthHooks } from '@/api/auth'
import PlusOneIcon from '@mui/icons-material/PlusOne'
import UploadFileIcon from '@mui/icons-material/UploadFile'
import type { ActionItemButton } from '@/types/common.types'
import { useDrawerState } from '@/hooks/useDrawerState'
import { ProviderEServiceImportVersionDrawer } from './components/ProviderEServiceImportVersionDrawer'
import { keepPreviousData, useQuery } from '@tanstack/react-query'
import FiberNew from '@mui/icons-material/FiberNew'

const ProviderEServiceListPage: React.FC = () => {
const { t } = useTranslation('pages', { keyPrefix: 'providerEServiceList' })
Expand Down Expand Up @@ -69,7 +69,7 @@ const ProviderEServiceListPage: React.FC = () => {
action: () => navigate('PROVIDE_ESERVICE_CREATE'),
label: tCommon('createNewBtn'),
variant: 'contained',
icon: PlusOneIcon,
icon: FiberNew,
},
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { TableRow } from '@pagopa/interop-fe-commons'
import type { EServiceDescriptorState, ProducerEService } from '@/api/api.generatedTypes'
import { AuthHooks } from '@/api/auth'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { ByDelegationChip } from '@/components/shared/ByDelegationChip'
import { NotificationBadgeDot } from '@/components/shared/NotificationBadgeDot/NotificationBadgeDot'
import { DelegationTooltip } from '@/components/shared/DelegationTooltip'

type EServiceTableRow = {
eservice: ProducerEService
Expand Down Expand Up @@ -69,10 +69,10 @@ export const EServiceTableRow: React.FC<EServiceTableRow> = ({ eservice }) => {
<TableRow
cellData={[
isEServiceByDelegation ? (
<Stack direction="row" spacing={1}>
<Stack direction="row" alignItems={'center'} spacing={1}>
{eservice.hasUnreadNotifications && <NotificationBadgeDot />}
<Typography variant="body2">{eservice.name}</Typography>
<ByDelegationChip tenantRole={isDelegator ? 'DELEGATOR' : 'DELEGATE'} />
{eservice.delegation && <DelegationTooltip delegation={eservice.delegation} />}
</Stack>
) : (
<Stack direction="row" alignItems="center">
Expand Down
7 changes: 7 additions & 0 deletions src/static/locales/en/shared-components.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@
"delegate": "Received by Delegation"
}
},
"delegationTooltip": {
"label": {
"default": "By Delegation",
"delegator": "Delegated to {{delegate}}",
"delegate": "Received by Delegation by {{delegator}}"
}
},
"riskAnalysis": {
"formComponents": {
"emptyLabel": "No values available",
Expand Down
7 changes: 7 additions & 0 deletions src/static/locales/it/shared-components.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@
"delegate": "Ricevuto in delega"
}
},
"delegationTooltip": {
"label": {
"default": "In delega",
"delegator": "Delegato a {{delegate}}",
"delegate": "Ricevuto in delega da {{delegator}}"
}
},
"riskAnalysis": {
"formComponents": {
"emptyLabel": "Nessun valore disponibile",
Expand Down
Loading