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

Support chat class based #843

Merged
merged 8 commits into from
Nov 16, 2023
Merged

Support chat class based #843

merged 8 commits into from
Nov 16, 2023

Conversation

pritipsingh
Copy link
Contributor

Things changed:

  • Shifted to new class based components for support chat

Copy link

File: packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx

  • Line 49: The theme prop should be assigned the theme variable defined earlier in the component. Replace theme={lightTheme} with theme={theme}.

File: packages/uiweb/src/lib/components/supportChat/Chat.tsx

  • Line 31: Remove the extra , after theme = { ...lightTheme },.
  • Line 73: Remove the , after toastType.
  • Line 150: The screenScrollPos state variable is missing the useState declaration. Add , setScreenScrollPos after const [lastThreadHashFetched, setLastThreadHashFetched] = useState<string | null>(null).
  • Line 176: Add a closing } after content.scrollTop = curScrollPos + (newScroll - oldScroll);.
  • Line 179: Remove the extra , after setLoading(false).

File: packages/uiweb/src/lib/components/supportChat/Modal.tsx

  • Line 30: Remove , after socketData.
  • Line 38: The greetingMsgObject.icon prop should use the btnColorPrimary property from the theme variable. Replace theme.btnColorPrimary with theme?.btnColorPrimary.
  • Line 48: Remove , after messageBeingSent.
  • Line 52: Remove , after messageBeingSent.
  • Line 58: Remove , after messageBeingSent.
  • Line 66: Remove , after messageBeingSent.
  • Line 73: Remove , after messageBeingSent.
  • Line 76: Add a closing } after scrollToBottom();.
  • Line 79: Add a closing } after '[connectedUser, env, account, socketData]'.
  • Line 113: Remove , after toastType.

File: packages/uiweb/src/lib/helpers/chat/chat.ts

  • This file appears to be empty. Please check if it should be included.

File: packages/uiweb/src/lib/hooks/useSDKSocket.ts

  • Line 21: Remove the unused import for createSocketConnection.
  • Line 21: Remove , EVENTS after createSocketConnection.
  • Line 28: Remove , userAlice after apiKey.
  • Line 33: Remove , userAlice after apiKey.
  • Line 47: Remove , userAlice after apiKey.

All looks good.

Copy link

All looks good.

Copy link
Contributor

@mishramonalisha76 mishramonalisha76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove console log
Clear unsused variables

packages/uiweb/src/lib/components/supportChat/Chat.tsx Outdated Show resolved Hide resolved
packages/uiweb/src/lib/hooks/useSDKSocket.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@mishramonalisha76 mishramonalisha76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pritipsingh the updation of message from socket is not working properly

Copy link

All looks good.

Copy link

File: packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx

  • The provider prop is not used in the component. Consider removing it if it's not needed.
  • The primaryColor prop is defined in the component's prop type but not used in the component. Consider removing it if it's not needed.

File: packages/uiweb/src/lib/components/supportChat/AddressInfo.tsx

  • In the useEffect hook, the condition if(userAlice){ is missing the closing }. Please add it for correct code syntax.
  • The prop theme is not used in the Container component. Consider removing it if it's not needed.

File: packages/uiweb/src/lib/components/supportChat/Chat.tsx

  • The ButtonStyleProps interface is defined but unused. Consider removing it if it's not needed.
  • The export keyword is out of place. Please remove it.
  • The account prop is defined but not used in the component. Consider removing it if it's not needed.
  • The ChatProps interface is missing a closing }. Please add it for correct code syntax.
  • In the useEffect hook, the condition if(signer) { is missing the closing }. Please add it for correct code syntax.
  • In the same useEffect hook, the condition if (!account) { is missing the closing }. Please add it for correct code syntax.
  • In the same useEffect hook, the condition else{ is missing the closing }. Please add it for correct code syntax.
  • The accountadd state variable is defined but not used. Consider removing it if it's not needed.

File: packages/uiweb/src/lib/components/supportChat/ChatInput.tsx

  • The loading state variable is defined but not used. Consider removing it if it's not needed.
  • The SmileyIcon and AttachmentIcon imports are unused. Consider removing them if they're not needed.
  • The Spinner import is unused and seems to be from a wrong location. Please remove it if it's not needed.
  • The showEmojis state variable is defined but not used. Consider removing it if it's not needed.
  • The fileInputRef reference is unused. Consider removing it if it's not needed.
  • The filesUploading state variable is defined but not used. Consider removing it if it's not needed.
  • The env prop is defined but not used in the component. Consider removing it if it's not needed.
  • The socketData and setChatsSorted variables are defined but not used in the component. Consider removing them if they're not needed.
  • The ChangeEvent type import is unused. Consider removing it if it's not needed.

File: packages/uiweb/src/lib/types/index.ts

  • The IFeeds and Rules imports are unused. Consider removing them if they're not needed.
  • The signTypedData method definition in the viemSignerType interface is incomplete and contains an incorrect type annotation. Please fix it for correct code syntax.

Comment on lines 82 to 103
setAccount(address);
setAccountadd(address);
const userAlice = await PushAPI.initialize(signer, {env: env , account:address});
setUserAlice(userAlice)
}
else{
setAccount(account);
setAccountadd(account);
const userAlice = await PushAPI.initialize(signer, {env: env , account:account});
setUserAlice(userAlice)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do the initialize in a useEffect, this makes the code redundant?

Comment on lines +58 to +59
// sendResponse.messageContent = message;
// setChatsSorted([...chats, sendResponse]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am keeping this incase I want to shift to sorting message like this in the future. But rest every other comments I have removed

packages/uiweb/src/lib/components/supportChat/Chats.tsx Outdated Show resolved Hide resolved
Comment on lines 122 to 133
// const getUpdatedChats = (message:IMessageIPFS) =>{
// console.log(message)
// if (message && (supportAddress === pCAIP10ToWallet(message?.from))) {
// const chat = await decryptChat({ message, connectedUser, env });
// socketData.messagesSinceLastConnection.decrypted = true;

// setChatsSorted([...chats, message]);
// }
// }



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this section

Copy link

File: packages/examples/sdk-frontend-react/src/app/ChatSupportTest.tsx

  • The ChatSupportTest component is missing the return type. It should be React.ReactElement or JSX.Element.

File: packages/uiweb/src/lib/components/supportChat/AddressInfo.tsx

  • The useState hook is missing a type declaration for the user state variable. It should be useState<any>({}).

File: packages/uiweb/src/lib/components/supportChat/Chat.tsx

  • The Chat component is missing the return type. It should be React.ReactElement or JSX.Element.
  • The account prop in the ChatProps type declaration is not indented properly.
  • The export keyword is misplaced, it should be at the beginning of the line.
  • There are unnecessary empty lines and comments in the code.

File: packages/uiweb/src/lib/components/supportChat/ChatInput.tsx

  • The ChatInput component is missing the return type. It should be React.ReactElement or JSX.Element.
  • The handleKeyPress function should be indented properly.
  • The textOnChange function should be indented properly.

File: packages/uiweb/src/lib/components/supportChat/Chats.tsx

  • The Chats component is missing the return type. It should be React.ReactElement or JSX.Element.

File: packages/uiweb/src/lib/components/supportChat/Modal.tsx

  • The Modal component is missing the return type. It should be React.ReactElement or JSX.Element.

File: packages/uiweb/src/lib/helpers/chat/chat.ts

  • It seems like the chat.ts file is missing and should be reviewed.

File: packages/uiweb/src/lib/hooks/useSDKSocket.ts

  • It seems like the useSDKSocket.ts file is missing and should be reviewed.

File: packages/uiweb/src/lib/types/index.ts

  • The ethersV5SignerType type in the index.ts file is missing and should be reviewed.

File: packages/uiweb/yarn.lock

  • The yarn.lock file is not supposed to be reviewed as part of the code.

Copy link

All looks good.

Copy link

All looks good.

@mohammeds1992 mohammeds1992 merged commit b364cee into main Nov 16, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants