Skip to content

Commit a541d16

Browse files
committed
try better spacing action required [ci]
Signed-off-by: Paweł Perek <pawel.perek@digitalasset.com>
1 parent e12bd9a commit a541d16

File tree

3 files changed

+44
-29
lines changed

3 files changed

+44
-29
lines changed

apps/sv/frontend/src/__tests__/governance/action-required-section.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ describe('Action Required', () => {
9696
expect(description).toBeInTheDocument();
9797
expect(description.textContent).toBe(actionRequired.description);
9898

99+
const createdAt = screen.getByTestId('action-required-created-at-content');
100+
expect(createdAt).toBeInTheDocument();
101+
expect(createdAt.textContent).toBe(actionRequired.createdAt);
102+
99103
const votingCloses = screen.getByTestId('action-required-voting-closes-content');
100104
expect(votingCloses).toBeInTheDocument();
101105
expect(votingCloses.textContent).toBe('10 days');

apps/sv/frontend/src/components/beta/CopyableIdentifier.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ const CopyableIdentifier: React.FC<CopyableIdentifierProps> = ({
2222
hideCopyButton,
2323
'data-testid': testId,
2424
}) => (
25-
<Box sx={{ display: 'flex', alignItems: 'center', color: 'text.light' }} data-testid={testId}>
25+
<Box
26+
sx={{ display: 'flex', alignItems: 'center', color: 'text.light', minWidth: 0 }}
27+
data-testid={testId}
28+
>
2629
<Typography
2730
variant="body1"
2831
fontWeight="medium"
2932
fontFamily="Source Code Pro"
3033
fontSize={size === 'small' ? '14px' : '18px'}
3134
data-testid={`${testId}-value`}
32-
sx={{ maxWidth: '100%', textOverflow: 'ellipsis', overflow: 'hidden' }}
35+
sx={{ textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }}
3336
>
3437
{value}
3538
</Typography>

apps/sv/frontend/src/components/governance/ActionRequiredSection.tsx

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { VoteRequest } from '@daml.js/splice-dso-governance/lib/Splice/DsoRules';
44
import { ContractId } from '@daml/types';
55
import { East } from '@mui/icons-material';
6-
import { Alert, Box, Grid, Stack, Typography } from '@mui/material';
6+
import { Alert, Box, Stack, Typography } from '@mui/material';
77
import { Link as RouterLink } from 'react-router';
88
import { CopyableIdentifier, MemberIdentifier, PageSectionHeader } from '../../components/beta';
99
import React from 'react';
@@ -55,6 +55,7 @@ export const ActionRequiredSection: React.FC<ActionRequiredProps> = (
5555
key={index}
5656
action={ar.actionName}
5757
description={ar.description}
58+
createdAt={ar.createdAt}
5859
contractId={ar.contractId}
5960
votingEnds={ar.votingCloses}
6061
requester={ar.requester}
@@ -70,14 +71,15 @@ export const ActionRequiredSection: React.FC<ActionRequiredProps> = (
7071
interface ActionCardProps {
7172
action: string;
7273
description: string;
74+
createdAt: string;
7375
contractId: ContractId<VoteRequest>;
7476
votingEnds: string;
7577
requester: string;
7678
isYou?: boolean;
7779
}
7880

7981
const ActionCard = (props: ActionCardProps) => {
80-
const { action, description, contractId, votingEnds, requester, isYou } = props;
82+
const { action, description, createdAt, contractId, votingEnds, requester, isYou } = props;
8183
const remainingTime = dayjs(votingEnds).fromNow(true);
8284

8385
return (
@@ -96,15 +98,15 @@ const ActionCard = (props: ActionCardProps) => {
9698
className="action-required-card"
9799
data-testid="action-required-card"
98100
>
99-
<Grid flexGrow={1} container spacing={1}>
100-
<Grid size={1.5}>
101+
<Stack direction="row" gap={5} alignItems="flex-start">
102+
<Box sx={{ flexShrink: 0 }}>
101103
<ActionCardSegment
102104
title="ACTION"
103105
content={action}
104106
data-testid="action-required-action"
105107
/>
106-
</Grid>
107-
<Grid size={2}>
108+
</Box>
109+
<Box sx={{ flexShrink: 1, minWidth: 0, maxWidth: 200 }}>
108110
<ActionCardSegment
109111
title="DESCRIPTION"
110112
content={
@@ -128,15 +130,22 @@ const ActionCard = (props: ActionCardProps) => {
128130
}
129131
data-testid="action-required-description"
130132
/>
131-
</Grid>
132-
<Grid size={1.5}>
133+
</Box>
134+
<Box sx={{ flexShrink: 0 }}>
135+
<ActionCardSegment
136+
title="CREATED AT"
137+
content={createdAt}
138+
data-testid="action-required-created-at"
139+
/>
140+
</Box>
141+
<Box sx={{ flexShrink: 0 }}>
133142
<ActionCardSegment
134143
title="REMAINING TIME"
135144
content={remainingTime}
136145
data-testid="action-required-voting-closes"
137146
/>
138-
</Grid>
139-
<Grid size={2}>
147+
</Box>
148+
<Box sx={{ flexShrink: 1, minWidth: 0, maxWidth: 300 }}>
140149
<ActionCardSegment
141150
title="REQUESTER"
142151
content={
@@ -149,8 +158,8 @@ const ActionCard = (props: ActionCardProps) => {
149158
}
150159
data-testid="action-required-requester"
151160
/>
152-
</Grid>
153-
<Grid size={2}>
161+
</Box>
162+
<Box sx={{ flexShrink: 1, minWidth: 0, maxWidth: 300 }}>
154163
<ActionCardSegment
155164
title="CONTRACT ID"
156165
content={
@@ -162,21 +171,20 @@ const ActionCard = (props: ActionCardProps) => {
162171
}
163172
data-testid="action-required-contract-id-segment"
164173
/>
165-
</Grid>
166-
<Grid size={3} display="flex" justifyContent="flex-end" alignItems="center">
167-
<Stack
168-
direction="row"
169-
alignItems="center"
170-
gap={1}
171-
data-testid="action-required-view-details"
172-
>
173-
<Typography fontWeight={500} color="text.light">
174-
View Details
175-
</Typography>
176-
<East fontSize="small" color="secondary" />
177-
</Stack>
178-
</Grid>
179-
</Grid>
174+
</Box>
175+
<Stack
176+
direction="row"
177+
alignItems="center"
178+
gap={1}
179+
sx={{ ml: 'auto', flexShrink: 0, alignSelf: 'center' }}
180+
data-testid="action-required-view-details"
181+
>
182+
<Typography fontWeight={500} color="text.light">
183+
View Details
184+
</Typography>
185+
<East fontSize="small" color="secondary" />
186+
</Stack>
187+
</Stack>
180188
</Box>
181189
</RouterLink>
182190
);

0 commit comments

Comments
 (0)