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

feat: added icon in groupinfo to show if it is token gated or not #748

Merged
merged 8 commits into from
Oct 6, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ChatProfileTest = () => {
<div>
<ChatProfile
// chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B'
chatId='24b029b8e07e60291bf9d8c0c48ff993fa1e0a99105459f7404c425c92e91bac'
chatId='a72832107b8ae7624c1ec997cee8e8b2bc21db708465555c20c4d5e029210cd6'
// chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6'
style="Info"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const ChatViewComponentTest = () => {
return (
<div>
<h2>Chat UI Test page</h2>
<CreateGroupModal onClose={()=>{console.log('in close')}} />
{/* <CreateGroupModal onClose={()=>{console.log('in close')}} /> */}
<ChatViewComponentCard>
<ChatViewComponent onGetTokenClick={() => console.log("BOIIII RETURNNNSSSSS")} chatId='4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68' limit={10} isConnected={true} autoConnect={false}/>
<ChatViewComponent onGetTokenClick={() => console.log("BOIIII RETURNNNSSSSS")} chatId='4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68' limit={10} isConnected={true} />
</ChatViewComponentCard>
</div>
);
Expand All @@ -27,3 +27,4 @@ const ChatViewComponentCard = styled(Section)`
height: 60vh;
`;
//c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e
//4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68
27 changes: 17 additions & 10 deletions packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { isValidETHAddress } from '../helpers/helper';
import { IChatProfile, IChatTheme } from '../exportedTypes';
import { InfuraAPIKey, allowedNetworks, device } from '../../../config';
import { resolveNewEns, shortenText } from '../../../helpers';
import TokenGatedIcon from '../../../icons/Token-Gated.svg';
import TokenGatedIcon from '../../../icons/TokenGatedIcon.svg';
import PublicChatIcon from '../../../icons/Public-Chat.svg';
import GreyImage from '../../../icons/greyImage.png';
import InfoIcon from '../../../icons/infodark.svg';
Expand Down Expand Up @@ -66,6 +66,14 @@ const Options = ({
gap="10px"
margin="0 20px 0 auto"
>
{(groupInfo?.rules?.chat?.conditions || groupInfo.rules?.entry?.conditions) && (
<Image
src={TokenGatedIcon}
height="24px"
maxHeight="24px"
width={'auto'}
/>
)}
<Image
src={groupInfo?.isPublic ? PublicChatIcon : TokenGatedIcon}
height="28px"
Expand Down Expand Up @@ -156,7 +164,7 @@ export const ChatProfile: React.FC<IChatProfile> = ({
return isGroup
? groupInfo?.groupImage ?? GreyImage
: chatInfo?.profile?.picture ??
createBlockie?.(chatId)?.toDataURL()?.toString();
createBlockie?.(chatId)?.toDataURL()?.toString();
} else {
return createBlockie?.(chatId)?.toDataURL()?.toString();
}
Expand All @@ -166,14 +174,13 @@ export const ChatProfile: React.FC<IChatProfile> = ({
return isGroup
? groupInfo?.groupName
: ensName
? `${ensName} (${
isMobile
? shortenText(chatInfo?.did?.split(':')[1] ?? '', 4, true)
: chatId
? `${ensName} (${isMobile
? shortenText(chatInfo?.did?.split(':')[1] ?? '', 4, true)
: chatId
})`
: chatInfo
? shortenText(chatInfo.did?.split(':')[1] ?? '', 6, true)
: shortenText(chatId, 6, true);
: chatInfo
? shortenText(chatInfo.did?.split(':')[1] ?? '', 6, true)
: shortenText(chatId, 6, true);
};

useEffect(() => {
Expand All @@ -187,7 +194,7 @@ export const ChatProfile: React.FC<IChatProfile> = ({
<ProfileContainer
theme={theme}
member={{ wallet: getProfileName() as string, image: getImage() }}
customStyle={{fontSize:'17px'}}
customStyle={{ fontSize: '17px' }}
/>

<Options
Expand Down
Loading