Skip to content

Commit

Permalink
added
Browse files Browse the repository at this point in the history
  • Loading branch information
mishramonalisha76 committed Mar 19, 2024
1 parent a59b4a2 commit 28a8538
Show file tree
Hide file tree
Showing 11 changed files with 676 additions and 575 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"@mui/icons-material": "^5.8.4",
"@mui/lab": "^5.0.0-alpha.72",
"@mui/material": "^5.5.0",
"@pushprotocol/restapi": "1.6.12-alpha.1",
"@pushprotocol/restapi": "1.7.2",
"@pushprotocol/socket": "0.5.3",
"@pushprotocol/uiweb": "1.3.1-alpha.8",
"@pushprotocol/uiweb": "1.2.7",
"@reduxjs/toolkit": "^1.7.1",
"@testing-library/dom": "^9.0.1",
"@testing-library/jest-dom": "^4.2.4",
Expand Down
108 changes: 58 additions & 50 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ import {
ISpaceFeedProps,
ISpaceInvitesProps,
ISpaceWidgetProps,
SpacesUI, SpacesUIProvider
SpacesUI,
SpacesUIProvider,
} from '@pushprotocol/uiweb';
import { useUpdateTheme } from '@web3-onboard/react';
import { darkTheme, lightTheme } from 'config/spaceTheme';
Expand Down Expand Up @@ -72,47 +73,47 @@ export interface IUseSpaceReturnValues {

// Extend the console
const extendConsole = () => {
"use strict";
'use strict';
try {
var disabledConsoles = {};
console.enable = function (level, enabled) {
if (window.console === "undefined" || !window.console || window.console === null) {
if (window.console === 'undefined' || !window.console || window.console === null) {
window.console = {};
}
if (window.console[level] === "undefined" || !window.console[level] || window.console[level] === null) {
window.console[level] = function () { };
if (window.console[level] === 'undefined' || !window.console[level] || window.console[level] === null) {
window.console[level] = function () {};
}
if (enabled) {
if (disabledConsoles[level]) {
window.console[level] = disabledConsoles[level];
}
} else {
disabledConsoles[level] = window.console[level];
window.console[level] = function () { };
window.console[level] = function () {};
}
};
} catch (e) {
console.error("Extended console() threw an error!");
console.error('Extended console() threw an error!');
console.debug(e);
}
}
};

// extend console
extendConsole();

// Disable console but not on localhost
if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1") {
if (appConfig?.appEnv === "prod") {
console.enable("debug", false);
console.enable("log", false);
console.enable("info", false);
// disable console.warn in prod
if (appConfig?.appEnv === "prod") {
console.enable("warn", false);
}
}
}
// // Disable console but not on localhost
// if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1") {
// if (appConfig?.appEnv === "prod") {
// console.enable("debug", false);
// console.enable("log", false);
// console.enable("info", false);

// // disable console.warn in prod
// if (appConfig?.appEnv === "prod") {
// console.enable("warn", false);
// }
// }
// }

// Provess App
export default function App() {
Expand Down Expand Up @@ -154,7 +155,6 @@ export default function App() {
dispatch(resetUserSlice());
}, [account]);


// console.log(isActive, chainId, account);
// handle logic to reconnect in response to certain events from the provider
const { allowedChain } = useInactiveListener();
Expand Down Expand Up @@ -186,9 +186,8 @@ export default function App() {
const SidebarCollapsable = localStorage.getItem('SidebarCollapsed');
if (SidebarCollapsable) {
const isSidebarCollapsed = JSON.parse(SidebarCollapsable);
setSidebarCollapsed(isSidebarCollapsed)
setSidebarCollapsed(isSidebarCollapsed);
}

}, []);

React.useEffect(() => {
Expand All @@ -202,17 +201,17 @@ export default function App() {

React.useEffect(() => {
window?.Olvy?.init({
organisation: "epns",
target: "#olvy-target",
type: "sidebar",
organisation: 'epns',
target: '#olvy-target',
type: 'sidebar',
view: {
showSearch: false,
compact: false,
showHeader: true, // only applies when widget type is embed. you cannot hide header for modal and sidebar widgets
showUnreadIndicator: true,
unreadIndicatorColor: "#cc1919",
unreadIndicatorPosition: "top-right"
}
unreadIndicatorColor: '#cc1919',
unreadIndicatorPosition: 'top-right',
},
});
return function cleanup() {
window?.Olvy?.teardown();
Expand Down Expand Up @@ -244,20 +243,22 @@ export default function App() {

const librarySigner = provider?.getSigner(account);

const spaceUI = useMemo(() => new SpacesUI({
account: account,
signer: librarySigner,
pgpPrivateKey: pgpPvtKey,
env: appConfig?.appEnv,
}), [account, librarySigner, pgpPvtKey, appConfig?.appEnv]);

const spaceUI = useMemo(
() =>
new SpacesUI({
account: account,
signer: librarySigner,
pgpPrivateKey: pgpPvtKey,
env: appConfig?.appEnv,
}),
[account, librarySigner, pgpPvtKey, appConfig?.appEnv]
);

// const { spaceUI } = useSpaceComponents();

const location = useLocation();
const isSnapPage = location?.pathname.includes('/snap');


return (
<ThemeProvider theme={darkMode ? themeDark : themeLight}>
{/* {(!isActive || !allowedChain) && (
Expand Down Expand Up @@ -308,18 +309,31 @@ export default function App() {
</HeaderContainer>

<ParentContainer
bg={darkMode ? themeDark.backgroundBG : !isActive ? themeLight.connectWalletBg : themeLight.backgroundBG}
bg={
darkMode ? themeDark.backgroundBG : !isActive ? themeLight.connectWalletBg : themeLight.backgroundBG
}
headerHeight={GLOBALS.CONSTANTS.HEADER_HEIGHT}
>
{!isSnapPage &&
<LeftBarContainer leftBarWidth={sidebarCollapsed ? GLOBALS.CONSTANTS.COLLAPSABLE_LEFT_BAR_WIDTH : GLOBALS.CONSTANTS.LEFT_BAR_WIDTH}>
{!isSnapPage && (
<LeftBarContainer
leftBarWidth={
sidebarCollapsed ? GLOBALS.CONSTANTS.COLLAPSABLE_LEFT_BAR_WIDTH : GLOBALS.CONSTANTS.LEFT_BAR_WIDTH
}
>
<Navigation />
</LeftBarContainer>
}
)}

<ContentContainer leftBarWidth={sidebarCollapsed ? GLOBALS.CONSTANTS.COLLAPSABLE_RIGHT_BAR_WIDTH : GLOBALS.CONSTANTS.LEFT_BAR_WIDTH}>
<ContentContainer
leftBarWidth={
sidebarCollapsed ? GLOBALS.CONSTANTS.COLLAPSABLE_RIGHT_BAR_WIDTH : GLOBALS.CONSTANTS.LEFT_BAR_WIDTH
}
>
{/* Shared among all pages, load universal things here */}
<SpacesUIProvider spaceUI={spaceUI} theme={darkMode ? darkTheme : lightTheme}>
<SpacesUIProvider
spaceUI={spaceUI}
theme={darkMode ? darkTheme : lightTheme}
>
<MasterInterfacePage />
<SpaceWidgetSection />
</SpacesUIProvider>
Expand All @@ -328,13 +342,7 @@ export default function App() {
</SpaceComponentContextProvider>
</SpaceContextProvider>
</NavigationContextProvider>

</>





</ThemeProvider>
);
}
Expand Down
9 changes: 9 additions & 0 deletions src/assets/chat/unlock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions src/components/chat/unlockProfile/UnlockProfile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, { useContext } from 'react';
import styled, { ThemeProvider, useTheme } from 'styled-components';

import { ButtonV2, ImageV2, ItemVV2, SpanV2 } from 'components/reusables/SharedStylingV2';
import { AppContext } from 'contexts/AppContext';
import UnlockLogo from '../../../assets/chat/unlock.svg';

const UnlockProfile = () => {
const theme = useTheme();
const { handleConnectWallet } = useContext(AppContext);
return (
<ThemeProvider theme={theme}>
<ModalContainer>
<ItemVV2
padding="24px"
gap="32px"
>
<ImageV2
width={'48px'}
height={'48px'}
src={UnlockLogo}
alt="Unlock Logo"
/>
<ItemVV2 gap="10px">
<SpanV2
fontSize="20px"
fontWeight="500"
color={theme.default.color}
>
Unlock Your Push Profile
</SpanV2>
<SpanV2
fontSize="15px"
fontWeight="400"
color={theme.default.secondaryColor}
>
You need to decrypt your Push Profile to proceed. Please sign using your wallet to continue.
</SpanV2>
</ItemVV2>
<ButtonV2
padding="14px 20px"
background="#D53A94"
color="#fff"
borderRadius="16px"
width="100%"
onClick={async () => await handleConnectWallet()}
>
Unlock Profile
</ButtonV2>
</ItemVV2>
</ModalContainer>
</ThemeProvider>
);
};

const ModalContainer = styled.div`
display: flex;
flex: 1;
flex-direction: column;
border-radius: 24px;
width: 358px;
min-height: -webkit-fill-available;
background: ${(props) => props.theme.default.bg};
align-items: flex-start;
overflow: hidden;
`;

export default UnlockProfile;
Loading

0 comments on commit 28a8538

Please sign in to comment.