Skip to content

Commit

Permalink
Chore: Convert NotificationStatus to TS (#25125)
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com>
  • Loading branch information
jeanfbrito and ggazzo authored Apr 12, 2022
1 parent 72bcf67 commit 154b241
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 23 deletions.
4 changes: 1 addition & 3 deletions apps/meteor/client/components/Message/Metrics/Thread.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ const ThreadMetric: FC<ThreadReplyOptions> = ({ unread, mention, all, rid, mid,
</MessageMetricsItem>
<MessageMetricsItem>
<MessageMetricsItem.Label>
{(mention && <NotificationStatus.Me t={t} />) ||
(all && <NotificationStatus.All t={t} />) ||
(unread && <NotificationStatus.Unread t={t} />)}
{(mention && <NotificationStatus.Me />) || (all && <NotificationStatus.All />) || (unread && <NotificationStatus.Unread />)}
</MessageMetricsItem.Label>
</MessageMetricsItem>
</Message.Metrics>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import React, { FC } from 'react';

import NotificationStatus from './NotificationStatus';

function All(props) {
const All: FC = function All(props) {
return <NotificationStatus label='mention-all' bg='#F38C39' {...props} />;
}
};

export default All;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import React, { FC } from 'react';

import NotificationStatus from './NotificationStatus';

function Me(props) {
const Me: FC = function Me(props) {
return <NotificationStatus label='Me' bg='danger-500' {...props} />;
}
};

export default Me;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Box } from '@rocket.chat/fuselage';
import React, { FC } from 'react';

import { TranslationKey, useTranslation } from '../../../contexts/TranslationContext';

const NotificationStatus: FC<{
label: TranslationKey;
bg: string;
}> = function NotificationStatus({ label, ...props }) {
const t = useTranslation();
return <Box width='x8' aria-label={t(label)} borderRadius='full' height='x8' {...props} />;
};

export default NotificationStatus;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import React, { FC } from 'react';

import NotificationStatus from './NotificationStatus';

function Unread(props) {
const Unread: FC = function Unread(props) {
return <NotificationStatus label='Unread' bg='primary-500' {...props} />;
}
};

export default Unread;
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ export default React.memo(function MessageThread({
>
<Icon name={button} size='x20' />
</Button>
{(mention && <NotificationStatus.Me t={t} mb='x24' />) ||
(all && <NotificationStatus.All t={t} mb='x24' />) ||
(unread && <NotificationStatus.Unread t={t} mb='x24' />)}
{(mention && <NotificationStatus.Me mb='x24' />) ||
(all && <NotificationStatus.All mb='x24' />) ||
(unread && <NotificationStatus.Unread mb='x24' />)}
</Message.ContainerFixed>
</Message>
</Box>
Expand Down

0 comments on commit 154b241

Please sign in to comment.