Skip to content

Commit

Permalink
feat: add 'empty' text to unchanged app's change set (#2924)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast authored Apr 11, 2024
1 parent c6cd220 commit ff0fbd0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion frontend/benefit/handler/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,8 @@
},
"changes": {
"header": {
"amountOfChanges": "Muutoksia yhteensä: {{ amount }}"
"amountOfChanges": "Muutoksia yhteensä: {{ amount }}",
"noChanges": "Ei havaittuja muutoksia"
},
"fields": {
"jobTitle": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/benefit/handler/public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,8 @@
},
"changes": {
"header": {
"amountOfChanges": "Muutoksia yhteensä: {{ amount }}"
"amountOfChanges": "Muutoksia yhteensä: {{ amount }}",
"noChanges": "Ei havaittuja muutoksia"
},
"fields": {
"jobTitle": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/benefit/handler/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,8 @@
},
"changes": {
"header": {
"amountOfChanges": "Muutoksia yhteensä: {{ amount }}"
"amountOfChanges": "Muutoksia yhteensä: {{ amount }}",
"noChanges": "Ei havaittuja muutoksia"
},
"fields": {
"jobTitle": {
Expand Down
19 changes: 18 additions & 1 deletion frontend/benefit/handler/src/components/sidebar/ChangeList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { ApplicationChangesData } from 'benefit/handler/types/application';
import { ChangeListData } from 'benefit/handler/types/changes';
import { IconHistory } from 'hds-react';
import orderBy from 'lodash/orderBy';
import { useTranslation } from 'next-i18next';
import * as React from 'react';
import { $Actions } from 'shared/components/messaging/Messaging.sc';
import {
$Actions,
$Empty,
$MessagesList,
} from 'shared/components/messaging/Messaging.sc';
import { convertToUIDateFormat } from 'shared/utils/date.utils';

import ChangeSet from './ChangeSet';
Expand All @@ -29,6 +35,17 @@ const ChangeList: React.FC<ChangeListProps> = ({ data }: ChangeListProps) => {
const { handler, applicant } = data;
const combined: ChangeListData[] = [...handler, ...applicant];
const combinedAndOrderedChangeSets = orderBy(combined, ['date'], ['desc']);
const { t } = useTranslation();
if (combinedAndOrderedChangeSets.length === 0) {
return (
<$MessagesList variant="message">
<$Empty>
<IconHistory />
<p>{t('common:changes.header.noChanges')}</p>
</$Empty>
</$MessagesList>
);
}

return (
<$Actions>
Expand Down

0 comments on commit ff0fbd0

Please sign in to comment.