-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
217 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE IF NOT EXISTS last_read ( | ||
userId VARCHAR(255) NOT NULL, | ||
spaceId VARCHAR(255) NOT NULL, | ||
lastReadId VARCHAR(255) NOT NULL, | ||
PRIMARY KEY (userId, spaceId), | ||
FOREIGN KEY (userId) REFERENCES users(id), | ||
FOREIGN KEY (spaceId) REFERENCES spaces(id), | ||
FOREIGN KEY (lastReadId) REFERENCES chat(id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { BiSolidBellRing } from 'react-icons/bi'; | ||
|
||
import { useSpace } from '../hooks/useSpace'; | ||
|
||
export const NotificationNumberMsgs: React.FC<{ spaceId: string }> = ({ spaceId }) => { | ||
const { numOfUnReadMsgs } = useSpace(spaceId); | ||
const unRead = numOfUnReadMsgs.data?.numOfUnReadMsgs; | ||
|
||
if (unRead! > 0) { | ||
return ( | ||
<> | ||
<BiSolidBellRing | ||
className="ring" | ||
style={{ | ||
fontSize: '1.2rem', | ||
color: 'red', | ||
margin: '0 0.2rem', | ||
}} | ||
/> | ||
<span | ||
className="unread-count" | ||
style={{ | ||
backgroundColor: 'white', | ||
color: 'red', | ||
borderRadius: '50%', | ||
padding: '0 0.2rem', | ||
fontSize: '0.8rem', | ||
}} | ||
> | ||
{unRead} | ||
</span> | ||
</> | ||
); | ||
} | ||
|
||
return <></>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.