-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
…ations to the notification
…ned or replied to the current user. updated the notification for when other reply ot mention current user
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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 ; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) && ( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
src/fragments/FileMessage.tsx
Outdated
@@ -17,7 +17,12 @@ const FileMessage: React.FC<FileMessageProp> = ({ | |||
|
|||
useEffect(() => { | |||
getURLFile(message.file.url).then((blob) => { | |||
setLink(URL.createObjectURL(blob)); | |||
if(blob){ |
There was a problem hiding this comment.
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
src/fragments/MessageListItem.tsx
Outdated
@@ -66,6 +75,18 @@ const MessageListItem: React.FC<MessageListItemProps> = ({ | |||
} | |||
}, []); | |||
|
|||
useEffect(() => { | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
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.
src/fragments/MyChannels.tsx
Outdated
@@ -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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.