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

finished notification and mentions #12

Merged
merged 14 commits into from
Jun 17, 2022
Merged

Conversation

theonej203
Copy link
Contributor

No description provided.

Copy link
Member

@aerovulpe aerovulpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @theonej203 this is s good starting point but I got some feedback.


import './../styles/slide.css';

interface notificationProp {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Pascal Case for type definitions

import './../styles/slide.css';

interface notificationProp {
notification: SystemSentMessageNotification ;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be typed as Notification


interface notificationProp {
notification: SystemSentMessageNotification ;
isMentionNotification?: boolean | null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flag shouldn't be part of the NotificationProps.

cursor: 'pointer',
}}
>
{isUserMessage(notification.data.message) && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the isUserMentionedNotification helper type function instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using isUserMentionedNotification will need additional unnecessary code

@@ -17,7 +17,12 @@ const FileMessage: React.FC<FileMessageProp> = ({

useEffect(() => {
getURLFile(message.file.url).then((blob) => {
setLink(URL.createObjectURL(blob));
if(blob){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run prettier to fix this formatting

@@ -66,6 +75,18 @@ const MessageListItem: React.FC<MessageListItemProps> = ({
}
}, []);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The any cast here isn't necessary. Use the isTextMessage type helper function to check if the message is a TextMessage and then access the mentions property.

@@ -52,11 +60,46 @@ const MyChannels: React.FC = () => {
});
}, [currentUser]);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const test: any = currentNotification?.data.message;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SDK provides type helper functions to prevent unsafe type casting.

isSystemSentMessageNotification
isUserSentMessageNotification
isUserRepliedToMessageNotification
isUserMentionedNotification
isUserMentionedChannelNotification

Copy link
Member

@aerovulpe aerovulpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aerovulpe aerovulpe merged commit 82811b0 into ChatKitty:main Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants