Skip to content

Commit 1cc6e66

Browse files
committed
Rename props
Signed-off-by: Milos Dzepina <milos@aragon.org>
1 parent 2caf8f6 commit 1cc6e66

3 files changed

Lines changed: 35 additions & 31 deletions

File tree

src/modules/components/proposal/proposalActionSimulationStructure/proposalActionSimulationStructure.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const Failure: Story = {
5252
export const Loading: Story = {
5353
args: {
5454
totalActions: 5,
55-
isSimulating: true,
55+
isLoading: true,
5656
},
5757
};
5858

@@ -119,7 +119,7 @@ export const NotSimulatable: Story = {
119119
url: 'https://dashboard.tenderly.co/simulation/12345',
120120
status: 'success',
121121
},
122-
isSimulatable: false,
122+
isEnabled: false,
123123
},
124124
};
125125

src/modules/components/proposal/proposalActionSimulationStructure/proposalActionSimulationStructure.test.tsx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,29 @@ describe('<ProposalActionSimulationStructure /> component', () => {
4343

4444
it('renders relative time for recent simulation', () => {
4545
const recentTime = DateTime.now().minus({ days: 2 });
46-
render(createTestComponent({
47-
lastSimulation: {
48-
timestamp: recentTime.toMillis(),
49-
url: 'https://dashboard.tenderly.co/simulation/12345',
50-
status: 'success'
51-
}
52-
}));
46+
render(
47+
createTestComponent({
48+
lastSimulation: {
49+
timestamp: recentTime.toMillis(),
50+
url: 'https://dashboard.tenderly.co/simulation/12345',
51+
status: 'success',
52+
},
53+
}),
54+
);
5355
expect(screen.getByText('2 days ago')).toBeInTheDocument();
5456
});
5557

5658
it('renders "Now" for very recent simulation', () => {
5759
const veryRecentTime = DateTime.now().minus({ seconds: 30 });
58-
render(createTestComponent({
59-
lastSimulation: {
60-
timestamp: veryRecentTime.toMillis(),
61-
url: 'https://dashboard.tenderly.co/simulation/12345',
62-
status: 'success'
63-
}
64-
}));
60+
render(
61+
createTestComponent({
62+
lastSimulation: {
63+
timestamp: veryRecentTime.toMillis(),
64+
url: 'https://dashboard.tenderly.co/simulation/12345',
65+
status: 'success',
66+
},
67+
}),
68+
);
6569
expect(screen.getByText('Now')).toBeInTheDocument();
6670
});
6771

@@ -71,8 +75,8 @@ describe('<ProposalActionSimulationStructure /> component', () => {
7175
lastSimulation: {
7276
timestamp: DateTime.now().toMillis(),
7377
url: 'https://dashboard.tenderly.co/simulation/12345',
74-
status: 'success'
75-
}
78+
status: 'success',
79+
},
7680
}),
7781
);
7882
expect(screen.getByText('Likely to succeed')).toBeInTheDocument();
@@ -84,8 +88,8 @@ describe('<ProposalActionSimulationStructure /> component', () => {
8488
lastSimulation: {
8589
timestamp: DateTime.now().toMillis(),
8690
url: 'https://dashboard.tenderly.co/simulation/12345',
87-
status: 'failure'
88-
}
91+
status: 'failure',
92+
},
8993
}),
9094
);
9195
expect(screen.getByText('Likely to fail')).toBeInTheDocument();
@@ -99,7 +103,7 @@ describe('<ProposalActionSimulationStructure /> component', () => {
99103
it('renders loading state when execution status is loading', () => {
100104
render(
101105
createTestComponent({
102-
isSimulating: true,
106+
isLoading: true,
103107
}),
104108
);
105109

@@ -113,7 +117,7 @@ describe('<ProposalActionSimulationStructure /> component', () => {
113117
});
114118

115119
it('hides simulate button when isSimulatable is false', () => {
116-
render(createTestComponent({ isSimulatable: false }));
120+
render(createTestComponent({ isEnabled: false }));
117121

118122
expect(screen.queryByText(/simulate/i)).toBeNull();
119123
});

src/modules/components/proposal/proposalActionSimulationStructure/proposalActionSimulationStructure.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export interface IProposalActionSimulationStructureProps {
2525
/**
2626
* Whether simulation is currently running.
2727
*/
28-
isSimulating?: boolean;
28+
isLoading?: boolean;
2929
/**
3030
* Whether the proposal can be simulated.
3131
*/
32-
isSimulatable?: boolean;
32+
isEnabled?: boolean;
3333
/**
3434
* Callback when simulate again button is clicked.
3535
*/
@@ -46,7 +46,7 @@ export interface IProposalActionSimulationStructureProps {
4646
}
4747

4848
export const ProposalActionSimulationStructure: React.FC<IProposalActionSimulationStructureProps> = (props) => {
49-
const { totalActions, lastSimulation, isSimulating, isSimulatable = true, onSimulate, className, error } = props;
49+
const { totalActions, lastSimulation, isLoading, isEnabled = true, onSimulate, className, error } = props;
5050

5151
const { copy } = useGukModulesContext();
5252
const simulationCopy = copy.proposalActionSimulationStructure;
@@ -104,7 +104,7 @@ export const ProposalActionSimulationStructure: React.FC<IProposalActionSimulati
104104
</DefinitionList.Item>
105105

106106
<DefinitionList.Item term={copy.proposalActionSimulationStructure.lastSimulationTerm}>
107-
{isSimulating ? (
107+
{isLoading ? (
108108
<span className="text-primary-400 flex items-center gap-2 md:gap-3">
109109
<Spinner size="md" variant="primary" />
110110
{simulationCopy.simulating}
@@ -117,7 +117,7 @@ export const ProposalActionSimulationStructure: React.FC<IProposalActionSimulati
117117
<DefinitionList.Item term={copy.proposalActionSimulationStructure.executableTerm}>
118118
<div className="flex w-full items-center justify-between">
119119
<div className="flex items-center gap-2">
120-
{isSimulating ? (
120+
{isLoading ? (
121121
<span className="text-primary-400 flex items-center gap-2 md:gap-3">
122122
<Spinner size="md" variant="primary" />
123123
{simulationCopy.simulating}
@@ -139,12 +139,12 @@ export const ProposalActionSimulationStructure: React.FC<IProposalActionSimulati
139139

140140
<div
141141
className={classNames('flex flex-col gap-2 md:flex-row md:justify-between', {
142-
'md:justify-end': !isSimulatable,
142+
'md:justify-end': !isEnabled,
143143
})}
144144
>
145-
{isSimulatable && (
146-
<Button variant="secondary" size="md" onClick={onSimulate} isLoading={isSimulating}>
147-
{isSimulating
145+
{isEnabled && (
146+
<Button variant="secondary" size="md" onClick={onSimulate} isLoading={isLoading}>
147+
{isLoading
148148
? copy.proposalActionSimulationStructure.simulating
149149
: lastSimulation
150150
? copy.proposalActionSimulationStructure.simulateAgain

0 commit comments

Comments
 (0)