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

Main Release 1.4.0 #1364

Merged
merged 40 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
360083d
fixed chat responsiveness
HarshRajat May 15, 2024
d864378
fixed preview link alignment to right
HarshRajat May 15, 2024
3115854
added relative imports for better management
HarshRajat May 15, 2024
9e7432e
Merge pull request #1289 from push-protocol/uiweb-absolute-imports
HarshRajat May 16, 2024
e0f7bae
Merge pull request #1287 from push-protocol/responsiveness-mobile-uiw…
HarshRajat May 16, 2024
f5070a2
Search issue (#1270)
mishramonalisha76 May 21, 2024
8d360bc
fix: Merge branch 'main' into alpha
mohammeds1992 May 21, 2024
1cfec21
fix: fixed support chat init issue (#1292)
mishramonalisha76 May 22, 2024
c244626
fix(chatviewlist): increase hidden/encrypted chat blur
corlard3y May 22, 2024
c52e517
Added Reaction support, (#1303)
HarshRajat May 23, 2024
4d56d45
fix: add selected option
corlard3y May 24, 2024
b0ac6c5
fix: add return fn
corlard3y May 27, 2024
2f37ba6
fix: add comment to fn
corlard3y May 27, 2024
89975b4
fix: add push bot address
corlard3y May 27, 2024
e5bd9fa
fix: export const
corlard3y May 27, 2024
7c60e1b
fix: reset chat_id
corlard3y May 27, 2024
74be11e
fix: remove console
corlard3y May 27, 2024
d8241be
fix: update dark mode theme
corlard3y May 27, 2024
122fb44
fix: code review comments
corlard3y May 27, 2024
ed630b5
fix: add null check
corlard3y May 27, 2024
19f3f6b
fix: update conditions
corlard3y May 27, 2024
4a161c8
fix: pending wallet address copy issue fixed
abhishek-01k May 28, 2024
8c45b54
fix: update chatprevie badge conditions
corlard3y May 29, 2024
bbf6778
fix: tooltip was not properly aligned
abhishek-01k May 29, 2024
2f3ade1
fix: scrollbar in member list in group info was not visible
abhishek-01k May 29, 2024
d8b026f
Merge pull request #1312 from push-protocol/1307-bug-increase-bg-blur…
corlard3y May 29, 2024
8512e41
Merge pull request #1324 from push-protocol/skeleton-loading-dark-mode
corlard3y May 29, 2024
06254e6
Merge pull request #1323 from push-protocol/1320-bug-chat-badge
corlard3y May 29, 2024
794666e
Space - id integration (#1322)
mishramonalisha76 May 29, 2024
b295043
fix: fixed the blurr issue in chat on join and accept group (#1305)
mishramonalisha76 May 29, 2024
738383d
fix: fixed lint issue
mishramonalisha76 May 29, 2024
952f06d
Merge branch 'main' of github.com:push-protocol/push-sdk into alpha
rohitmalhotra1420 May 31, 2024
82087a9
fixed build error for incorrect naming
rohitmalhotra1420 May 31, 2024
5f57d4a
Merge branch 'alpha' into SDK-#1298-scrollbar-not-visible-on-member-info
abhishek-01k May 31, 2024
58636d0
Merge pull request #1326 from push-protocol/SDK-1297-copying-pendingW…
abhishek-01k May 31, 2024
cc8dc28
Merge pull request #1328 from push-protocol/SDK-1299-Tooltip-not-prop…
abhishek-01k May 31, 2024
7877b61
Merge pull request #1329 from push-protocol/SDK-#1298-scrollbar-not-v…
abhishek-01k May 31, 2024
2c43806
fixes ui representation for domain resolution (#1336)
mishramonalisha76 Jun 7, 2024
957e093
fix: updated guild validation url (#1363)
mishramonalisha76 Jun 20, 2024
b0c77c2
Merged main into alpha
rohitmalhotra1420 Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ import { CONSTANTS, IFeeds, IUser } from '@pushprotocol/restapi';
import styled from 'styled-components';

// Internal Compoonents
import { getAddress, getNewChatUser, pCAIP10ToWallet, traceStackCalls, walletToPCAIP10 } from '../../../helpers';
import {
getAddress,
getDomainIfExists,
getNewChatUser,
pCAIP10ToWallet,
traceStackCalls,
walletToPCAIP10,
} from '../../../helpers';
import { useChatData, usePushChatStream } from '../../../hooks';
import useFetchChat from '../../../hooks/chat/useFetchChat';
import useFetchMessageUtilities from '../../../hooks/chat/useFetchMessageUtilities';
Expand Down Expand Up @@ -609,7 +616,7 @@ export const ChatPreviewList: React.FC<IChatPreviewListProps> = (options: IChatP
let userProfile: IUser | undefined = undefined;
let groupProfile: Group;

if (formattedChatId.includes('.')) {
if (getDomainIfExists(formattedChatId)) {
const address = await getAddress(formattedChatId, user ? user.env : CONSTANTS.ENV.PROD);
if (address) formattedChatId = pCAIP10ToWallet(address);
else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
// React + Web3 Essentials
import { ethers } from 'ethers';
import React, { useContext, useEffect, useRef, useState } from 'react';

// External Packages
import { CONSTANTS, IFeeds, IUser } from '@pushprotocol/restapi';
import styled from 'styled-components';

// Internal Compoonents
import {
deriveChatId,
getAddress,
getNewChatUser,
pCAIP10ToWallet,
traceStackCalls,
walletToPCAIP10,
} from '../../../helpers';
import { useChatData, usePushChatStream } from '../../../hooks';
import { deriveChatId, getDomainIfExists, pCAIP10ToWallet } from '../../../helpers';
import { useChatData } from '../../../hooks';
import useFetchChat from '../../../hooks/chat/useFetchChat';
import useFetchMessageUtilities from '../../../hooks/chat/useFetchMessageUtilities';
import useGetGroupByIDnew from '../../../hooks/chat/useGetGroupByIDnew';
import usePushUser from '../../../hooks/usePushUser';
import { Button, Section, Span, Spinner } from '../../reusables';
import { ChatPreview } from '../ChatPreview';
import {
displayDefaultUser,
generateRandomNonce,
transformChatItems,
transformStreamToIChatPreviewPayload,
} from '../helpers';
import { generateRandomNonce, getChatParticipantDisplayName, transformStreamToIChatPreviewPayload } from '../helpers';

// Internal Configs
import { ThemeContext } from '../theme/ThemeProvider';
Expand All @@ -37,7 +21,6 @@ import { ThemeContext } from '../theme/ThemeProvider';
// Interfaces & Types
import {
ChatPreviewSearchListErrorCodes,
Group,
IChatPreviewSearchListError,
IChatPreviewSearchListProps,
IChatPreviewPayload,
Expand Down Expand Up @@ -73,7 +56,6 @@ interface IChatPreviewListMeta {
}

// Constants
const CHAT_PAGE_LIMIT = 10;
const SCROLL_LIMIT = 25;

// Exported Interfaces & Types
Expand All @@ -82,9 +64,7 @@ const SCROLL_LIMIT = 25;
export const ChatPreviewSearchList: React.FC<IChatPreviewSearchListProps> = (options: IChatPreviewSearchListProps) => {
// get hooks
const { user } = useChatData();
const { fetchUserProfile } = usePushUser();
const { getGroupByIDnew } = useGetGroupByIDnew();
const { fetchLatestMessage, fetchChatList } = useFetchMessageUtilities();

// set chat preview list
const [chatPreviewList, setChatPreviewList] = useState<IChatPreviewList>({
Expand Down Expand Up @@ -192,7 +172,7 @@ export const ChatPreviewSearchList: React.FC<IChatPreviewSearchListProps> = (opt
let derivedChatId = formattedChatId;

// Check if the chatId is ENS / Web3 Name
if (formattedChatId.includes('.')) {
if (getDomainIfExists(formattedChatId)) {
// resolve web3 name
derivedChatId = await deriveChatId(formattedChatId, user);
}
Expand All @@ -211,7 +191,6 @@ export const ChatPreviewSearchList: React.FC<IChatPreviewSearchListProps> = (opt
const groupInfo = await getGroupByIDnew({
groupId: derivedChatId,
});

if (groupInfo) {
searchedChat = {
...searchedChat,
Expand All @@ -230,19 +209,17 @@ export const ChatPreviewSearchList: React.FC<IChatPreviewSearchListProps> = (opt
} else {
const userProfile = await user?.info({ overrideAccount: chatInfo.recipient });
console.debug('UIWeb::components::ChatPreviewSearchList::loadMoreChats::userProfile', userProfile);

searchedChat = {
...searchedChat,
chatId: derivedChatId,
chatParticipant: derivedChatId,
chatParticipant: getChatParticipantDisplayName(derivedChatId, formattedChatId),
chatGroup: false,
chatPic: userProfile?.profile?.picture || null,
chatMsg: {
messageType: 'Text',
messageContent: chatInfo?.list === 'CHATS' ? 'Resume Chat!' : 'Start Chat!',
},
};

resolved = true;
}
} else {
Expand Down Expand Up @@ -349,22 +326,6 @@ export const ChatPreviewSearchList: React.FC<IChatPreviewSearchListProps> = (opt
});
};

//Transform group creation stream
const transformGroupCreationStream: (item: any) => void = async (item: any) => {
const transformedItem: IChatPreviewPayload = {
chatId: item?.chatId,
chatPic: item?.meta.image,
chatParticipant: item?.meta.name,
chatGroup: true,
chatTimestamp: undefined,
chatMsg: {
messageType: '',
messageContent: '',
},
};
addChatItems([transformedItem], false);
};

// Transform stream message
const transformStreamMessage: (item: any) => void = async (item: any) => {
if (!user) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import styled from 'styled-components';
import {
deriveChatId,
getAddress,
getDomainIfExists,
pCAIP10ToWallet,
resolveWeb3Name,
shortenText,
Expand Down Expand Up @@ -166,6 +167,7 @@ export const ChatProfile: React.FC<IChatProfile> = ({
profile.abbrRecipient = getAbbreiatedRecipient(recipient);
profile.desc = profileInfo.profile?.desc;
profile.isGroup = false;
profile.web3Name = getDomainIfExists(chatId);
} else {
throw new Error(
'UIWeb::ChatProfile::user.profile.info fetch error, possible push user does not exist.'
Expand All @@ -180,13 +182,14 @@ export const ChatProfile: React.FC<IChatProfile> = ({
profile.icon = null;
profile.chatId = derivedChatId;
profile.recipient = recipient;
profile.web3Name = getDomainIfExists(chatId);
profile.abbrRecipient = getAbbreiatedRecipient(recipient);
profile.desc = '';
profile.isGroup = false;
}

// get and set web3 name asynchrounously
if (profile.recipient) {
if (profile.recipient && !profile.web3Name) {
setupWeb3Name(profile.recipient);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ const GroupInformation = ({
<Section
borderRadius="16px"
flexDirection="column"
gap="16px"
>
{groupMembers.loading ? (
<Spinner
Expand Down Expand Up @@ -1014,7 +1013,7 @@ const GroupDescription = styled.div`
gap: 5px;
`;

const PublicEncrypted = styled(Section)<{ alert?: boolean }>`
const PublicEncrypted = styled(Section) <{ alert?: boolean }>`
display: flex;
flex-direction: row;
width: 100%;
Expand All @@ -1040,7 +1039,7 @@ const AddWalletContainer = styled.div`
align-items: center;
`;

const ConditionSection = styled(Section)<{ theme: IChatTheme }>`
const ConditionSection = styled(Section) <{ theme: IChatTheme }>`
&::-webkit-scrollbar-thumb {
background: ${(props) => props.theme.scrollbarColor};
border-radius: 10px;
Expand All @@ -1053,7 +1052,7 @@ const ConditionSection = styled(Section)<{ theme: IChatTheme }>`
}
`;

const ScrollSection = styled(Section)<{ theme: IChatTheme }>`
const ScrollSection = styled(Section) <{ theme: IChatTheme }>`
&::-webkit-scrollbar-thumb {
background: ${(props) => props.theme.scrollbarColor};
border-radius: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ export const PendingMembers = ({
<ProfileSection
flexDirection="column"
flex="1"
maxHeight="10rem"
overflow="hidden auto"
justifyContent="start"
borderRadius="12px"
theme={theme}
padding='10px 0 0 0'
>
{showPendingRequests &&
pendingMembers &&
Expand All @@ -123,7 +122,7 @@ export const PendingMembers = ({
icon: item?.userInfo?.profile?.picture || null,
chatId: null,
web3Name: null,
recipient: shortenText(pCAIP10ToWallet(item.address?.split(':')[1]), 6, true),
recipient: pCAIP10ToWallet(item.address?.split(':')[1]),
abbrRecipient: shortenText(pCAIP10ToWallet(item.address?.split(':')[1]), 6, true),
desc: null,
}}
Expand Down Expand Up @@ -301,9 +300,8 @@ export const AcceptedMembers = ({
flexDirection="column"
zIndex="2"
justifyContent="start"
overflow="hidden auto"
maxHeight="15rem"
theme={theme}
padding='10px 0 0 0'
>
{acceptedMembers.map((item, index) => (
<MemberProfileCard
Expand All @@ -313,8 +311,8 @@ export const AcceptedMembers = ({
isAdmin(item) && accountStatus?.role === GROUP_ROLES.ADMIN.toLowerCase()
? [removeAdminDropdown, removeMemberDropdown]
: accountStatus?.role === GROUP_ROLES.ADMIN.toLowerCase()
? [addAdminDropdown, removeMemberDropdown]
: []
? [addAdminDropdown, removeMemberDropdown]
: []
}
selectedMemberAddress={selectedMemberAddress}
setSelectedMemberAddress={setSelectedMemberAddress}
Expand Down Expand Up @@ -371,11 +369,11 @@ const PendingSection = styled.div`
align-items: center;
flex: 1;
cursor: pointer;
padding: 15px 20px;
padding: 15px 20px 5px 20px;
box-sizing: border-box;
`;

const ArrowImage = styled(Image)<ShadowedProps>`
const ArrowImage = styled(Image) <ShadowedProps>`
margin-left: auto;
transform: ${(props) => (props?.setPosition ? 'rotate(0)' : 'rotate(180deg)')};
`;
Expand All @@ -390,7 +388,7 @@ const Badge = styled.div`
font-weight: 700;
`;

const ProfileSection = styled(Section)<{ theme: IChatTheme }>`
const ProfileSection = styled(Section) <{ theme: IChatTheme }>`
height: fit-content;
&::-webkit-scrollbar-thumb {
background: transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
}

return () => {
// add comment
//Empty return
};
}, [chatAcceptStream, participantJoinStream]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { createPortal } from 'react-dom';
import { MdCheckCircle, MdError } from 'react-icons/md';
import styled from 'styled-components';

import { deriveChatId, pCAIP10ToWallet, setAccessControl, walletToPCAIP10 } from '../../../helpers';
import { deriveChatId, getDomainIfExists, pCAIP10ToWallet, setAccessControl, walletToPCAIP10 } from '../../../helpers';
import { useChatData, useClickAway, useDeviceWidthCheck, usePushChatStream } from '../../../hooks';
import useFetchChat from '../../../hooks/chat/useFetchChat';
import useGetGroupByIDnew from '../../../hooks/chat/useGetGroupByIDnew';
Expand Down Expand Up @@ -163,7 +163,7 @@ export const MessageInput: React.FC<MessageInputProps> = ({
if (!user) return;
if (chatId) {
let derivedChatId = chatId;
if (derivedChatId.includes('.')) {
if (getDomainIfExists(derivedChatId)) {
derivedChatId = (await deriveChatId(chatId, user))!;
}

Expand Down
8 changes: 5 additions & 3 deletions packages/uiweb/src/lib/components/chat/helpers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Env, IFeeds, IMessageIPFSWithCID, IUser, ParticipantStatus } from '@pus
import { ethers } from 'ethers';
import moment from 'moment';
import { ProfilePicture } from '../../../config';
import { getAddress, walletToPCAIP10 } from '../../../helpers';
import { getAddress, getDomainIfExists, walletToPCAIP10 } from '../../../helpers';
import { Group, IChatPreviewPayload, IMessagePayload, User } from '../exportedTypes';

export const profilePicture = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==`;
Expand Down Expand Up @@ -108,8 +108,6 @@ export const formatAddress = async (chatPreviewPayload: IChatPreviewPayload, env
// check and remove eip155:
if (formattedAddress.includes('eip155:')) {
formattedAddress = formattedAddress.replace('eip155:', '');
} else if (formattedAddress.includes('.')) {
formattedAddress = (await getAddress(formattedAddress, env))!;
}
}

Expand Down Expand Up @@ -228,3 +226,7 @@ export const transformStreamToIMessageIPFSWithCID: (item: any) => IMessageIPFSWi
};
return transformedItem;
};

export const getChatParticipantDisplayName = (derivedChatId: string, chatId: string) => {
return derivedChatId ? getDomainIfExists(chatId) ?? derivedChatId : derivedChatId;
};
Loading
Loading