From ea1a3a848f646606ffebec50bf4e29b08946f946 Mon Sep 17 00:00:00 2001 From: KlausMikhaelson Date: Tue, 19 Dec 2023 07:41:18 -0600 Subject: [PATCH 1/4] fix: fixed create group btn not disabling and added minimum member requirement --- .../src/lib/components/chat/ChatProfile/AddWalletContent.tsx | 2 +- .../uiweb/src/lib/components/chat/CreateGroup/AddWallets.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx index 536548606..0cd4f18ae 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx @@ -185,12 +185,12 @@ export const AddWalletContent = ({
{ - // console.log(groupMembers); onSubmit() }} isLoading={isLoading} memberListCount={memberList?.length > 0} theme={theme} + disabled={isLoading || groupMembers.length === 0} > {!isLoading && groupMembers ? (submitButtonTitle ? submitButtonTitle : 'Add To Group'): ''} {isLoading && } diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/AddWallets.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/AddWallets.tsx index db2a4f965..c770bfa9e 100644 --- a/packages/uiweb/src/lib/components/chat/CreateGroup/AddWallets.tsx +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/AddWallets.tsx @@ -23,7 +23,7 @@ interface AddWalletsInCreateGroupProps { } const AddWalletsInCreateGroup = ({ handlePrevious, onClose,groupInputDetails, groupEncryptionType, checked, criteriaStateManager, groupMembers, setGroupMembers }: AddWalletsInCreateGroupProps) => { - const { createGatedGroup } = useCreateGatedGroup(); + const { createGatedGroup, loading } = useCreateGatedGroup(); const groupInfoToast = useToast(); const getEncryptionType = () => { if (groupEncryptionType === 'encrypted') { @@ -85,7 +85,7 @@ const AddWalletsInCreateGroup = ({ handlePrevious, onClose,groupInputDetails, gr memberList={groupMembers} handleMemberList={setGroupMembers} groupMembers={groupInputDetails.groupMembers} - isLoading={false} + isLoading={loading} modalHeader="Add Wallets" />
From 4eea456637c60997ea5f3f5d8a3a917638db946f Mon Sep 17 00:00:00 2001 From: KlausMikhaelson Date: Thu, 21 Dec 2023 06:39:06 -0600 Subject: [PATCH 2/4] feat: implemented option to pass a component in chatprofile --- .../sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx | 3 ++- .../src/app/ChatUITest/ChatViewComponent.tsx | 2 +- .../src/lib/components/chat/ChatProfile/ChatProfile.tsx | 6 ++++++ .../components/chat/ChatViewComponent/ChatViewComponent.tsx | 3 ++- packages/uiweb/src/lib/components/chat/exportedTypes.ts | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx index 505158c71..f65dea1ca 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx @@ -5,8 +5,9 @@ export const ChatProfileTest = () => { return (
Test
} // chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' - chatId='81a077fbec5d64802a0feaeb26647250eb9a20894124c7bc1b2e044f360bf59f' + chatId='0x7EED0188B8E25Ea6a121071980a13333098EA7A0' // chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6' style="Info" /> diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx index 60e28e587..aaa53cb06 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx @@ -20,7 +20,7 @@ const ChatViewComponentTest = () => { console.log("BOIIII RETURNNNSSSSS")} chatId='0xf8250D363BD1F25f52F10C21188fe82c68C049c4' - + Component={() => } limit={10} isConnected={true} groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx index e47d24135..56a0a1b04 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx @@ -41,6 +41,7 @@ export const ChatProfile: React.FC = ({ style, groupInfoModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY, groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL, + Component, }) => { const theme = useContext(ThemeContext); const { account, env } = useChatData(); @@ -127,6 +128,11 @@ export const ChatProfile: React.FC = ({ margin="0 20px 0 auto" alignSelf="center" > + {(Component && !groupInfo) && ( +
+ +
+ )} {(groupInfo?.rules?.chat?.conditions || groupInfo?.rules?.entry?.conditions) && } {!!groupInfo?.isPublic && ( diff --git a/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx b/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx index 09cf1366f..f258253bb 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx @@ -40,6 +40,7 @@ export const ChatViewComponent: React.FC = ( groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL, verificationFailModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY, verificationFailModalPosition = MODAL_POSITION_TYPE.GLOBAL, + Component } = options || {}; const { env, signer, account, pgpPrivateKey } = useChatData(); @@ -62,7 +63,7 @@ export const ChatViewComponent: React.FC = ( padding="13px" theme={theme} > - {chatProfile && } + {chatProfile && }
void; + Component?: React.FC; } export interface IChatProfile { @@ -32,6 +33,7 @@ export interface IChatProfile { style: "Info" | "Preview"; groupInfoModalBackground?: ModalBackgroundType; groupInfoModalPositionType?: ModalPositionType; + Component?: React.FC; } export interface TwitterFeedReturnType { From d2985aee6f1ae56892b88ad371d08333e22b4880 Mon Sep 17 00:00:00 2001 From: KlausMikhaelson Date: Fri, 22 Dec 2023 02:31:33 -0600 Subject: [PATCH 3/4] fix: added styling for the component in chat profile --- .../sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx | 2 +- .../sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx | 2 +- .../uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx index f65dea1ca..f453db75c 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx @@ -7,7 +7,7 @@ export const ChatProfileTest = () => { } // chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' - chatId='0x7EED0188B8E25Ea6a121071980a13333098EA7A0' + chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' // chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6' style="Info" /> diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx index aaa53cb06..35c955a9f 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx @@ -20,7 +20,7 @@ const ChatViewComponentTest = () => { console.log("BOIIII RETURNNNSSSSS")} chatId='0xf8250D363BD1F25f52F10C21188fe82c68C049c4' - Component={() => } + Component={() => } limit={10} isConnected={true} groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx index 56a0a1b04..e3661dda9 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx @@ -129,7 +129,7 @@ export const ChatProfile: React.FC = ({ alignSelf="center" > {(Component && !groupInfo) && ( -
+
)} From de355a91e5cc6f91e5e07cf3d68efd7f7f5e4a76 Mon Sep 17 00:00:00 2001 From: KlausMikhaelson Date: Sun, 24 Dec 2023 08:59:15 -0600 Subject: [PATCH 4/4] fix: changed component type and how it is rendered --- .../src/app/ChatUITest/ChatProfile.tsx | 9 ++++----- .../src/app/ChatUITest/ChatViewComponent.tsx | 2 +- .../src/lib/components/chat/ChatProfile/ChatProfile.tsx | 6 +++--- .../chat/ChatViewComponent/ChatViewComponent.tsx | 4 ++-- packages/uiweb/src/lib/components/chat/exportedTypes.ts | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx index f453db75c..274ae7b54 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx @@ -5,12 +5,11 @@ export const ChatProfileTest = () => { return (
} - // chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' - chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' - // chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6' + component={
Some component
} + chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' +// chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6' style="Info" - /> + />
) } diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx index 35c955a9f..c3ac5da4d 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx @@ -20,7 +20,7 @@ const ChatViewComponentTest = () => { console.log("BOIIII RETURNNNSSSSS")} chatId='0xf8250D363BD1F25f52F10C21188fe82c68C049c4' - Component={() => } + component={} limit={10} isConnected={true} groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx index e3661dda9..d02c480e3 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx @@ -41,7 +41,7 @@ export const ChatProfile: React.FC = ({ style, groupInfoModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY, groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL, - Component, + component=null, }) => { const theme = useContext(ThemeContext); const { account, env } = useChatData(); @@ -128,9 +128,9 @@ export const ChatProfile: React.FC = ({ margin="0 20px 0 auto" alignSelf="center" > - {(Component && !groupInfo) && ( + {(component && !groupInfo) && (
- + {component}
)} {(groupInfo?.rules?.chat?.conditions || diff --git a/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx b/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx index f258253bb..3c8d43587 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx @@ -40,7 +40,7 @@ export const ChatViewComponent: React.FC = ( groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL, verificationFailModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY, verificationFailModalPosition = MODAL_POSITION_TYPE.GLOBAL, - Component + component=null } = options || {}; const { env, signer, account, pgpPrivateKey } = useChatData(); @@ -63,7 +63,7 @@ export const ChatViewComponent: React.FC = ( padding="13px" theme={theme} > - {chatProfile && } + {chatProfile && }
void; - Component?: React.FC; + component?: React.ReactNode; } export interface IChatProfile { @@ -33,7 +33,7 @@ export interface IChatProfile { style: "Info" | "Preview"; groupInfoModalBackground?: ModalBackgroundType; groupInfoModalPositionType?: ModalPositionType; - Component?: React.FC; + component?: React.ReactNode; } export interface TwitterFeedReturnType {