Localization of actions (#9934)

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
Félix Malfait
2025-01-30 17:00:35 +01:00
committed by GitHub
parent 385bf591cf
commit 9ec524213c
49 changed files with 3391 additions and 1311 deletions

View File

@ -6,6 +6,8 @@ import { useDeleteOneWorkflowVersion } from '@/workflow/hooks/useDeleteOneWorkfl
import { useRunWorkflowVersion } from '@/workflow/hooks/useRunWorkflowVersion';
import { useWorkflowWithCurrentVersion } from '@/workflow/hooks/useWorkflowWithCurrentVersion';
import { useTheme } from '@emotion/react';
import { useLingui } from '@lingui/react/macro';
import {
Button,
IconPlayerPlay,
@ -22,6 +24,7 @@ export const RecordShowPageWorkflowHeader = ({
}: {
workflowId: string;
}) => {
const { t } = useLingui();
const workflowWithCurrentVersion = useWorkflowWithCurrentVersion(workflowId);
const isWaitingForWorkflowWithCurrentVersion =
@ -44,7 +47,7 @@ export const RecordShowPageWorkflowHeader = ({
return (
<>
<Button
title="Test"
title={t`Test`}
variant="secondary"
Icon={IconPlayerPlay}
disabled={isWaitingForWorkflowWithCurrentVersion}
@ -52,10 +55,9 @@ export const RecordShowPageWorkflowHeader = ({
assertWorkflowWithCurrentVersionIsDefined(workflowWithCurrentVersion);
if (!canWorkflowBeTested) {
enqueueSnackBar('Workflow cannot be tested', {
enqueueSnackBar(t`Workflow cannot be tested`, {
variant: SnackBarVariant.Error,
detailedMessage:
'Trigger type should be Manual - when no record(s) are selected',
detailedMessage: t`Trigger type should be Manual - when no record(s) are selected`,
icon: (
<IconSettingsAutomation
size={16}
@ -75,7 +77,7 @@ export const RecordShowPageWorkflowHeader = ({
{workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' &&
workflowWithCurrentVersion.versions?.length > 1 ? (
<Button
title="Discard Draft"
title={t`Discard Draft`}
variant="secondary"
Icon={IconTrash}
disabled={isWaitingForWorkflowWithCurrentVersion}
@ -94,7 +96,7 @@ export const RecordShowPageWorkflowHeader = ({
{workflowWithCurrentVersion?.currentVersion?.status === 'DRAFT' ||
workflowWithCurrentVersion?.currentVersion?.status === 'DEACTIVATED' ? (
<Button
title="Activate"
title={t`Activate`}
variant="secondary"
Icon={IconPower}
disabled={isWaitingForWorkflowWithCurrentVersion}
@ -111,7 +113,7 @@ export const RecordShowPageWorkflowHeader = ({
/>
) : workflowWithCurrentVersion?.currentVersion?.status === 'ACTIVE' ? (
<Button
title="Deactivate"
title={t`Deactivate`}
variant="secondary"
Icon={IconPlayerStop}
disabled={isWaitingForWorkflowWithCurrentVersion}

View File

@ -4,6 +4,7 @@ import { ComponentDecorator } from 'twenty-ui';
import { RecordShowPageWorkflowHeader } from '@/workflow/components/RecordShowPageWorkflowHeader';
import { expect, within } from '@storybook/test';
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
@ -12,6 +13,7 @@ const meta: Meta<typeof RecordShowPageWorkflowHeader> = {
title: 'Modules/Workflow/RecordShowPageWorkflowHeader',
component: RecordShowPageWorkflowHeader,
decorators: [
I18nFrontDecorator,
ComponentDecorator,
ObjectMetadataItemsDecorator,
SnackBarDecorator,