Skip to content

Commit f1967a5

Browse files
refactor: changed invitationDate to required
1 parent 66ac1db commit f1967a5

File tree

4 files changed

+12
-24
lines changed

4 files changed

+12
-24
lines changed

apps/meteor/client/components/InvitationBadge/InvitationBadge.spec.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ const wrapper = mockAppRoot()
99
})
1010
.build();
1111

12-
it('should render InvitationBadge without date', () => {
13-
const { baseElement } = render(<InvitationBadge />, { wrapper });
14-
expect(baseElement).toMatchSnapshot();
15-
});
16-
1712
it('should render InvitationBadge with date ISO string', () => {
1813
const { baseElement } = render(<InvitationBadge invitationDate='2025-01-01T12:00:00Z' />, { wrapper });
1914
expect(baseElement).toMatchSnapshot();

apps/meteor/client/components/InvitationBadge/InvitationBadge.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@ import { useTranslation } from 'react-i18next';
55
import { useTimeAgo } from '../../hooks/useTimeAgo';
66

77
type InvitationBadgeProps = Omit<ComponentProps<typeof Icon>, 'name' | 'color' | 'role'> & {
8-
invitationDate?: string | Date;
8+
invitationDate: string | Date;
99
};
1010

1111
const InvitationBadge = ({ invitationDate, ...props }: InvitationBadgeProps) => {
1212
const { t } = useTranslation();
1313
const timeAgo = useTimeAgo();
14-
const formattedDate = invitationDate ? t('Invited__date__', { date: timeAgo(invitationDate) }) : t('Invited');
1514

16-
return <Icon size='x20' {...props} role='status' color='info' name='mail' aria-hidden='false' title={formattedDate} />;
15+
return (
16+
<Icon
17+
size='x20'
18+
{...props}
19+
role='status'
20+
color='info'
21+
name='mail'
22+
aria-hidden='false'
23+
title={t('Invited__date__', { date: timeAgo(invitationDate) })}
24+
/>
25+
);
1726
};
1827

1928
export default InvitationBadge;

apps/meteor/client/components/InvitationBadge/__snapshots__/InvitationBadge.spec.tsx.snap

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,3 @@ exports[`should render InvitationBadge with date ISO string 1`] = `
2929
</div>
3030
</body>
3131
`;
32-
33-
exports[`should render InvitationBadge without date 1`] = `
34-
<body>
35-
<div>
36-
<i
37-
aria-hidden="false"
38-
class="rcx-box rcx-box--full rcx-icon--name-mail rcx-icon rcx-css-dpa92h"
39-
role="status"
40-
title="Invited"
41-
>
42-
43-
</i>
44-
</div>
45-
</body>
46-
`;

packages/i18n/src/locales/en.i18n.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2679,7 +2679,6 @@
26792679
"Invitation_Subject": "Invitation Subject",
26802680
"Invitation_Subject_Default": "You have been invited to [Site_Name]",
26812681
"Invite": "Invite",
2682-
"Invited": "Invited",
26832682
"Invited__date__": "Invited {{date}}",
26842683
"Invite_Link": "Invite Link",
26852684
"Invite_Users": "Invite Members",

0 commit comments

Comments
 (0)