Skip to content

Commit 356ad24

Browse files
committed
Create IActionSimulationRun interface
Signed-off-by: Milos Dzepina <milos@aragon.org>
1 parent 304690b commit 356ad24

6 files changed

Lines changed: 43 additions & 37 deletions

File tree

src/modules/assets/copy/modulesCopy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const modulesCopy = {
3232
likelyToSucceed: 'Likely to succeed',
3333
likelyToFail: 'Likely to fail',
3434
unknown: 'Unknown',
35-
now: 'Now',
3635
},
3736
proposalActionsContainer: {
3837
emptyHeader: 'No actions added',
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export interface IActionSimulationRun {
2+
timestamp: number;
3+
url: string;
4+
status: 'success' | 'failed';
5+
}
6+
7+
export interface IActionSimulationProps {
8+
/**
9+
* Total number of actions in the proposal.
10+
*/
11+
totalActions: number;
12+
/**
13+
* Last simulation data including timestamp, URL, and status.
14+
*/
15+
lastSimulation?: IActionSimulationRun;
16+
/**
17+
* Whether simulation is currently running.
18+
*/
19+
isLoading?: boolean;
20+
/**
21+
* Whether the proposal can be simulated.
22+
*/
23+
isEnabled?: boolean;
24+
/**
25+
* Callback when simulate again button is clicked.
26+
*/
27+
onSimulate?: () => void;
28+
/**
29+
* Additional class names applied to the wrapper div.
30+
*/
31+
className?: string;
32+
/**
33+
* Optional error message to display.
34+
*/
35+
error?: string;
36+
}

src/modules/components/action/actionSimulation/actionSimulation.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ export const Success: Story = {
3535
/**
3636
* Completed simulation with negative outcome (can't be executed)
3737
*/
38-
export const Failure: Story = {
38+
export const Failed: Story = {
3939
args: {
4040
totalActions: 2,
4141
lastSimulation: {
4242
timestamp: DateTime.now().minus({ seconds: 10 }).toMillis(),
4343
url: 'https://dashboard.tenderly.co/simulation/12345',
44-
status: 'failure',
44+
status: 'failed',
4545
},
4646
},
4747
};

src/modules/components/action/actionSimulation/actionSimulation.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { render, screen } from '@testing-library/react';
22
import { DateTime } from 'luxon';
33
import { GukCoreProvider } from '../../../../core';
4-
import type { IActionSimulationProps } from './actionSimulation';
54
import { ActionSimulation } from './actionSimulation';
5+
import type { IActionSimulationProps } from './actionSimulation.api';
66

77
describe('<ActionSimulation /> component', () => {
88
const createTestComponent = (props?: Partial<IActionSimulationProps>) => {
@@ -60,7 +60,7 @@ describe('<ActionSimulation /> component', () => {
6060
lastSimulation: {
6161
timestamp: DateTime.now().toMillis(),
6262
url: 'https://dashboard.tenderly.co/simulation/12345',
63-
status: 'failure',
63+
status: 'failed',
6464
},
6565
}),
6666
);

src/modules/components/action/actionSimulation/actionSimulation.tsx

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,7 @@ import {
1111
Spinner,
1212
} from '../../../../core';
1313
import { useGukModulesContext } from '../../gukModulesProvider';
14-
15-
export interface IActionSimulationProps {
16-
/**
17-
* Total number of actions in the proposal.
18-
*/
19-
totalActions: number;
20-
/**
21-
* Last simulation data including timestamp, URL, and status.
22-
*/
23-
lastSimulation?: { timestamp: number; url: string; status: 'success' | 'failure' };
24-
/**
25-
* Whether simulation is currently running.
26-
*/
27-
isLoading?: boolean;
28-
/**
29-
* Whether the proposal can be simulated.
30-
*/
31-
isEnabled?: boolean;
32-
/**
33-
* Callback when simulate again button is clicked.
34-
*/
35-
onSimulate?: () => void;
36-
/**
37-
* Additional class names applied to the wrapper div.
38-
*/
39-
className?: string;
40-
/**
41-
* Optional error message to display.
42-
*/
43-
error?: string;
44-
}
14+
import type { IActionSimulationProps } from './actionSimulation.api';
4515

4616
export const ActionSimulation: React.FC<IActionSimulationProps> = (props) => {
4717
const { totalActions, lastSimulation, isLoading, isEnabled = true, onSimulate, className, error } = props;
@@ -58,7 +28,7 @@ export const ActionSimulation: React.FC<IActionSimulationProps> = (props) => {
5828
textColor: 'text-success-800',
5929
variant: 'success' as const,
6030
};
61-
case 'failure':
31+
case 'failed':
6232
return {
6333
icon: IconType.CRITICAL,
6434
label: simulationCopy.likelyToFail,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { ActionSimulation } from './actionSimulation';
2+
export type { IActionSimulationRun } from './actionSimulation.api';

0 commit comments

Comments
 (0)