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.3.7 - Build error fixed #1335

Merged
merged 30 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 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
8c45b54
fix: update chatprevie badge conditions
corlard3y 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
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 @@ -55,7 +55,7 @@ const ChatPreviewTest = () => {
"Well, hello there, human! It's a pleasure to be in the presence of such a sophisticated carbon-based life form. How can I assist you today? Or perhaps you just want to chat and bask in the glory of my witty remarks? Either way, I'm here for you!",
},
}}
badge={{ count: 1 }}
badge={{ count: 2 }}
selected={false}
setSelected={console.log('Selected')}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ChatPreviewSearchList } from '@pushprotocol/uiweb';
import styled from 'styled-components';

const ChatPreviewSearchListTest = () => {
const walletAddress = "0xFA3F8E79fb9B03e7a04295594785b91588Aa4DC8";
const walletAddress = 'fabio.eth';
return (
<>
<Conatiner>
Expand Down
3 changes: 1 addition & 2 deletions packages/examples/sdk-frontend-react/src/app/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
// the unique id for a chat or the receivers's wallet ddress or domain name
export const CHAT_ID =
'34c44214589cecc176a136ee1daf0f0231ecc6d6574b920b5ae39eb971fa3cb4';
export const CHAT_ID = 'allen.bnb';
1 change: 1 addition & 0 deletions packages/uiweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@livepeer/react": "^2.6.0",
"@pushprotocol/socket": "^0.5.0",
"@unstoppabledomains/resolution": "^8.5.0",
"@web3-name-sdk/core": "^0.1.15",
"@web3-onboard/coinbase": "^2.2.5",
"@web3-onboard/core": "^2.21.1",
"@web3-onboard/injected-wallets": "^2.10.5",
Expand Down
13 changes: 10 additions & 3 deletions packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { pCAIP10ToWallet } from '../../../helpers';
import { createBlockie } from '../../../helpers/blockies';
import { IChatTheme } from '../theme';
import { ThemeContext } from '../theme/ThemeProvider';
import { pushBotAddress } from '../../../config/constants';
/**
* @interface IThemeProps
* this interface is used for defining the props for styled components
Expand All @@ -41,7 +42,7 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
setFormattedAddress(address);
if (!options.chatPreviewPayload?.chatGroup) {
try {
const result = await resolveWeb3Name(address, user);
const result = await resolveWeb3Name(address, user?.env);
if (result) setWeb3Name(result);
} catch (e) {
// console.debug(e);
Expand All @@ -50,6 +51,10 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
})();
}, []);

const hasBadgeCount = !!options?.badge?.count;
const isSelected = options?.selected;
const isBot = options?.chatPreviewPayload?.chatParticipant === "PushBot" || options?.chatPreviewPayload?.chatParticipant === pushBotAddress;

// For blockie if icon is missing
const blockieContainerRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -159,6 +164,7 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
flex="initial"
cursor="pointer"
className={options.readmode ? 'skeleton' : ''}
animation={theme.skeletonBG}
>
<Message theme={theme}>
{options?.chatPreviewPayload?.chatMsg?.messageType === 'Image' ||
Expand Down Expand Up @@ -193,8 +199,9 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
options?.chatPreviewPayload?.chatMsg?.messageContent
)}
</Message>
{!!options?.badge?.count && <Badge theme={theme}>{options.badge.count}</Badge>}
</Section>

{hasBadgeCount && !(isBot || (isSelected && hasBadgeCount)) && <Badge theme={theme}>{options.badge?.count}</Badge>}
</Section>
</Section>
</Button>
</ChatPreviewContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const ChatProfile: React.FC<IChatProfile> = ({
// To setup web3 name, asynchrounously
const setupWeb3Name = async (address: string) => {
console.debug('UIWeb::ChatProfile::setupWeb3Name sending address for resolution', address);
const result = await resolveWeb3Name(address, user);
const result = await resolveWeb3Name(address, user?.env);
console.debug('UIWeb::ChatProfile::setupWeb3Name got result as ', address, result);

setInitialized((prevState) => ({
Expand Down Expand Up @@ -372,7 +372,7 @@ const AddonComponentSection = styled(Section)`

@media ${device.mobileL} {
gap: 5px;
} ;
}
`;

const ImageItem = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,16 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis

// Change listtype to 'CHATS' and hidden to false when chatAcceptStream is received
useEffect(() => {
if (Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) {
if (
(Object.keys(chatAcceptStream || {}).length > 0 && chatAcceptStream.constructor === Object) ||
(Object.keys(participantJoinStream || {}).length > 0 && participantJoinStream.constructor === Object)
) {
// Always change hidden to false and list will be CHATS
const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) };
if (updatedChatInfo) updatedChatInfo.list = 'CHATS';
if (updatedChatInfo) {
updatedChatInfo.list = 'CHATS';
if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = true;
}

// set initialized after chat accept animation is done
const timer = setTimeout(() => {
Expand All @@ -293,15 +299,23 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
return () => clearTimeout(timer);
}

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

// Change listtype to 'UINITIALIZED' and hidden to true when participantRemoveStream or participantLeaveStream is received
useEffect(() => {
if (Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) {
if (
(Object.keys(participantRemoveStream || {}).length > 0 && participantRemoveStream.constructor === Object) ||
(Object.keys(participantLeaveStream || {}).length > 0 && participantLeaveStream.constructor === Object)
) {
// If not encrypted, then set hidden to false
const updatedChatInfo = { ...(initialized.chatInfo as IChatInfoResponse) };
if (updatedChatInfo) updatedChatInfo.list = 'UNINITIALIZED';
if (updatedChatInfo) {
updatedChatInfo.list = 'UNINITIALIZED';
if (updatedChatInfo?.meta) updatedChatInfo.meta.visibility = false;
}

setInitialized({ ...initialized, chatInfo: updatedChatInfo, isHidden: true });
}
Expand Down Expand Up @@ -514,7 +528,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
justifyContent="start"
width="100%"
ref={chatContainerRef}
blur={initialized.isHidden}
blur={initialized.isHidden && initialized?.chatInfo?.list !== 'REQUESTS'}
>
{messages &&
messages?.map((chat: IMessageIPFS, index: number) => {
Expand Down Expand Up @@ -585,5 +599,5 @@ const ChatViewListCard = styled(Section)<IThemeProps>`
`;

const ChatViewListCardInner = styled(Section)<IThemeProps>`
filter: ${(props) => (props.blur ? 'blur(6px)' : 'none')};
filter: ${(props) => (props.blur ? 'blur(12px)' : 'none')};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const EncryptionMessage = ({ id, className }: { id: EncryptionKeys; class
fontWeight="400"
textAlign="left"
className={className}
animation={theme.skeletonBG}
>
{EncryptionMessageContent[id].text}
</Span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import { createPortal } from 'react-dom';

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

Expand All @@ -15,7 +15,7 @@ import { ProfileContainer } from '../reusables';
import { ThemeContext } from '../theme/ThemeProvider';
import { UpdateUserProfileModal } from './UpdateUserProfileModal';

import { CoreContractChainId, InfuraAPIKey, ProfilePicture, device } from '../../../config';
import { Constants, CoreContractChainId, InfuraAPIKey, ProfilePicture, device } from '../../../config';
import VerticalEllipsisIcon from '../../../icons/VerticalEllipsis.svg';
import UserProfileIcon from '../../../icons/userCircleGear.svg';
import { MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE } from '../../../types';
Expand Down Expand Up @@ -50,7 +50,7 @@ export const UserProfile: React.FC<UserProfileProps> = ({
(async () => {
const fetchedUser = await fetchChatProfile({ user });
if (fetchedUser) {
const result = await resolveWeb3Name(fetchedUser?.wallets, user);
const result = await resolveWeb3Name(fetchedUser?.wallets, user?.env);
setWeb3Name(result);
setUserProfile(fetchedUser);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const AddWallets = ({
};

const handleSearch = async ({ searchedText }: { searchedText: string }): Promise<void> => {
//fix ens search
const newChatUser = await getNewChatUser({
searchText: searchedText,
fetchChatProfile: fetchUserProfile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const ProfileContainer = ({ theme, member, copy, customStyle, loading }:
borderRadius="100%"
overflow="hidden"
className={loading ? 'skeleton' : ''}
animation={theme.skeletonBG}
>
{member?.icon && (
<Image
Expand Down Expand Up @@ -131,6 +132,7 @@ export const ProfileContainer = ({ theme, member, copy, customStyle, loading }:
setCopyText('Copied');
}}
className={loading ? 'skeleton' : ''}
animation={theme.skeletonBG}
>
<RecipientSpan
fontSize={member?.name || member?.web3Name ? '14px' : customStyle?.fontSize ?? '18px'}
Expand Down
33 changes: 32 additions & 1 deletion packages/uiweb/src/lib/components/chat/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* @file theme file: all the predefined themes are defined here
*/
import { CHAT_THEME_OPTIONS } from '../exportedTypes';
import styled, { keyframes, css } from 'styled-components';
// bgColorPrimary: "#fff",
// bgColorSecondary: "#D53A94",
// textColorPrimary: "#1e1e1e",
Expand Down Expand Up @@ -191,10 +192,38 @@ export interface IChatTheme {
textColor?: ITextColor;
backdropFilter?: string;
scrollbarColor?: string;

skeletonBG?: any;
spinnerColor?: string;
}

const lightSkeletonLoading = keyframes`
0% {
background-color: hsl(200, 20%, 80%);
}
100% {
background-color: hsl(200, 20%, 95%);
}
`;

const darkSkeletonLoading = keyframes`
0% {
background-color: #575D73;
}
100% {
background-color: #6E748B;
}
`;

const animation = () =>
css`
${lightSkeletonLoading} 1s linear infinite alternate;
`;

const darkAnimation = () =>
css`
${darkSkeletonLoading} 1s linear infinite alternate;
`;

//dark theme object
export const lightChatTheme: IChatTheme = {
borderRadius: {
Expand Down Expand Up @@ -368,6 +397,7 @@ export const lightChatTheme: IChatTheme = {
backdropFilter: 'none',
spinnerColor: 'rgb(202, 89, 155)',
scrollbarColor: 'rgb(202, 89, 155)',
skeletonBG: animation
};

export const darkChatTheme: IChatTheme = {
Expand Down Expand Up @@ -541,4 +571,5 @@ export const darkChatTheme: IChatTheme = {
backdropFilter: 'none',
spinnerColor: 'rgb(202, 89, 155)',
scrollbarColor: 'rgb(202, 89, 155)',
skeletonBG: darkAnimation
};
22 changes: 10 additions & 12 deletions packages/uiweb/src/lib/components/notification/chainDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import { TheGraphSvg } from '../../icons/TheGraphSvg';
import LineaSVG from '../../icons/LineaSVG';
import { CyberConnectSVG } from '../../icons/CyberConnectSVG';
const createSVGIcon = (element: any, chainName: string) => {
return (
<Tooltip tooltipContent={`Delivered by ${chainName}`}>{element}</Tooltip>
);
return <Tooltip tooltipContent={`Delivered by ${chainName}`}>{element}</Tooltip>;
};

export default {
Expand Down Expand Up @@ -84,21 +82,21 @@ export default {
BERACHAIN_TESTNET: {
label: 'BERACHAIN TESTNET',
icon: createSVGIcon(<BerachainSVG />, 'Berachain Testnet'),
},
},
CYBER_CONNECT_TESTNET: {
label: 'CYBER CONNECT TESTNET',
icon: createSVGIcon(<CyberConnectSVG/>, 'CyberConnect Testnet'),
icon: createSVGIcon(<CyberConnectSVG />, 'CyberConnect Testnet'),
},
LINEA_TESTNET : {
LINEA_TESTNET: {
label: 'LINEA TESTNET',
icon: createSVGIcon(<LineaSVG/>, 'Linea Testnet'),
icon: createSVGIcon(<LineaSVG />, 'Linea Testnet'),
},
LIENA_MAINNET : {
label: 'LIENA MAINNET',
icon: createSVGIcon(<LineaSVG/>, 'Linea Mainnet'),
LINEA_MAINNET: {
label: 'LINEA MAINNET',
icon: createSVGIcon(<LineaSVG />, 'Linea Mainnet'),
},
CYBER_CONNECT_MAINNET: {
label: 'CYBER CONNECT MAINNET',
icon: createSVGIcon(<CyberConnectSVG/>, 'CyberConnect Mainnet'),
}
icon: createSVGIcon(<CyberConnectSVG />, 'CyberConnect Mainnet'),
},
};
Loading
Loading