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 14b169e64..387f902bb 100644
--- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx
+++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx
@@ -1,8 +1,8 @@
import styled from 'styled-components';
import { Section } from '../components/StyledComponents';
-import { CreateGroupModal, MODAL_BACKGROUND_TYPE } 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 = [
@@ -13,14 +13,17 @@ const ChatViewComponentTest = () => {
return (
Chat UI Test page
- {/* {console.log('in close')}} modalBackground={MODAL_BACKGROUND_TYPE.OVERLAY}/> */}
- {console.log('in close')}} modalBackground={MODAL_BACKGROUND_TYPE.OVERLAY} modalPositionType={MODAL_POSITION_TYPE.RELATIVE}/>
+
+ 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}
/>
@@ -30,7 +33,8 @@ const ChatViewComponentTest = () => {
export default ChatViewComponentTest;
const ChatViewComponentCard = styled(Section)`
- height: 60vh;
+ height: 80vh;
+ position:relative;
`;
//c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e
//4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68
diff --git a/packages/examples/sdk-frontend-react/src/app/app.tsx b/packages/examples/sdk-frontend-react/src/app/app.tsx
index e77d430d0..e118af2ca 100644
--- a/packages/examples/sdk-frontend-react/src/app/app.tsx
+++ b/packages/examples/sdk-frontend-react/src/app/app.tsx
@@ -314,7 +314,7 @@ export function App() {
-
+
setOptions(true)}>
+
- setOptions(true)}>
-
-
- {options && (
-
-
-
-
- Group Info
-
-
- )}
- {modal && (
-
- )}
-
+ {options && (
+
+
+
+ Group Info
+
+
+ )}
+ {modal && (
+
+ )}
+
);
} else {
return null;
@@ -113,6 +113,7 @@ export const ChatProfile: React.FC = ({
chatId,
style,
groupInfoModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,
+ groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL,
}) => {
const theme = useContext(ThemeContext);
const { account, env } = useChatData();
@@ -127,6 +128,16 @@ export const ChatProfile: React.FC = ({
const isMobile = useMediaQuery(device.tablet);
const l1ChainId = allowedNetworks[env].includes(1) ? 1 : 5;
const provider = new ethers.providers.InfuraProvider(l1ChainId, InfuraAPIKey);
+ const DropdownRef = useRef(null);
+ const [modal, setModal] = useState(false);
+
+ useClickAway(DropdownRef, () => {
+ setOptions(false);
+ });
+
+ const ShowModal = () => {
+ setModal(true);
+ };
const fetchProfileData = async () => {
if (isValidETHAddress(chatId)) {
@@ -176,19 +187,18 @@ export const ChatProfile: React.FC = ({
if (chatId && style === 'Info') {
return (
-
+
{(groupInfo?.rules?.chat?.conditions ||
groupInfo?.rules?.entry?.conditions) && }
@@ -201,7 +211,35 @@ export const ChatProfile: React.FC = ({
/>
)}
- setOptions(true)}>
+
+
+ {options && (
+
+
+
+
+ Group Info
+
+
+ )}
+
+ )}
+
+ {/* = ({
setGroupInfo={setGroupInfo}
theme={theme}
groupInfoModalBackground={groupInfoModalBackground}
- />
+ /> */}
+ {modal && (
+
+ )}
{/* {!isGroup &&
diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx
index af4db3ba1..855e1e70b 100644
--- a/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx
+++ b/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx
@@ -35,7 +35,7 @@ import { copyToClipboard, shortenText } from '../../../helpers';
import ConditionsComponent from '../CreateGroup/ConditionsComponent';
import { ACCESS_TYPE_TITLE, OPERATOR_OPTIONS_INFO } from '../constants';
import { getRuleInfo } from '../helpers/getRulesToCondtionArray';
-import { MODAL_BACKGROUND_TYPE, ModalBackgroundType } from '../exportedTypes';
+import { MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE, ModalBackgroundType, ModalPositionType } from '../exportedTypes';
import { TokenGatedSvg } from '../../../icons/TokenGatedSvg';
const UPDATE_KEYS = {
@@ -315,6 +315,7 @@ type GroupInfoModalProps = {
groupInfo: IGroup;
setGroupInfo: React.Dispatch>;
groupInfoModalBackground?: ModalBackgroundType;
+ groupInfoModalPositionType?: ModalPositionType;
};
export const GROUPINFO_STEPS = {
@@ -578,6 +579,7 @@ export const GroupInfoModal = ({
groupInfo,
setGroupInfo,
groupInfoModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,
+ groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL,
}: GroupInfoModalProps) => {
const [activeComponent, setActiveComponent] = useState(
GROUPINFO_STEPS.GROUP_INFO
@@ -738,6 +740,7 @@ export const GroupInfoModal = ({
{!showAddMoreWalletModal && (
= (
isConnected = true,
autoConnect = false,
onVerificationFail,
- groupInfoModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY
+ groupInfoModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,
+ groupInfoModalPositionType = MODAL_POSITION_TYPE.GLOBAL,
+ verificationFailModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,
+ verificationFailModalPosition = MODAL_POSITION_TYPE.GLOBAL,
} = options || {};
const { env, signer, account, pgpPrivateKey } = useChatData();
@@ -59,7 +62,7 @@ export const ChatViewComponent: React.FC = (
padding="13px"
theme={theme}
>
- {chatProfile && }
+ {chatProfile && }
)}
{(messageInput && (!!signer || (!!account && !!pgpPrivateKey) || isConnected )) && (
-
+
= (
emoji={emoji}
gif={gif}
isConnected={isConnected}
+ verificationFailModalBackground={verificationFailModalBackground}
+ verificationFailModalPosition={verificationFailModalPosition}
autoConnect = {autoConnect}
/>
diff --git a/packages/uiweb/src/lib/components/chat/ChatViewComponent/index.ts b/packages/uiweb/src/lib/components/chat/ChatViewComponent/index.ts
index 25a649344..7d3f2796f 100644
--- a/packages/uiweb/src/lib/components/chat/ChatViewComponent/index.ts
+++ b/packages/uiweb/src/lib/components/chat/ChatViewComponent/index.ts
@@ -1 +1,2 @@
-export {ChatViewComponent} from './ChatViewComponent';
\ No newline at end of file
+export {ChatViewComponent} from './ChatViewComponent';
+export {ChatViewComponent as ChatView} from './ChatViewComponent';
\ No newline at end of file
diff --git a/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx b/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx
index d10d3c27e..05e415351 100644
--- a/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx
+++ b/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx
@@ -37,9 +37,6 @@ export const ConnectButtonSub = ({autoConnect = false}) => {
setSigner,
} = useChatData();
const theme = useContext(ThemeContext);
- const {fetchChatProfile} = useGetChatProfile();
- const {creteChatProfile} = useCreateChatProfile();
- const {decryptPGPKey} = useDecryptPGPKey();
const setUserData = () => {
@@ -54,7 +51,6 @@ export const ConnectButtonSub = ({autoConnect = false}) => {
} else if (!wallet) {
setAccount('')
setSigner(undefined)
- setPgpPrivateKey(null)
}
}
useEffect(() => {
@@ -63,37 +59,7 @@ export const ConnectButtonSub = ({autoConnect = false}) => {
setUserData()
}, [wallet])
- useEffect(() => {
- (async () => {
- if (account && signer) {
- if (!pgpPrivateKey) await handleUserCreation();
- }
- })();
- }, [account, signer]);
-
- const handleUserCreation = async () => {
- if (!account && !env) return;
- try {
- let user = await fetchChatProfile({ profileId: account! ,env});
- if (!user) {
- if (!signer) return;
- user = await creteChatProfile({ signer: signer ,env});
- }
- if (user?.encryptedPrivateKey && !pgpPrivateKey) {
- const decryptPgpKey = await decryptPGPKey({
- encryptedPrivateKey: user.encryptedPrivateKey,
- account: account!,
- signer: signer,
- env: env,
- });
- if(decryptPgpKey)
- setPgpPrivateKey(decryptPgpKey);
- }
- } catch (e: any) {
- console.log(e);
- }
- };
return !signer ? (
diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx
index 7174567f8..354e0dfce 100644
--- a/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx
+++ b/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx
@@ -22,6 +22,7 @@ import OptionButtons from '../reusables/OptionButtons';
import EthereumSvg from '../../../icons/ethereum.svg';
import PolygonSvg from '../../../icons/polygon.svg';
+import ArbitrumSvg from '../../../icons/arbitrum.svg';
import BSCSvg from '../../../icons/bsc.svg';
import OptimismSvg from '../../../icons/optimisim.svg';
import { BLOCKCHAIN_NETWORK, device } from '../../../config';
@@ -233,6 +234,13 @@ const AddCriteria = ({
icon: OptimismSvg,
function: () => setSelectedChainValue(3),
},
+ {
+ id: 4,
+ value: BLOCKCHAIN_NETWORK[env].ARBITRUM,
+ title: 'Arbitrim',
+ icon: ArbitrumSvg,
+ function: () => setSelectedChainValue(4),
+ },
];
const onQuantityChange = (e: any) => {
diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx
index 2a180aa5f..6b960d7ae 100644
--- a/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx
+++ b/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx
@@ -8,12 +8,18 @@ import { ThemeContext } from '../theme/ThemeProvider';
import Dropdown, { DropdownValueType } from '../reusables/DropDown';
import { ConditionArray, ConditionData, IChatTheme } from '../exportedTypes';
import { useClickAway, useTokenSymbolLoader } from '../../../hooks';
-import { CATEGORY, CRITERIA_TYPE, CriteriaType, PushData, TOKEN_NFT_COMPARISION, TokenNftComparision } from '../types';
+import {
+ CATEGORY,
+ CRITERIA_TYPE,
+ CriteriaType,
+ TOKEN_NFT_COMPARISION,
+ TokenNftComparision,
+} from '../types';
import EditSvg from '../../../icons/EditSvg.svg';
import RemoveSvg from '../../../icons/RemoveSvg.svg';
import { shortenText } from '../../../helpers';
-import { GUILD_COMPARISON_OPTIONS } from '../constants';
+import { GUILD_COMPARISON_OPTIONS, NETWORK_ICON_DETAILS } from '../constants';
export type CriteraValueType = {
invertedIcon?: any;
@@ -54,8 +60,12 @@ const MoreOptionsContainer = ({
useClickAway(dropdownRef, () => setSelectedIndex(null));
return (
- handleMoreOptionsClick(row, col)} position='static'>
-
+ handleMoreOptionsClick(row, col)} position="static">
+
{selectedIndex?.length && selectedIndex[0] === row && (
{
return false;
};
- const getGuildRole = () =>{
- if(!criteria?.data?.['comparison'])
- {
+ const getGuildRole = () => {
+ if (!criteria?.data?.['comparison']) {
return 'SPECIFIC';
}
- return (GUILD_COMPARISON_OPTIONS.find(option => option.value === criteria?.data?.['comparison']))?.heading;
-
- }
-
- const [tokenSymbol,] = useTokenSymbolLoader(criteria)
+ return GUILD_COMPARISON_OPTIONS.find(
+ (option) => option.value === criteria?.data?.['comparison']
+ )?.heading;
+ };
+ const [tokenSymbol] = useTokenSymbolLoader(criteria);
return (
-
+
{
{CRITERIA_TYPE[criteria.category as CriteriaType]}
{checkIfNftToken() && (
-
-
- {getTokenNftComparisionLabel()}{' '}
+
+
+
+ {getTokenNftComparisionLabel()}{' '}
+
+ {criteria?.data?.['amount']} {tokenSymbol}
- {/* need to fetch token symbol */}
- {criteria?.data?.['amount']} {tokenSymbol}
-
+
+ {
+ NETWORK_ICON_DETAILS[
+ criteria?.data?.['contract'].split(
+ ':'
+ )[1] as keyof typeof NETWORK_ICON_DETAILS
+ ].icon
+ }
+
+
)}
{criteria.category === CATEGORY.INVITE && (
@@ -128,17 +151,17 @@ const CriteriaSection = ({ criteria }: { criteria: ConditionData }) => {
fontSize="14px"
color={theme.textColor?.modalSubHeadingText}
>
- {shortenText(criteria.data?.['url'],30)}
+ {shortenText(criteria.data?.['url'], 30)}
)}
- {criteria.category === CATEGORY.ROLES && (
-
- {criteria?.data?.['id']} {' '}
-
- with {' '}
+ {criteria.category === CATEGORY.ROLES && (
+
+ {criteria?.data?.['id']}{' '}
+
+ with{' '}
+
+ {getGuildRole()} role
- {getGuildRole()} role
-
)}
);
@@ -198,7 +221,7 @@ const ConditionsComponent = ({
{conditionData &&
conditionData.slice(1).map((criteria, row) => (
-
+
{criteria.length <= 2 &&
criteria.length >= 1 &&
criteria.map((singleCriteria, col) => (
@@ -259,8 +282,7 @@ const ConditionsComponent = ({
>
))}
-
+
{criteria.map((singleCriteria) => (
<>
{criteria.length > 2 &&
@@ -326,3 +348,15 @@ const OperatorSpan = styled(Span)<{ theme: IChatTheme }>`
const CriteriaGroup = styled(Section)<{ theme: IChatTheme }>`
border: ${(props) => props.theme.border?.modalInnerComponents};
`;
+
+const ChainIconSVG = styled(Section)`
+ width: 20px;
+ height: 20px;
+
+ svg,
+ svg image,
+ img {
+ width: 100%;
+ height: 100%;
+ }
+`;
diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx
index 023358f93..5c7252688 100644
--- a/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx
+++ b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx
@@ -13,7 +13,7 @@ import { Section, Span } from '../../reusables';
import { Button } from '../reusables';
import { CreateGroupType } from './CreateGroupType';
import useToast from '../reusables/NewToast';
-import { CreateGroupModalProps, IChatTheme, MODAL_BACKGROUND_TYPE } from '../exportedTypes';
+import { CreateGroupModalProps, IChatTheme, MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE } from '../exportedTypes';
import useMediaQuery from '../../../hooks/useMediaQuery';
import { DefineCondtion } from './DefineCondition';
import AddCriteria from './AddCriteria';
@@ -47,7 +47,8 @@ interface GroupInputDetailsType {
export const CreateGroupModal: React.FC = ({
onClose,
- modalBackground = MODAL_BACKGROUND_TYPE.OVERLAY
+ modalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,
+ modalPositionType = MODAL_POSITION_TYPE.GLOBAL
}) => {
const [activeComponent, setActiveComponent] = useState(
// replace it with info one
@@ -135,7 +136,7 @@ export const CreateGroupModal: React.FC = ({
};
return (
-
+
{renderComponent()}
);
diff --git a/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx b/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx
index 285ca16c7..7cde4ab9d 100644
--- a/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx
+++ b/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx
@@ -39,7 +39,7 @@ import {
} from '../../../hooks';
import type { FileMessageContent, IGroup } from '../../../types';
-import { GIFType, IChatTheme, MessageInputProps } from '../exportedTypes';
+import { GIFType, IChatTheme, MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE, MessageInputProps } from '../exportedTypes';
import { PUBLIC_GOOGLE_TOKEN, device } from '../../../config';
import { checkIfAccessVerifiedGroup, checkIfMember } from '../helpers';
import { InfoContainer } from '../reusables';
@@ -84,6 +84,8 @@ export const MessageInput: React.FC = ({
file = true,
isConnected = true,
autoConnect = false,
+ verificationFailModalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,
+ verificationFailModalPosition = MODAL_POSITION_TYPE.GLOBAL,
onVerificationFail,
}) => {
const [typedMessage, setTypedMessage] = useState('');
@@ -375,23 +377,19 @@ export const MessageInput: React.FC = ({
}
};
- return !Object.keys(chatFeed || {}).length ? (
- <>
- {!pgpPrivateKey && (isConnected || !!signer) && (
-
-
-
- )}
- >
+ return !(pgpPrivateKey && account) && isConnected ? (
+
+
+
) : !checkIfIntent({ chat: chatFeed, account: account! }) &&
Object.keys(chatFeed || {}).length ? (
= ({
)}
{!!pgpPrivateKey && !verificationSuccessfull && (
-
+
= ({
groupInfo={chatFeed?.groupInformation}
subheader="Please make sure the following conditions
are met to pariticpate and send messages."
- alert={true}
+ alert={true}
/>
{
@@ -496,7 +494,10 @@ export const MessageInput: React.FC = ({
>
Cancel
-
+
{/* */}
diff --git a/packages/uiweb/src/lib/components/chat/constants/chainDetails.tsx b/packages/uiweb/src/lib/components/chat/constants/chainDetails.tsx
new file mode 100644
index 000000000..fb9d4c21a
--- /dev/null
+++ b/packages/uiweb/src/lib/components/chat/constants/chainDetails.tsx
@@ -0,0 +1,70 @@
+
+import Tooltip from "../../tooltip";
+
+import { EthereumSvg } from '../../../icons/EthereumSvg';
+import { PolygonSvg } from "../../../icons/PolygonSvg";
+import { BSCSvg } from "../../../icons/BSCSvg";
+import { OptimismSvg } from "../../../icons/OptimismSvg";
+import { PolygonzkevmSvg } from "../../../icons/PolygonzkevmSvg";
+import { ArbitrumSvg } from "../../../icons/ArbitrumSvg"
+import React from "react";
+
+const createSVGIcon = (element:any, chainName: string) => {
+ return (
+
+ {element}
+
+ );
+};
+
+export const NETWORK_ICON_DETAILS = {
+ 5: {
+ label: 'ETHEREUM GOERLI',
+ icon: createSVGIcon(, 'Ethereum Goerli'),
+ },
+ 1: {
+ label: 'ETHEREUM MAINNET',
+ icon: createSVGIcon(, 'Ethereum Mainnet'),
+ },
+ 80001: {
+ label: 'POLYGON MUMBAI',
+ icon: createSVGIcon(, 'Polygon Mumbai'),
+ },
+ 137: {
+ label: 'POLYGON MAINNET',
+ icon: createSVGIcon(, 'Polygon Mainnet'),
+ },
+ 97: {
+ label: 'BSC TESTNET',
+ icon: createSVGIcon(, 'Bsc Testnet'),
+ },
+ 56: {
+ label: 'BSC MAINNET',
+ icon: createSVGIcon(, 'Bsc Mainnet'),
+ },
+ 420: {
+ label: 'OPTIMISM TESTNET',
+ icon: createSVGIcon(, 'Optimism Testnet'),
+ },
+ 10: {
+ label: 'OPTIMISM MAINNET',
+ icon: createSVGIcon(, 'Optimism Mainnet'),
+ },
+ 1442: {
+ label: 'POLYGON ZK EVM TESTNET',
+ icon: createSVGIcon(, 'Polygon ZK EVM Testnet'),
+ },
+ 1101: {
+ label: 'POLYGON ZK EVM MAINNET',
+ icon: createSVGIcon(, 'Polygon ZK EVM Mainnet'),
+ },
+
+ 42161: {
+ label: 'ARBITRUMONE MAINNET',
+ icon: createSVGIcon(, 'Arbitrum Mainnet'),
+ },
+ 421613: {
+ label: 'ARBITRUM TESTNET',
+ icon: createSVGIcon(, 'Arbitrum Testnet'),
+ },
+};
diff --git a/packages/uiweb/src/lib/components/chat/constants/index.ts b/packages/uiweb/src/lib/components/chat/constants/index.ts
index 4224f93ab..085844f58 100644
--- a/packages/uiweb/src/lib/components/chat/constants/index.ts
+++ b/packages/uiweb/src/lib/components/chat/constants/index.ts
@@ -53,4 +53,6 @@ export const ACCESS_TYPE_TITLE = {
heading: 'Conditions to Chat',
subHeading: 'Add a condition to join or leave it open for everyone',
},
-};
\ No newline at end of file
+};
+
+export * from './chainDetails';
\ No newline at end of file
diff --git a/packages/uiweb/src/lib/components/chat/exportedTypes.ts b/packages/uiweb/src/lib/components/chat/exportedTypes.ts
index 6619e4ad4..dd4e7f7dc 100644
--- a/packages/uiweb/src/lib/components/chat/exportedTypes.ts
+++ b/packages/uiweb/src/lib/components/chat/exportedTypes.ts
@@ -21,6 +21,9 @@ export interface IChatViewComponentProps {
isConnected?: boolean;
autoConnect?:boolean;
groupInfoModalBackground?: ModalBackgroundType;
+ groupInfoModalPositionType?: ModalPositionType;
+ verificationFailModalBackground?: ModalBackgroundType;
+ verificationFailModalPosition?: ModalPositionType;
onVerificationFail?: () => void;
}
@@ -28,6 +31,7 @@ export interface IChatProfile {
chatId: string;
style: "Info" | "Preview";
groupInfoModalBackground?: ModalBackgroundType;
+ groupInfoModalPositionType?: ModalPositionType;
}
export interface TwitterFeedReturnType {
@@ -60,6 +64,8 @@ export interface MessageInputProps {
file?: boolean;
isConnected?: boolean;
autoConnect?:boolean;
+ verificationFailModalBackground?: ModalBackgroundType;
+ verificationFailModalPosition?: ModalPositionType;
onVerificationFail?: () => void;
}
@@ -123,9 +129,17 @@ export const MODAL_BACKGROUND_TYPE = {
} as const;
export type ModalBackgroundType = keyof typeof MODAL_BACKGROUND_TYPE;
+
+ export const MODAL_POSITION_TYPE = {
+ RELATIVE:'RELATIVE',
+ GLOBAL: 'GLOBAL',
+ } as const;
+
+ export type ModalPositionType = keyof typeof MODAL_POSITION_TYPE;
export interface CreateGroupModalProps {
onClose: ()=>void;
modalBackground?: ModalBackgroundType;
+ modalPositionType?: ModalPositionType;
};
diff --git a/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx b/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx
index c34d738ca..06cfecce2 100644
--- a/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx
+++ b/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx
@@ -13,7 +13,7 @@ import { IChatTheme } from '../theme';
import { Section, Span, Image } from '../../reusables';
import { BackIcon } from '../../../icons/Back';
import CloseIcon from '../../../icons/close.svg';
-import { MODAL_BACKGROUND_TYPE, ModalBackgroundType } from '../exportedTypes';
+import { MODAL_BACKGROUND_TYPE, MODAL_POSITION_TYPE, ModalBackgroundType, ModalPositionType } from '../exportedTypes';
import { device } from '../../../config';
interface IModalProps {
@@ -22,6 +22,7 @@ interface IModalProps {
children: any;
theme?: IChatTheme;
modalBackground?: ModalBackgroundType;
+ modalPositionType?: ModalPositionType;
}
interface IModalHeader {
@@ -51,10 +52,10 @@ const ClickawayCloseModal = ({
);
};
-export const Modal = ({ clickawayClose, children, width,modalBackground = MODAL_BACKGROUND_TYPE.OVERLAY }: IModalProps) => {
+export const Modal = ({ clickawayClose, children, width,modalBackground = MODAL_BACKGROUND_TYPE.OVERLAY,modalPositionType = MODAL_POSITION_TYPE.GLOBAL }: IModalProps) => {
const theme = useContext(ThemeContext);
return (
-
+
{clickawayClose ? (
{children}
@@ -102,11 +103,11 @@ export const ModalHeader = ({
};
/* styling */
-const ModalOverlay = styled.div`
- position: fixed;
+const ModalOverlay = styled.div`
+ position:${(props) => props.modalPositionType === MODAL_POSITION_TYPE.GLOBAL? 'fixed':'absolute'};
top: 0;
left: 0;
- right: 0;
+ right: 0;
bottom: 0;
width: 100%;
height: 100%;
diff --git a/packages/uiweb/src/lib/config/constants.ts b/packages/uiweb/src/lib/config/constants.ts
index 6e92322db..b30e87737 100644
--- a/packages/uiweb/src/lib/config/constants.ts
+++ b/packages/uiweb/src/lib/config/constants.ts
@@ -42,12 +42,15 @@ export const CoreContractChainId = {
local: 5,
};
+
+
const TESTNET_NETWORK = {
ETHEREUM: 'eip155:5',
POLYGON: 'eip155:80001',
BSC: 'eip155:97',
OPTIMISM: 'eip155:420',
POLYGON_ZK_EVM: 'eip155:1442',
+ ARBITRUM:'eip155:421613'
};
const MAINET_NETWORK = {
ETHEREUM: 'eip155:1',
@@ -55,6 +58,7 @@ const MAINET_NETWORK = {
BSC: 'eip155:56',
OPTIMISM: 'eip155:10',
POLYGON_ZK_EVM: 'eip155:1101',
+ ARBITRUM:'eip155:42161'
};
export const BLOCKCHAIN_NETWORK = {
diff --git a/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx b/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx
index b5aa3d246..a6f969222 100644
--- a/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx
+++ b/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx
@@ -9,6 +9,8 @@ import useGetChatProfile from '../hooks/useGetChatProfile';
import { IUser, SignerType } from '@pushprotocol/restapi';
import { IChatTheme, lightChatTheme } from '../components/chat/theme';
import { getAddressFromSigner, pCAIP10ToWallet } from '../helpers';
+import useCreateChatProfile from '../hooks/useCreateChatProfile';
+import useDecryptPGPKey from '../hooks/useDecryptPGPKey';
export interface IChatUIProviderProps {
@@ -40,6 +42,8 @@ export const ChatUIProvider = ({
const [isPushChatSocketConnected, setIsPushChatSocketConnected] =
useState(false);
+ const {createChatProfile} = useCreateChatProfile();
+ const {decryptPGPKey} = useDecryptPGPKey();
useEffect(() => {
(async()=>{
@@ -59,9 +63,40 @@ export const ChatUIProvider = ({
setPgpPrivateKeyVal(pgpPrivateKey);
})()
- }, [env,account,pgpPrivateKey,signer])
+ }, [env,account,signer,pgpPrivateKey])
+ useEffect(() => {
+ (async () => {
+ if (accountVal && signerVal) {
+ if (!pgpPrivateKeyVal) await handleUserCreation();
+ }
+ })();
+ }, [accountVal, signerVal]);
+
+
+ const handleUserCreation = async () => {
+ if (!accountVal && !envVal) return;
+ try {
+ let user = await fetchChatProfile({ profileId: accountVal! ,env:envVal});
+ if (!user) {
+ if (!signerVal) return;
+ user = await createChatProfile({ signer: signerVal ,env:envVal});
+ }
+ if (user?.encryptedPrivateKey && !pgpPrivateKey) {
+ const decryptedPgpKey = await decryptPGPKey({
+ encryptedPrivateKey: user.encryptedPrivateKey,
+ account: accountVal!,
+ signer: signerVal,
+ env: envVal,
+ });
+ if(decryptedPgpKey)
+ setPgpPrivateKeyVal(decryptedPgpKey);
+ }
+ } catch (e: any) {
+ console.log(e);
+ }
+ };
diff --git a/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts b/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts
index fea956c0e..15aa3d4fc 100644
--- a/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts
+++ b/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts
@@ -8,7 +8,7 @@ export interface CreateChatProfileParams {
}
const useCreateChatProfile = () => {
- const creteChatProfile = useCallback(
+ const createChatProfile = useCallback(
async ({
signer,
env
@@ -27,7 +27,7 @@ const useCreateChatProfile = () => {
[]
);
- return { creteChatProfile };
+ return { createChatProfile };
};
export default useCreateChatProfile;
diff --git a/packages/uiweb/src/lib/icons/arbitrum.svg b/packages/uiweb/src/lib/icons/arbitrum.svg
new file mode 100644
index 000000000..0fa71d8eb
--- /dev/null
+++ b/packages/uiweb/src/lib/icons/arbitrum.svg
@@ -0,0 +1,16 @@
+
\ No newline at end of file