Skip to content

Commit 6ff61c6

Browse files
authored
Minor tweaks to sv ui (#3243)
Signed-off-by: fayi-da <fayimora.femibalogun@digitalasset.com>
1 parent 9dca8c0 commit 6ff61c6

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
import { ContractId } from '@daml/types';
1010
import { VoteRequest } from '@daml.js/splice-dso-governance/lib/Splice/DsoRules';
1111
import { MemoryRouter } from 'react-router-dom';
12+
import dayjs from 'dayjs';
13+
import { dateTimeFormatISO } from '@lfdecentralizedtrust/splice-common-frontend-utils';
1214

1315
const requests: ActionRequiredData[] = [
1416
{
@@ -67,11 +69,13 @@ describe('Action Required', () => {
6769
});
6870

6971
test('should render action required request details', () => {
72+
const createdDate = dayjs().format(dateTimeFormatISO);
73+
const closesDate = dayjs().add(10, 'days').format(dateTimeFormatISO);
7074
const actionRequired = {
7175
actionName: 'Feature Application',
7276
contractId: '2abcde123456' as ContractId<VoteRequest>,
73-
votingCloses: '2029-09-25 11:00',
74-
createdAt: '2029-09-25 11:00',
77+
votingCloses: closesDate,
78+
createdAt: createdDate,
7579
requester: 'sv1',
7680
};
7781

@@ -91,7 +95,7 @@ describe('Action Required', () => {
9195

9296
const votingCloses = screen.getByTestId('action-required-voting-closes-content');
9397
expect(votingCloses).toBeDefined();
94-
expect(votingCloses.textContent).toBe(actionRequired.votingCloses);
98+
expect(votingCloses.textContent).toBe('10 days');
9599

96100
const requester = screen.getByTestId('action-required-requester-identifier-party-id');
97101
expect(requester).toBeDefined();

apps/sv/frontend/src/components/form-components/EffectiveDateField.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const EffectiveDateField: React.FC<EffectiveDateFieldProps> = props => {
6262
<FormControlLabel
6363
value="custom"
6464
control={<Radio />}
65-
label={<Typography>Custom</Typography>}
65+
label={<Typography>Date</Typography>}
6666
/>
6767

6868
{currentType === 'custom' && (
@@ -107,7 +107,7 @@ export const EffectiveDateField: React.FC<EffectiveDateFieldProps> = props => {
107107
<Box>
108108
<Typography>Make effective at threshold</Typography>
109109
<Typography variant="body2" color="text.secondary">
110-
This will allow the vote proposal to take effect immediately when 2/3 vote in favor
110+
Allow the vote proposal to take effect immediately when 2/3 vote in favor
111111
</Typography>
112112
</Box>
113113
}

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { Alert, Box, Grid, Stack, Typography } from '@mui/material';
77
import { Link as RouterLink } from 'react-router-dom';
88
import { MemberIdentifier, PageSectionHeader } from '../../components/beta';
99
import React from 'react';
10+
import dayjs from 'dayjs';
11+
import relativeTime from 'dayjs/plugin/relativeTime';
12+
13+
dayjs.extend(relativeTime);
1014

1115
export interface ActionRequiredData {
1216
contractId: ContractId<VoteRequest>;
@@ -68,6 +72,7 @@ interface ActionCardProps {
6872

6973
const ActionCard = (props: ActionCardProps) => {
7074
const { action, createdAt, contractId, votingEnds, requester, isYou } = props;
75+
const remainingTime = dayjs(votingEnds).fromNow(true);
7176

7277
return (
7378
<RouterLink to={`/governance-beta/proposals/${contractId}`} style={{ textDecoration: 'none' }}>
@@ -98,8 +103,8 @@ const ActionCard = (props: ActionCardProps) => {
98103
</Grid>
99104
<Grid size={2}>
100105
<ActionCardSegment
101-
title="THRESHOLD DEADLINE"
102-
content={votingEnds}
106+
title="REMAINING TIME"
107+
content={remainingTime}
103108
data-testid="action-required-voting-closes"
104109
/>
105110
</Grid>

0 commit comments

Comments
 (0)