Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(APP-3746): Update ProposalDataListItem component to support "advanceable" status #381

Merged
merged 30 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fa1fa2c
feat: implement new statusContext prop for Proposal DLI, remove subco…
thekidnamedkd Jan 7, 2025
1635940
chore: update CHANGELOG
thekidnamedkd Jan 7, 2025
d8dcdf1
chore: self review -- cleanup types, further remove subcomponent usage
thekidnamedkd Jan 8, 2025
671edb6
chore: resolve merge -- update CHANGELOG
thekidnamedkd Jan 8, 2025
9f485c3
chore: self review, update styles to new spec
thekidnamedkd Jan 8, 2025
96f4fcf
chore: adjust utils, types, tests for spp usage
thekidnamedkd Jan 9, 2025
d49c815
chore: prettify
thekidnamedkd Jan 10, 2025
1262fa9
chore: impl advanceable, advanced status
thekidnamedkd Jan 10, 2025
8e9208c
chore: clean up
thekidnamedkd Jan 10, 2025
f6b417c
chore: update ping variant, js docs
thekidnamedkd Jan 13, 2025
26fc0e3
chore: remove advanced
thekidnamedkd Jan 13, 2025
cdce4c1
chore: remove advanced copy
thekidnamedkd Jan 13, 2025
66a53bf
chore: remove advanceable string usage for stage status
thekidnamedkd Jan 13, 2025
167884d
chore: include icon for advanceable
thekidnamedkd Jan 13, 2025
d7cd3d7
chore: resolve PR convos -- CHANGELOG, mappings, tests, etc
thekidnamedkd Jan 13, 2025
24f827b
chore: resolve merge conflict, update CHANGELOG
thekidnamedkd Jan 13, 2025
5464cdd
chore: resolve PR convos -- interfaces, unused string, etc
thekidnamedkd Jan 14, 2025
dee7aa2
chore: merge latest
thekidnamedkd Jan 14, 2025
a169771
chore: resolve PR convos -- strings, remove ongoing, CHALLENGED & PAR…
thekidnamedkd Jan 14, 2025
1ebfe08
Merge branch 'main' of github.com:aragon/gov-ui-kit into feat/APP-374…
thekidnamedkd Jan 14, 2025
88533c8
chore: improve conditions for AC
thekidnamedkd Jan 14, 2025
1e9dcaa
chore: rework cal vs ping logic
thekidnamedkd Jan 14, 2025
cd6615e
chore: update tests
thekidnamedkd Jan 14, 2025
56e6268
chore: update CHANGELOG
thekidnamedkd Jan 14, 2025
fdc2953
chore: update modules copy
thekidnamedkd Jan 14, 2025
344954a
chore: resolve PR convos -- add test, clean up status conditions, etc
thekidnamedkd Jan 15, 2025
3c0a096
chore: update CHANGELOG
thekidnamedkd Jan 15, 2025
c66f748
chore: remove unneeded mapping
thekidnamedkd Jan 15, 2025
bbeed36
chore: update CHANGELOG
thekidnamedkd Jan 15, 2025
cf0d9ab
Fix vetoed status text color, cleanup
cgero-eth Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Update `InputFileAvatar` core component to remove `onFileSelect` property and use `value` and `onChange` properties
instead
- Update `IProposalActionUpdateMetadataDaoMetadata` interface `logo` property to `avatar` to better align with actions.
- Update `IProposalActionUpdateMetadataDaoMetadata` interface `logo` property to `avatar` to better align with actions
- Bump `softprops/action-gh-release` from 2.2.0 to 2.2.1
- Update minor and patch NPM dependencies
- Update `<ProposalDataListItem />` module component to include `statusContext` property and support `ADVANCEABLE`
status
- Remove `<MajorityVotingResult />` and `<ApprovalThresholdResult />` sub-components for `<ProposalDataListItem />`

## [1.0.62] - 2025-01-08

Expand Down
14 changes: 3 additions & 11 deletions src/modules/assets/copy/modulesCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ export const modulesCopy = {
delegations: 'Delegations',
votingPower: 'Voting Power',
},
approvalThresholdResult: {
stage: 'Stage',
outOf: (threshold: string) => `of ${threshold} members`,
},
majorityVotingResult: {
winningOption: 'Winning Option',
stage: 'Stage',
},
proposalActionsContainer: {
emptyHeader: 'No actions added',
},
Expand Down Expand Up @@ -93,18 +85,18 @@ export const modulesCopy = {
totalHoldersTerm: 'Total token holders',
},
proposalDataListItemStatus: {
voted: "You've voted",
voted: 'Voted',
ago: 'ago',
left: 'left',
in: 'in',
statusLabel: {
ACCEPTED: 'Accepted',
ADVANCEABLE: 'Advanceable',
ACTIVE: 'Active',
CHALLENGED: 'Challenged',
DRAFT: 'Draft',
EXECUTED: 'Executed',
EXPIRED: 'Expired',
FAILED: 'Failed',
PARTIALLY_EXECUTED: 'Partially executed',
PENDING: 'Pending',
EXECUTABLE: 'Executable',
REJECTED: 'Rejected',
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { render, screen } from '@testing-library/react';
import { DateFormat, IconType, formatterUtils } from '../../../../../core';
import { modulesCopy } from '../../../../assets';
import { ProposalStatus } from '../../proposalUtils';
import { proposalDataListItemUtils } from '../proposalDataListItemUtils';
import { ProposalDataListItemStatus, type IProposalDataListItemStatusProps } from './proposalDataListItemStatus';

describe('<ProposalDataListItemStatus /> component', () => {
Expand Down Expand Up @@ -50,32 +49,50 @@ describe('<ProposalDataListItemStatus /> component', () => {
expect(screen.queryByTestId(IconType.CALENDAR)).not.toBeInTheDocument();
});

test.each(proposalDataListItemUtils.ongoingStatuses)(
'displays the date and a pinging indicator when the status is %s and voted is false',
(status) => {
const date = 1719563030308;
render(createTestComponent({ date, status, voted: false }));

const formattedDate = formatterUtils.formatDate(date, { format: DateFormat.RELATIVE })!;
expect(screen.getByText(formattedDate)).toBeInTheDocument();
expect(screen.getByTestId('statePingAnimation')).toBeInTheDocument();
},
);

test.each(proposalDataListItemUtils.ongoingStatuses)(
'displays a you-voted label with an icon checkmark when the status is %s and voted is true',
(status) => {
render(createTestComponent({ status, voted: true }));

expect(screen.getByText(/You've voted/i)).toBeInTheDocument();
expect(screen.getByTestId(IconType.CHECKMARK)).toBeInTheDocument();
},
);

it('does not display a you-voted label when the status is not an ongoing one and the voted is true', () => {
it('displays the date and a pinging indicator when the status is active and voted is false', () => {
const status = ProposalStatus.ACTIVE;
const date = 1719563030308;
render(createTestComponent({ date, status, voted: false }));

const formattedDate = formatterUtils.formatDate(date, { format: DateFormat.RELATIVE })!;
expect(screen.getByText(formattedDate)).toBeInTheDocument();
expect(screen.getByTestId('statePingAnimation')).toBeInTheDocument();
});

it('displays a voted label when the status is active and voted is true', () => {
const status = ProposalStatus.ACTIVE;
render(createTestComponent({ status, voted: true }));

expect(screen.getByText(/Voted/i)).toBeInTheDocument();
expect(screen.getByTestId(IconType.CHECKMARK)).toBeInTheDocument();
});

it('does not display a voted label when the status is not active and voted is true', () => {
render(createTestComponent({ status: ProposalStatus.EXECUTED, voted: true }));

expect(screen.queryByText(/You've voted/i)).not.toBeInTheDocument();
expect(screen.queryByText(/Voted/i)).not.toBeInTheDocument();
expect(screen.queryByTestId(IconType.CHECKMARK)).not.toBeInTheDocument();
});

it('displays the status context when statusContext is provided and status is active', () => {
const statusContext = 'Stage 1';
const status = ProposalStatus.ACTIVE;
render(createTestComponent({ statusContext, status }));
expect(screen.getByText(statusContext)).toBeInTheDocument();
});

it('displays the status context when statusContext is provided and status is advanceable', () => {
const statusContext = 'Stage 1';
const status = ProposalStatus.ADVANCEABLE;
render(createTestComponent({ status, statusContext }));
expect(screen.getByText(modulesCopy.proposalDataListItemStatus.statusLabel[status])).toBeInTheDocument();
expect(screen.getByText(statusContext)).toBeInTheDocument();
});

it('does not display the status context when statusContext is provided and status is final', () => {
const statusContext = 'Stage 1';
const status = ProposalStatus.EXECUTED;
render(createTestComponent({ statusContext, status }));
expect(screen.queryByText(statusContext)).not.toBeInTheDocument();
});
});
Loading
Loading