Skip to content

Commit

Permalink
fix: pulled main
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed May 3, 2024
2 parents 5f72e2f + 3655f6e commit a7da803
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 73 deletions.
2 changes: 1 addition & 1 deletion packages/uiweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"uuid": "^9.0.1"
},
"peerDependencies": {
"@pushprotocol/restapi": "0.0.1-alpha.80",
"@pushprotocol/restapi": "1.7.13",
"@pushprotocol/socket": "^0.5.0",
"react": ">=16.8.0",
"styled-components": "^6.0.8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { IMessagePayload, TwitterFeedReturnType } from '../exportedTypes';
const SenderMessageAddress = ({ chat }: { chat: IMessagePayload }) => {
const { user } = useContext(ChatDataContext);
const theme = useContext(ThemeContext);
return chat.fromCAIP10?.split(':')[1] !== user?.account ? (
return chat.fromCAIP10 !== user?.account ? (
<Span
theme={theme}
alignSelf="start"
Expand Down Expand Up @@ -55,7 +55,7 @@ const SenderMessageProfilePicture = ({ chat }: { chat: IMessagePayload }) => {
justifyContent="start"
alignItems="start"
>
{chat.fromCAIP10?.split(':')[1] !== user?.account && (
{chat.fromCAIP10 !== user?.account && (
<Section alignItems="start">
{pfp && (
<Image
Expand Down Expand Up @@ -83,6 +83,7 @@ const MessageWrapper = ({
isGroup: boolean;
maxWidth?: string;
}) => {
const { user } = useChatData();
const theme = useContext(ThemeContext);
return (
<Section
Expand All @@ -93,12 +94,12 @@ const MessageWrapper = ({
width="fit-content"
maxWidth={maxWidth || 'auto'}
>
{isGroup && <SenderMessageProfilePicture chat={chat} />}
{isGroup && chat?.fromCAIP10 !== user?.account && <SenderMessageProfilePicture chat={chat} />}
<Section
justifyContent="start"
flexDirection="column"
>
{isGroup && <SenderMessageAddress chat={chat} />}
{isGroup && chat?.fromCAIP10 !== user?.account && <SenderMessageAddress chat={chat} />}
{children}
</Section>
</Section>
Expand Down Expand Up @@ -322,11 +323,12 @@ export const ChatViewBubble = ({
}) => {
const { user } = useChatData();
const position =
pCAIP10ToWallet(decryptedMessagePayload.fromDID).toLowerCase() !== user?.account?.toLowerCase() ? 0 : 1;
pCAIP10ToWallet(decryptedMessagePayload.fromDID).toLowerCase() !== pCAIP10ToWallet(user?.account!)?.toLowerCase()
? 0
: 1;
const { tweetId, messageType }: TwitterFeedReturnType = checkTwitterUrl({
message: decryptedMessagePayload?.messageContent,
});

if (messageType === 'TwitterFeedLink') {
decryptedMessagePayload.messageType = 'TwitterFeedLink';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
const dateNum = moment(chat.timestamp).format('L');
// TODO: This is a hack as chat.fromDID is converted with eip to match with user.account creating a bug for omnichain
const position =
pCAIP10ToWallet(chat.fromDID)?.toLowerCase() !== user?.account?.toLowerCase() ? 0 : 1;
pCAIP10ToWallet(chat.fromDID)?.toLowerCase() !== pCAIP10ToWallet(user?.account!)?.toLowerCase()
? 0
: 1;
return (
<>
{dates.has(dateNum) ? null : renderDate({ chat, dateNum })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const AddCriteria = ({ handlePrevious, onClose, criteriaStateManager }: ModalHea
function: () => setSelectedChainValue(6),
} as DropdownValueType);
}

console.debug(dropdownChainsValues);
const onQuantityChange = (e: any) => {
setQuantity({ ...quantity, value: e.target.value });
};
Expand All @@ -263,6 +263,7 @@ const AddCriteria = ({ handlePrevious, onClose, criteriaStateManager }: ModalHea
}
}

console.debug(selectedChainValue);
const rule: Rule = {
type: _type,
category: category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export const MessageInput: React.FC<MessageInputProps> = ({
}
} else {
const sendTextMessage = await sendMessage({
message: `Hello, please let me join this group, my wallet address is ${user?.account}`,
message: `Hello, please let me join this group, my wallet address is ${pCAIP10ToWallet(user?.account || '')}`,
chatId: groupInfo?.groupCreator || '',
messageType: 'Text',
});
Expand Down
126 changes: 63 additions & 63 deletions packages/uiweb/src/lib/components/chat/UserProfile/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IUser } from '@pushprotocol/restapi';
import { ethers } from 'ethers';
import styled from 'styled-components';

import { resolveWeb3Name, shortenText } from '../../../helpers';
import { pCAIP10ToWallet, resolveWeb3Name, shortenText } from '../../../helpers';
import { useClickAway } from '../../../hooks';
import { useChatData } from '../../../hooks/chat/useChatData';
import useChatProfile from '../../../hooks/chat/useChatProfile';
Expand Down Expand Up @@ -81,76 +81,76 @@ export const UserProfile: React.FC<UserProfileProps> = ({

return (
<Conatiner
height="inherit"
justifyContent="space-between"
overflow="hidden"
width="100%"
padding="14px 10px"
borderRadius={theme?.borderRadius?.userProfile}
background={theme?.backgroundColor?.userProfileBackground}
height="inherit"
justifyContent="space-between"
overflow="hidden"
width="100%"
padding="14px 10px"
borderRadius={theme?.borderRadius?.userProfile}
background={theme?.backgroundColor?.userProfileBackground}
theme={theme}
>
<ProfileContainer
theme={theme}
>
<ProfileContainer
member={{
web3Name: web3Name,
abbrRecipient: shortenText(pCAIP10ToWallet(user?.account || ''), 8, true) as string,
recipient: user!.account,
icon: userProfile?.profile?.picture || null,
}}
copy={true}
customStyle={{
fontSize: theme?.fontSize?.userProfileText,
fontWeight: theme?.fontWeight?.userProfileText,
textColor: theme?.textColor?.userProfileText,
}}
loading={!userProfile ? true : false}
/>
{userProfile && (
<Section>
<Image
src={VerticalEllipsisIcon}
height="21px"
maxHeight="21px"
color={theme?.iconColor?.userProfileSettings}
width={'auto'}
cursor="pointer"
onClick={() => setOptions(true)}
/>
</Section>
)}
{options && (
<DropDownBar
theme={theme}
member={{
web3Name: web3Name,
abbrRecipient: shortenText(user?.account || '', 8, true) as string,
recipient: user!.account,
icon: userProfile?.profile?.picture || null,
}}
copy={true}
customStyle={{
fontSize: theme?.fontSize?.userProfileText,
fontWeight: theme?.fontWeight?.userProfileText,
textColor: theme?.textColor?.userProfileText,
}}
loading={!userProfile ? true : false}
/>
{userProfile && (
<Section>
ref={DropdownRef}
onClick={() => setShowUpdateUserProfileModal(true)}
>
<DropDownItem cursor="pointer">
<Image
src={VerticalEllipsisIcon}
height="21px"
maxHeight="21px"
color={theme?.iconColor?.userProfileSettings}
src={UserProfileIcon}
height="32px"
maxHeight="32px"
width={'auto'}
cursor="pointer"
onClick={() => setOptions(true)}
/>
</Section>
)}
{options && (
<DropDownBar
theme={theme}
ref={DropdownRef}
onClick={() => setShowUpdateUserProfileModal(true)}
>
<DropDownItem cursor="pointer">
<Image
src={UserProfileIcon}
height="32px"
maxHeight="32px"
width={'auto'}
cursor="pointer"
/>

<TextItem cursor="pointer">Edit Profile</TextItem>
</DropDownItem>
</DropDownBar>
<TextItem cursor="pointer">Edit Profile</TextItem>
</DropDownItem>
</DropDownBar>
)}
{showUpdateUserProfileModal &&
createPortal(
<UpdateUserProfileModal
theme={theme}
setModal={setShowUpdateUserProfileModal}
userProfile={userProfile!}
setUserProfile={setUserProfile}
updateUserProfileModalBackground={updateUserProfileModalBackground}
updateUserProfileModalPositionType={updateUserProfileModalPositionType}
/>,
document.body
)}
{showUpdateUserProfileModal &&
createPortal(
<UpdateUserProfileModal
theme={theme}
setModal={setShowUpdateUserProfileModal}
userProfile={userProfile!}
setUserProfile={setUserProfile}
updateUserProfileModalBackground={updateUserProfileModalBackground}
updateUserProfileModalPositionType={updateUserProfileModalPositionType}
/>,
document.body
)}
</Conatiner>
</Conatiner>
);
};

Expand Down

0 comments on commit a7da803

Please sign in to comment.