diff --git a/packages/admin-portal/src/components/keys-ceremony/TrusteeWizard.tsx b/packages/admin-portal/src/components/keys-ceremony/TrusteeWizard.tsx index 20b4b782bda..e58e7fdc24d 100644 --- a/packages/admin-portal/src/components/keys-ceremony/TrusteeWizard.tsx +++ b/packages/admin-portal/src/components/keys-ceremony/TrusteeWizard.tsx @@ -37,11 +37,16 @@ const hasTrusteeCheckedKeys = ( authContext: AuthContextValues ) => { const status: IExecutionStatus = ceremony.status - return status.trustees.find( + return status.trustees.some( (trustee) => trustee.name === authContext.trustee && trustee.status === TStatus.KEY_CHECKED ) } +export const isTrusteeActionable = ( + ceremony: Sequent_Backend_Keys_Ceremony, + authContext: AuthContextValues +) => isTrusteeParticipating(ceremony, authContext) && !hasTrusteeCheckedKeys(ceremony, authContext) + interface TrusteeWizardProps { electionEvent?: Sequent_Backend_Election_Event currentCeremony: Sequent_Backend_Keys_Ceremony diff --git a/packages/admin-portal/src/resources/ElectionEvent/EditElectionEventKeys.tsx b/packages/admin-portal/src/resources/ElectionEvent/EditElectionEventKeys.tsx index 68c5ad02b28..f29713d2750 100644 --- a/packages/admin-portal/src/resources/ElectionEvent/EditElectionEventKeys.tsx +++ b/packages/admin-portal/src/resources/ElectionEvent/EditElectionEventKeys.tsx @@ -23,10 +23,10 @@ import { FunctionField, RaRecord, } from "react-admin" -import {Button, Typography, Chip, Alert, Box} from "@mui/material" +import {Button, Typography, Chip, Alert, Box, Tooltip} from "@mui/material" import {theme, IconButton} from "@sequentech/ui-essentials" import {AdminWizard} from "@/components/keys-ceremony/AdminWizard" -import {TrusteeWizard, isTrusteeParticipating} from "@/components/keys-ceremony/TrusteeWizard" +import {TrusteeWizard, isTrusteeActionable} from "@/components/keys-ceremony/TrusteeWizard" import {statusColor} from "@/components/keys-ceremony/CeremonyStep" import {faPlus} from "@fortawesome/free-solid-svg-icons" import {useTenantStore} from "@/providers/TenantContextProvider" @@ -37,6 +37,7 @@ import {AuthContext, AuthContextValues} from "@/providers/AuthContextProvider" import {IPermissions} from "@/types/keycloak" import FileOpenIcon from "@mui/icons-material/FileOpen" import KeyIcon from "@mui/icons-material/Key" +import DescriptionIcon from "@mui/icons-material/Description" import {ResourceListStyles} from "@/components/styles/ResourceListStyles" import {ListActions} from "../../components/ListActions" import {SettingsContext} from "@/providers/SettingsContextProvider" @@ -99,7 +100,7 @@ const getActiveCeremony = ( if (!keyCeremonies) { return } else { - return keyCeremonies.find((ceremony) => isTrusteeParticipating(ceremony, authContext)) + return keyCeremonies.find((ceremony) => isTrusteeActionable(ceremony, authContext)) } } @@ -241,6 +242,11 @@ export const EditElectionEventKeys: React.FC = (prop } } + const isCeremonyActionable = (id: Identifier): boolean => { + const ceremony = getCeremony(id) + return !!ceremony && isTrusteeActionable(ceremony, authContext) + } + const actions: Action[] = [ { icon: , @@ -248,9 +254,23 @@ export const EditElectionEventKeys: React.FC = (prop showAction: (id: Identifier) => canAdminCeremony && !!getCeremony(id), }, { - icon: , + icon: ( + + + + ), + action: viewTrusteeCeremony, + showAction: (id: Identifier) => canTrusteeCeremony && isCeremonyActionable(id), + }, + { + icon: ( + + + + ), action: viewTrusteeCeremony, - showAction: (id: Identifier) => canTrusteeCeremony && !!getCeremony(id), + showAction: (id: Identifier) => + canTrusteeCeremony && !!getCeremony(id) && !isCeremonyActionable(id), }, ] diff --git a/packages/admin-portal/src/translations/cat.ts b/packages/admin-portal/src/translations/cat.ts index fc485057502..1cc8891b1a7 100644 --- a/packages/admin-portal/src/translations/cat.ts +++ b/packages/admin-portal/src/translations/cat.ts @@ -804,6 +804,10 @@ const catalanTranslation: TranslationType = { statusLabel: "Estat", waitingKeys: "Esperant a la Generació de Claus..", started: "Iniciada en", + actions: { + participate: "Participa en la cerimònia de claus", + view: "Mostra la cerimònia de claus", + }, breadCrumbs: { configure: "Configurar", ceremony: "Cerimònia", diff --git a/packages/admin-portal/src/translations/en.ts b/packages/admin-portal/src/translations/en.ts index a9b07165a64..f49cbacce91 100644 --- a/packages/admin-portal/src/translations/en.ts +++ b/packages/admin-portal/src/translations/en.ts @@ -793,6 +793,10 @@ const englishTranslation = { statusLabel: "Status", waitingKeys: "Waiting for Keys Generation..", started: "Started at", + actions: { + participate: "Participate in Keys Ceremony", + view: "View Keys Ceremony", + }, breadCrumbs: { configure: "Configure", ceremony: "Ceremony", diff --git a/packages/admin-portal/src/translations/es.ts b/packages/admin-portal/src/translations/es.ts index 0ded4af8a8d..77b48984561 100644 --- a/packages/admin-portal/src/translations/es.ts +++ b/packages/admin-portal/src/translations/es.ts @@ -803,6 +803,10 @@ const spanishTranslation: TranslationType = { statusLabel: "Estado", waitingKeys: "Esperando a la Generación de Claves..", started: "Iniciada en", + actions: { + participate: "Participar en la ceremonia de claves", + view: "Ver la ceremonia de claves", + }, breadCrumbs: { configure: "Configurar", ceremony: "Ceremonia", diff --git a/packages/admin-portal/src/translations/eu.ts b/packages/admin-portal/src/translations/eu.ts index 90d406851e8..41fc388c935 100644 --- a/packages/admin-portal/src/translations/eu.ts +++ b/packages/admin-portal/src/translations/eu.ts @@ -798,6 +798,10 @@ const basqueTranslation: TranslationType = { statusLabel: "Egoera", waitingKeys: "Giltzen Sorkuntza itxoiten..", started: "Hasita:", + actions: { + participate: "Parte hartu giltzen zeremonian", + view: "Ikusi giltzen zeremonia", + }, breadCrumbs: { configure: "Konfiguratu", ceremony: "Zeremonia", diff --git a/packages/admin-portal/src/translations/fr.ts b/packages/admin-portal/src/translations/fr.ts index 0ba7f6b9e3a..81361c98b01 100644 --- a/packages/admin-portal/src/translations/fr.ts +++ b/packages/admin-portal/src/translations/fr.ts @@ -803,6 +803,10 @@ const frenchTranslation: TranslationType = { statusLabel: "État", waitingKeys: "En attente de la Génération de Clés..", started: "Commencée à", + actions: { + participate: "Participer à la cérémonie des clés", + view: "Voir la cérémonie des clés", + }, breadCrumbs: { configure: "Configurer", ceremony: "Cérémonie", diff --git a/packages/admin-portal/src/translations/gl.ts b/packages/admin-portal/src/translations/gl.ts index faa93b1f741..49551769c87 100644 --- a/packages/admin-portal/src/translations/gl.ts +++ b/packages/admin-portal/src/translations/gl.ts @@ -802,6 +802,10 @@ const galegoTranslation: TranslationType = { statusLabel: "Estado", waitingKeys: "Esperando a Xeración de Chaves...", started: "Iniciado o", + actions: { + participate: "Participar na cerimonia de chaves", + view: "Ver a cerimonia de chaves", + }, breadCrumbs: { configure: "Configurar", ceremony: "Cerimonia", diff --git a/packages/admin-portal/src/translations/nl.ts b/packages/admin-portal/src/translations/nl.ts index cfe461ab9fb..ad8f5d0ecb7 100644 --- a/packages/admin-portal/src/translations/nl.ts +++ b/packages/admin-portal/src/translations/nl.ts @@ -802,6 +802,10 @@ const dutchTranslation: TranslationType = { statusLabel: "Status", waitingKeys: "Wachten op sleutelgeneratie...", started: "Gestart op", + actions: { + participate: "Deelnemen aan sleutelceremonie", + view: "Sleutelceremonie bekijken", + }, breadCrumbs: { configure: "Configureren", ceremony: "Ceremonie", diff --git a/packages/admin-portal/src/translations/tl.ts b/packages/admin-portal/src/translations/tl.ts index cfeedbbf211..5226d7c7fcc 100644 --- a/packages/admin-portal/src/translations/tl.ts +++ b/packages/admin-portal/src/translations/tl.ts @@ -801,6 +801,10 @@ const tagalogTranslation: TranslationType = { statusLabel: "Katayuan", waitingKeys: "Naghihintay sa Paglikha ng mga Susi..", started: "Nagsimula noong", + actions: { + participate: "Lumahok sa seremonya ng mga susi", + view: "Tingnan ang seremonya ng mga susi", + }, breadCrumbs: { configure: "I-configure", ceremony: "Seremonya",