Skip to content

Commit

Permalink
fix: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammeds1992 committed Nov 9, 2023
2 parents 18b58ba + 2d4c6e1 commit f30db09
Show file tree
Hide file tree
Showing 72 changed files with 3,271 additions and 1,741 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"react-router-dom": "6.3.0",
"regenerator-runtime": "0.13.7",
"socket.io-client": "^4.5.2",
"styled-components": "^5.3.5",
"styled-components": "^6.0.8",
"tiny-invariant": "^1.2.0",
"ts-mocha": "^10.0.0",
"tslib": "^2.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from 'react';
import { Web3Provider } from '@ethersproject/providers';
import { Chat, ITheme } from '@pushprotocol/uiweb';
import { SupportChat, ITheme } from '@pushprotocol/uiweb';
import { lightTheme } from '@pushprotocol/uiweb';
import { EnvContext, Web3Context } from './context';

Expand Down Expand Up @@ -31,10 +31,11 @@ export const ChatSupportTest = () => {
};

return (
<Chat
account={account}
//works as Chat as well as Support Chat
<SupportChat

signer={librarySigner}
supportAddress="0xD2A371cAFBE09333F6668229E4BD33196583c325"
supportAddress="0x6F7919412318E65109c5698bd0E640fc33DE2337"
apiKey="tAWEnggQ9Z.UaDBNjrvlJZx3giBTIQDcT8bKQo1O1518uF1Tea7rPwfzXv2ouV5rX9ViwgJUrXm"
env={env}
greetingMsg="How can i help you?"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styled from 'styled-components';

import { Section } from '../components/StyledComponents';
import { CreateGroupModal } from "@pushprotocol/uiweb";
import { ChatViewComponent } from '@pushprotocol/uiweb';
import { CreateGroupModal, MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE } from "@pushprotocol/uiweb";
import { ChatView } from '@pushprotocol/uiweb';

const ChatViewComponentTest = () => {
const chatFilterList = [
Expand All @@ -15,7 +15,17 @@ const ChatViewComponentTest = () => {
<h2>Chat UI Test page</h2>
<CreateGroupModal onClose={()=>{console.log('in close')}} />
<ChatViewComponentCard>
<ChatViewComponent onGetTokenClick={() => console.log("BOIIII RETURNNNSSSSS")} chatId='4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68' limit={10} isConnected={true} />
<CreateGroupModal onClose={()=>{console.log('in close')}} modalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} modalPositionType={MODAL_POSITION_TYPE.RELATIVE}/>

<ChatView
onVerificationFail={() => console.log("BOIIII RETURNNNSSSSS")}
chatId='4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68'
limit={10}
isConnected={true}
groupInfoModalBackground={MODAL_BACKGROUND_TYPE.OVERLAY}
groupInfoModalPositionType={MODAL_POSITION_TYPE.RELATIVE}
verificationFailModalPosition={MODAL_POSITION_TYPE.RELATIVE}
/>
</ChatViewComponentCard>
</div>
);
Expand All @@ -24,7 +34,8 @@ const ChatViewComponentTest = () => {
export default ChatViewComponentTest;

const ChatViewComponentCard = styled(Section)`
height: 60vh;
height: 80vh;
position:relative;
`;
//c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e
//4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68
8 changes: 6 additions & 2 deletions packages/examples/sdk-frontend-react/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ import SearchSpaceTest from './SpaceTest/SearchSpaceTest';
import SearchGroupTest from './ChatTest/SearchGroupTest';
import RejectRequestTest from './ChatTest/RejectRequestTest';
import GetGroupMemberStatusTest from './ChatTest/GetGroupMemberStatusTest';
import { ChatSupportTest } from './ChatSupportTest';


window.Buffer = window.Buffer || Buffer;
Expand Down Expand Up @@ -313,7 +314,7 @@ export function App() {
<Web3Context.Provider value={{ account, active, library, chainId }}>
<SocketContext.Provider value={socketData}>
<AccountContext.Provider value={{ pgpPrivateKey, setSpaceId }}>
<ChatUIProvider env={env} theme={darkChatTheme} account={account} pgpPrivateKey={pgpPrivateKey} signer={signer}>
<ChatUIProvider env={env} theme={lightChatTheme} >
<SpacesUIProvider spaceUI={spaceUI} theme={customDarkTheme}>
<Routes>
<Route
Expand Down Expand Up @@ -559,7 +560,10 @@ export function App() {
<Route
path="ChatProfile"
element={<ChatProfileTest />}
/>
/> <Route
path="ChatSupport"
element={<ChatSupportTest />}
/>
</Routes>
{/* <ChatWidgetTest/> */}
{/* <ChatWidgetTest /> */}
Expand Down
33 changes: 33 additions & 0 deletions packages/restapi/src/lib/space/acceptPromotionRequest.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { produce } from 'immer';

import type Space from './Space';
import { addSpeakers } from './addSpeakers';
import sendLiveSpaceData from './helpers/sendLiveSpaceData';

import { pCAIP10ToWallet } from '../helpers';
import {
SPACE_ACCEPT_REQUEST_TYPE,
SPACE_INVITE_ROLES,
} from '../payloads/constants';
import { CHAT } from '../types';

export interface IAcceptPromotionRequestType {
signalData: any;
Expand Down Expand Up @@ -35,6 +39,35 @@ export async function acceptPromotionRequest(
env: this.env,
});

const modifiedLiveSpaceData = produce(
this.spaceSpecificData.liveSpaceData,
(draft) => {
const listenerIndex =
this.spaceSpecificData.liveSpaceData.listeners.findIndex(
(listener) =>
pCAIP10ToWallet(listener.address) ===
pCAIP10ToWallet(promoteeAddress)
);

draft.listeners.splice(listenerIndex, 1);

draft.speakers.push({
address: pCAIP10ToWallet(promoteeAddress),
emojiReactions: null,
audio: null,
});
}
);

await sendLiveSpaceData({
spaceId: this.spaceSpecificData.spaceId,
pgpPrivateKey: this.pgpPrivateKey,
env: this.env,
signer: this.signer,
liveSpaceData: modifiedLiveSpaceData,
action: CHAT.META.SPACE.SPEAKER.PRVILEGE,
});

// accept the promotion request
// this.acceptRequest({
// signalData,
Expand Down
4 changes: 3 additions & 1 deletion packages/uiweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"livekit-client": "^1.13.3",
"moment": "^2.29.4",
"react-icons": "^4.10.1",
"react-easy-crop": "^4.1.4",
"react-image-file-resizer": "^0.4.7",
"react-toastify": "^9.1.3",
"react-twitter-embed": "^4.0.4",
"uuid": "^9.0.1"
Expand All @@ -32,6 +34,6 @@
"@pushprotocol/restapi": "^1.2.15",
"@pushprotocol/socket": "^0.5.0",
"react": ">=16.8.0",
"styled-components": "^5.3.5"
"styled-components": "^6.0.8"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import useToast from '../reusables/NewToast';
import {
getNewChatUser,
} from '../../../helpers';
import { ModalButtonProps, User } from '../exportedTypes';
import { IChatTheme, ModalButtonProps, User } from '../exportedTypes';
import { addWalletValidation } from '../helpers/helper';
import { device } from '../../../config';
import CloseIcon from '../../../icons/close.svg';
Expand All @@ -44,7 +44,6 @@ export const AddWalletContent = ({
handleMemberList,
groupMembers,
isLoading,
modalHeader,
}: AddWalletContentProps) => {
const theme = useContext(ThemeContext);

Expand Down Expand Up @@ -119,6 +118,7 @@ export const AddWalletContent = ({

return (
<Section
margin="auto"
width={isMobile ? '100%' : '410px'}
flexDirection="column"
padding={isMobile ? '0px auto' : '0px 10px'}
Expand Down Expand Up @@ -241,15 +241,15 @@ const MultipleMemberList = styled.div`
}
`;

const ModalConfirmButton = styled.button<ModalButtonProps>`
const ModalConfirmButton = styled.button<ModalButtonProps & { theme: IChatTheme } >`
margin: 60px 0 0 0;
width: 197px;
background: ${(props) =>
props.memberListCount ? props.theme.backgroundColor.buttonBackground : props.theme.backgroundColor.buttonDisableBackground};
props.memberListCount ? props.theme.backgroundColor!.buttonBackground : props.theme.backgroundColor!.buttonDisableBackground};
color: ${(props) =>
props.memberListCount ? props.theme.textColor.buttonText : props.theme.textColor.buttonDisableText};
props.memberListCount ? props.theme.textColor!.buttonText : props.theme.textColor!.buttonDisableText};
border: ${(props) =>
props.memberListCount ? 'none' : props.theme.border.modal};
props.memberListCount ? 'none' : props.theme.border!.modal};
min-width: 50%;
box-sizing: border-box;
cursor: pointer;
Expand Down
Loading

0 comments on commit f30db09

Please sign in to comment.