Skip to content

Commit

Permalink
fix: merged main
Browse files Browse the repository at this point in the history
  • Loading branch information
akp111 committed Dec 4, 2023
2 parents 7651357 + f765f51 commit 440c886
Show file tree
Hide file tree
Showing 23 changed files with 265 additions and 152 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/auto_add_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Auto-add issues to org project

on:
issues:
types:
- opened

jobs:
add-to-project:
name: Auto-add issues to org project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/ethereum-push-notification-service/projects/10
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
3 changes: 3 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-checkout "$@"
3 changes: 3 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-commit "$@"
3 changes: 3 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs post-merge "$@"
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; }
git lfs pre-push "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ChatProfileTest = () => {
<div>
<ChatProfile
// chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B'
chatId='a72832107b8ae7624c1ec997cee8e8b2bc21db708465555c20c4d5e029210cd6'
chatId='81a077fbec5d64802a0feaeb26647250eb9a20894124c7bc1b2e044f360bf59f'
// chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6'
style="Info"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const ChatViewComponentTest = () => {

<ChatView
onVerificationFail={() => console.log("BOIIII RETURNNNSSSSS")}
chatId='4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68'
chatId='0xf8250D363BD1F25f52F10C21188fe82c68C049c4'

limit={10}
isConnected={true}
groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ChatViewListTest = () => {
{/* <Loader show={isLoading} /> */}

<ChatViewListCard>
<ChatViewList chatId='b8e068e02fe12d7136bc2f24408835573f30c6fbf0b65ea26ab4c7055a2c85f1' limit={10} />
<ChatViewList chatId='0x5fca4523728576d6DD418137D5C8F38de5e6A1A8' limit={10} />

</ChatViewListCard>
{/* <MessageInput chatId='196f58cbe07c7eb5716d939e0a3be1f15b22b2334d5179c601566600016860ac' isConnected={true} /> */}
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-frontend-react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ const checkForWeb3Data = ({

export function App() {
const { account, library, active, chainId } = useWeb3React();
const [env, setEnv] = useState<ENV>(ENV.DEV);
const [env, setEnv] = useState<ENV>(ENV.PROD);
const [isCAIP, setIsCAIP] = useState(false);
const [signer, setSigner] = useState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type AddWalletContentProps = {
groupMembers: any;
isLoading?: boolean;
modalHeader: string;
title?: string;
submitButtonTitle?: string;
};
export const AddWalletContent = ({
onSubmit,
Expand All @@ -44,6 +46,8 @@ export const AddWalletContent = ({
handleMemberList,
groupMembers,
isLoading,
title,
submitButtonTitle,
}: AddWalletContentProps) => {
const theme = useContext(ThemeContext);

Expand Down Expand Up @@ -86,6 +90,10 @@ export const AddWalletContent = ({

const addMemberToList = (member: User) => {
let errorMessage = '';
const isMemberAlreadyAdded = memberList?.find(
(user: any) => user.wallets.toLowerCase() === member.wallets.toLowerCase()
);
console.log('member', member);

errorMessage = addWalletValidation(
member,
Expand All @@ -101,7 +109,7 @@ export const AddWalletContent = ({
toastType: 'ERROR',
getToastIcon: (size) => <MdError size={size} color="red" />,
});
} else {
} else if(!isMemberAlreadyAdded) {
handleMemberList((prev: any) => [...prev, { ...member, isAdmin: false }]);
}

Expand All @@ -123,7 +131,7 @@ export const AddWalletContent = ({
flexDirection="column"
padding={isMobile ? '0px auto' : '0px 10px'}
>
<ModalHeader title='Add More Wallets' handleClose={onClose} handlePrevious={handlePrevious} />
<ModalHeader title={title ? title : 'Add More Wallets'} handleClose={onClose} handlePrevious={handlePrevious} />

<Section
margin="50px 0 10px 0"
Expand All @@ -137,8 +145,8 @@ export const AddWalletContent = ({

<Span fontSize="14px" color={theme.textColor?.modalSubHeadingText}>
{groupMembers
? `0${memberList?.length + groupMembers?.length} / 09 Members`
: `0${memberList?.length} / 09 Members`}
? `0${memberList?.length + groupMembers?.length} / 5000 Members`
: `0${memberList?.length} / 5000 Members`}
</Span>
</Section>

Expand All @@ -162,7 +170,7 @@ export const AddWalletContent = ({
) }

<MultipleMemberList>
{memberList?.map((member: any, index: any) => (
{memberList && memberList?.map((member: any, index: any) => (
<MemberListContainer
key={index}
memberList={memberList}
Expand All @@ -176,12 +184,15 @@ export const AddWalletContent = ({

<Section flex="1" alignSelf="center">
<ModalConfirmButton
onClick={() => onSubmit()}
onClick={() => {
// console.log(groupMembers);
onSubmit()
}}
isLoading={isLoading}
memberListCount={memberList?.length > 0}
theme={theme}
>
{!isLoading && groupMembers ? 'Add To Group' : ''}
{!isLoading && groupMembers ? (submitButtonTitle ? submitButtonTitle : 'Add To Group'): ''}
{isLoading && <Spinner size="30" color="#fff" />}
</ModalConfirmButton>
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export const ApproveRequestBubble = ({
borderRadius=" 0px 12px 12px 12px"
alignSelf="start"
justifyContent="start"
maxWidth="68%"
maxWidth="600px"
width='40%'
minWidth="15%"
position="relative"
flexDirection="column"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useContext, useEffect, useRef, useState } from 'react';

import {
GroupDTO,
IFeeds,
IMessageIPFS,
IMessageIPFSWithCID,
Expand All @@ -24,7 +25,7 @@ import {
walletToPCAIP10,
} from '../../../helpers';
import { useChatData, usePushChatSocket } from '../../../hooks';
import { Messagetype } from '../../../types';
import { IGroup, Messagetype } from '../../../types';
import { ThemeContext } from '../theme/ThemeProvider';
import { IChatTheme } from '../theme';

Expand Down Expand Up @@ -84,17 +85,19 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
}
})();
}, [account]);

useEffect(() => {
setMessages(undefined);
setConversationHash(undefined);
setChatFeed({} as IFeeds);
setMessages(undefined);


}, [chatId, account, pgpPrivateKey, env]);

//need to make a common method for fetching chatFeed to ruse in messageInput
useEffect(() => {
(async () => {
if (!account && !env) return;
const chat = await fetchChat({ chatId });
const chat = await fetchChat({ chatId:chatId });
if (Object.keys(chat || {}).length) {
setConversationHash(chat?.threadhash as string);
setChatFeed(chat as IFeeds);
Expand Down Expand Up @@ -127,6 +130,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
}
setLoading(false);
})();

}, [chatId, pgpPrivateKey, account, env]);

//moniters socket changes
Expand All @@ -135,17 +139,18 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
const updatedChatFeed = chatFeed;
updatedChatFeed.msg = messagesSinceLastConnection;
if (!Object.keys(messages || {}).length) {

setFilteredMessages([
messagesSinceLastConnection,
] as IMessageIPFSWithCID[]);

setConversationHash(messagesSinceLastConnection.cid);
} else {
const newChatViewList = appendUniqueMessages(
messages as Messagetype,
[messagesSinceLastConnection],
false
);

setFilteredMessages(newChatViewList as IMessageIPFSWithCID[]);
}
setChatStatusText('');
Expand All @@ -154,15 +159,24 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
}
}, [messagesSinceLastConnection]);

// remove fetching group once stream comes
useEffect(() => {
if (Object.keys(groupInformationSinceLastConnection || {}).length) {
if (
chatFeed?.groupInformation?.chatId.toLowerCase() ===
groupInformationSinceLastConnection.chatId.toLowerCase()
) {
const updateChatFeed = chatFeed;
updateChatFeed.groupInformation = groupInformationSinceLastConnection;
setChatFeed(updateChatFeed);
(async()=>{
const updateChatFeed = chatFeed;
const group:IGroup | undefined = await getGroup({ searchText: chatId });
if (group || !!Object.keys(group || {}).length){
updateChatFeed.groupInformation = group! as GroupDTO ;

setChatFeed(updateChatFeed);
}

})();

}
}
}, [groupInformationSinceLastConnection]);
Expand All @@ -173,11 +187,11 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
await getMessagesCall();
})();
}
}, [conversationHash, pgpPrivateKey, account, env,chatFeed]);
}, [conversationHash, pgpPrivateKey, account, env,chatFeed, chatId]);

useEffect(() => {
scrollToBottom();
}, [conversationHash]);
}, [conversationHash, account, env, chatId, pgpPrivateKey, chatFeed]);

useEffect(() => {
if (
Expand Down Expand Up @@ -239,7 +253,6 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
} else {
threadHash = messages?.lastThreadHash;
}

if (
threadHash &&
((account && pgpPrivateKey&& chatFeed && !chatFeed?.groupInformation) ||
Expand All @@ -257,9 +270,9 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
chatHistory,
true
);

setFilteredMessages(newChatViewList as IMessageIPFSWithCID[]);
} else {

setFilteredMessages(chatHistory as IMessageIPFSWithCID[]);
}
}
Expand All @@ -280,6 +293,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
};

const ifBlurChat = () =>{

return !!(
chatFeed &&
chatFeed?.groupInformation &&
Expand Down Expand Up @@ -387,7 +401,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
}
)}
</Section>
{chatFeed &&
{!!Object.keys(chatFeed || {}).length &&
account &&
checkIfIntent({
chat: chatFeed as IFeeds,
Expand Down
Loading

0 comments on commit 440c886

Please sign in to comment.