-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push Chat Flow fixed and recommended chats done
- Loading branch information
Showing
8 changed files
with
223 additions
and
107 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// React + Web3 Essentials | ||
import React, { useState } from "react"; | ||
|
||
// External Packages | ||
import { ChatPreview } from '@pushprotocol/uiweb'; | ||
import styled, { css, useTheme } from 'styled-components'; | ||
|
||
// Internal Compoonents | ||
import { ItemVV2 } from 'components/reusables/SharedStylingV2'; | ||
|
||
// Internal Configs | ||
import recommendedChatsList from 'config/RecommendedChatsList'; | ||
|
||
// Interface | ||
|
||
// Constants | ||
|
||
// Create Module | ||
const Recommended = ({ bg, onChatSelected }) => { | ||
// States | ||
const [chatId, setChatId] = useState(''); | ||
|
||
const getChatParticipant = (chatParticipant) => { | ||
let chatParticipantAlias; | ||
|
||
for (let i = 0; i < recommendedChatsList.length; i++) { | ||
if (recommendedChatsList[i].payload.chatParticipant === chatParticipant) { | ||
chatParticipantAlias = recommendedChatsList[i].chatParticipantAlias; | ||
} | ||
} | ||
|
||
return chatParticipantAlias; | ||
} | ||
|
||
// RENDER | ||
return ( | ||
<Container | ||
bg={bg} | ||
> | ||
{recommendedChatsList.map((item, index) => { | ||
return ( | ||
<ChatPreview | ||
key={index} | ||
chatPreviewPayload={item.payload} | ||
selected={item.payload.chatId === chatId ? true : false} | ||
setSelected={(chatId, chatParticipant) => {const chatParticipantRemapped = getChatParticipant(chatParticipant); setChatId(chatId); onChatSelected(chatId, chatParticipantRemapped)}} | ||
/> | ||
) | ||
})} | ||
</Container> | ||
); | ||
} | ||
export default Recommended; | ||
|
||
// css styles | ||
const Container = styled(ItemVV2)` | ||
flex: initial; | ||
flex-wrap: nowrap; | ||
background: ${props => props.bg || 'transparent'}; | ||
border-radius: 24px; | ||
padding: 10px; | ||
&:before { | ||
content: "RECOMMENDED"; | ||
font-size: 12px; | ||
font-weight: 600; | ||
margin-bottom: 10px; | ||
letter-spacing: 0.05em; | ||
color: #657795; | ||
display: flex; | ||
align-self: flex-start; | ||
padding: 5px 10px 0px 10px; | ||
} | ||
` |
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,46 @@ | ||
const RecommendedChatLists = [ | ||
{ | ||
"chatParticipantAlias": "eip155:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666", | ||
"payload": { | ||
"chatId": "0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666", | ||
"chatPic": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAAAMVJREFUSEtjvOC34D8DFNzaWghjMqh598PZyOJwQTwMXHqRxRlHnsWrmAXhQY0r9PJ4HOFSk77sx6qMGDXIGhlHnsW4EhcxqZdUNUSlalINJUb94LMY2dW4Cg1kV1OiHqUAocQgUh06cBYTk49xBS+uBEVM2U5UATIyLCbVl6QGO86gHr4Wk1pWk1qAIEcBRUXm0Ld4tADBlh9JzVpEFZnIqdrj4CaCjTpSExdyI3CHvR/cfJTaaeRZPNqFwdaZI7U1iSsUAZha8UXyHURfAAAAAElFTkSuQmCC", | ||
"chatParticipant": "Push AI Bot", | ||
"chatGroup": true, | ||
"chatTimestamp": null, | ||
"chatMsg": { | ||
"messageType": "Text", | ||
"messageContent": "Interact for Humor, Sassyness gauranteed!" | ||
} | ||
} | ||
}, | ||
{ | ||
"chatParticipantAlias": "eip155:0x71Ffa5771E8019787190D098586EFe02026a3c8C", | ||
"payload": { | ||
"chatId": "0x71Ffa5771E8019787190D098586EFe02026a3c8C", | ||
"chatPic": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c6QAAANNJREFUSEtjTPF78p8BC1gYvw2bMMli8Qu9sOphHNkWX3aqJhiU52StsaoxenyUoF7dfa1wNShBPTIsZl07C2uqRk6NyCkcVyrFpQZX7mAceRbjysfISZSSoMaV1HEWIMPXYuTEhSslI/uemFSNSz1ylKGk6pFhMam1EyVBjRwFJFeLI8NiXL7EVTgQU+AQFdTDy2LzCfHwahG5hYCryCTYzGBgYMAVQsgNDcaRZzGpBQgxQU1M2U5UqibVssFtMXK1iNw2xtV+JtX3uMxEqRZHhMUA5oH9q+BaxVUAAAAASUVORK5CYII=", | ||
"chatParticipant": "Push Developer", | ||
"chatGroup": true, | ||
"chatTimestamp": null, | ||
"chatMsg": { | ||
"messageType": "Text", | ||
"messageContent": "Ask any coding related questions here!" | ||
} | ||
} | ||
}, | ||
{ | ||
"chatParticipantAlias": "eip155:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666", | ||
"payload": { | ||
"chatId": "4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68", | ||
"chatPic": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAxElEQVR4AcXBsU1DUQyG0S/WW4EGMQETMIRX8BxpXFpCLMACXuGOlC5DhNZKcaUnBP85l8+P7wcntBc7sZIzDDFDzBA7eNJeTLGSKVZyRnsxxUomQ8wQM8SO9uI/tReTIWaIGWJHrGRqL6b2Yrq/fbHzcruyEyuZDDFDzBA7eBIr2Wm/shMrOcMQM8QMsaO9mGIlf6m9mAwxQ8wQO2IlU3vxG+3FTqxkMsQMMUPs8l6vDzZiJVN7sRMrmdqLHUPMEDPEfgBK0S/MKDp40gAAAABJRU5ErkJggg==", | ||
"chatParticipant": "eip155:0xf8250D363BD1F25f52F10C21188fe82c68C049c4", | ||
"chatGroup": true, | ||
"chatTimestamp": null, | ||
"chatMsg": { | ||
"messageType": "Text", | ||
"messageContent": "Hi! Stay tuned, while BRB IRL dev tour has wrapped up, We still have BRB Online with challenges from global projects that still needs to be solved: https://push.org/brb" | ||
} | ||
} | ||
} | ||
] | ||
|
||
export default RecommendedChatLists; |
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.