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

Email App Revamp #31

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/core-connection/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6822,7 +6822,7 @@ __metadata:

"shared-components@file:../../packages/shared-components::locator=core-connection%40workspace%3A.":
version: 0.1.0
resolution: "shared-components@file:../../packages/shared-components#../../packages/shared-components::hash=498aac&locator=core-connection%40workspace%3A."
resolution: "shared-components@file:../../packages/shared-components#../../packages/shared-components::hash=799d4e&locator=core-connection%40workspace%3A."
dependencies:
"@emotion/react": "npm:^11.13.0"
"@radix-ui/react-dialog": "npm:^1.1.1"
Expand All @@ -6843,7 +6843,7 @@ __metadata:
peerDependencies:
react: ^18.3.1
react-dom: ^18.3.1
checksum: 10/f9032d46c349f59ae84062f96110e8c1df66b69f8aabd583eb25aeb826c9bc383f017a32f4fd9e016f3abcfbab507a86e09b80ec0bfa9703516305eea5e8247e
checksum: 10/b85739b98051e191bf7118f0007d9b9aef1f6eb01d6ba62a9fe627945b724416ea96fbf36ceaea9953092ba5d1172b92ea1dfd6841f5071e2a6a4f8d5538e1d1
languageName: node
linkType: hard

Expand Down
3 changes: 2 additions & 1 deletion examples/email/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview",
"deploy:vercel": "vercel build --prod && vercel deploy --prebuilt --prod",
Expand All @@ -16,6 +16,7 @@
"@privy-io/wagmi": "^0.2.12",
"@pushprotocol/node-core": "^0.0.29",
"@pushprotocol/push-chain": "^0.1.7",
"@pushprotocol/pushchain-ui-kit": "^1.0.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-scroll-area": "^1.2.0",
Expand Down
Binary file added examples/email/public/DummyDiscord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/email/public/DummyEmail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/email/public/DummyHeader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/email/public/EmailBanner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 31 additions & 18 deletions examples/email/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
import { usePrivy } from '@privy-io/react-auth';
import { getBlocksCSSVariables, themeConfig } from 'shared-components';
import { createGlobalStyle, ThemeProvider } from 'styled-components';
import AppRoutes from './routes';
import { BrowserRouter } from 'react-router-dom';
import {
ENV,
PushWalletIFrame,
PushWalletProvider,
} from '@pushprotocol/pushchain-ui-kit';
import { AppProvider } from './providers/app-provider.tsx';

import { useAppContext } from './context/app-context';
import LoggedInView from './components/logged-in-view';
import Login from './components/login';
const GlobalStyle = createGlobalStyle`
:root{
/* Font Family */
--font-family: 'FK Grotesk Neu', Helvetica, sans-serif;

/* New blocks theme css variables*/

${(props) => getBlocksCSSVariables(props.theme.blocksTheme)}
}
`;

function App() {
const { ready, authenticated } = usePrivy();
const { pushAccount } = useAppContext();
return (
<>
{ready ? (
<main className="h-screen w-screen">
{authenticated || pushAccount ? <LoggedInView /> : <Login />}
</main>
) : (
<div className="flex flex-col gap-4 items-center justify-center h-screen w-full">
<div className="w-8 h-8 animate-ping bg-primary rounded-full"></div>
<p>Loading</p>
</div>
)}
</>
<ThemeProvider theme={themeConfig.light}>
<GlobalStyle />
<PushWalletProvider env={ENV.PROD}>
<AppProvider>
<BrowserRouter>
<PushWalletIFrame />
<AppRoutes />
</BrowserRouter>
</AppProvider>
</PushWalletProvider>
</ThemeProvider>
);
}

Expand Down
45 changes: 45 additions & 0 deletions examples/email/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { FC } from 'react';
import { Box, PushLogo, Text } from 'shared-components';
import { css } from 'styled-components';
Copy link
Contributor

Choose a reason for hiding this comment

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

@riyanshu-patro you could uninstall the styled components from here and use the one from shared-components.

import {
TogglePushWalletButton,
usePushWalletContext,
} from '@pushprotocol/pushchain-ui-kit';

const Header: FC = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@riyanshu-patro The header component should be a fixed component and should not scroll with the viewport when user tries to scroll down.

const { account } = usePushWalletContext();

return (
<Box
width="100%"
display="flex"
padding="spacing-xs spacing-xs"
alignItems="center"
justifyContent="space-between"
css={css`
border-bottom: 1px solid var(--stroke-secondary);
`}
>
<Box display="flex" alignItems="center" gap="spacing-xs">
<Box display="flex" alignItems="center" gap="spacing-xxs">
<PushLogo height={40} />
<Text variant="h2-bold">Push</Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2024-12-23 at 4 53 48 PM

Maybe remove the Push text for now in the mobile view,=,

</Box>
<Text
variant="h4-semibold"
css={css`
display: block;
@media (max-width: 768px) {
display: none;
}
`}
Copy link
Contributor

Choose a reason for hiding this comment

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

not the correct way. Wrap text inside the box component and use the box display property to implement it.

>
Email
</Text>
</Box>
<Box>{account && <TogglePushWalletButton account={account} />}</Box>
</Box>
);
};

export { Header };
48 changes: 0 additions & 48 deletions examples/email/src/components/connected-wallet-info.tsx

This file was deleted.

144 changes: 144 additions & 0 deletions examples/email/src/components/dummy-email.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { Back, Box, PushLogo, Text } from 'shared-components';
import { Card } from './ui/card';
import { css } from 'styled-components';
Copy link
Contributor

Choose a reason for hiding this comment

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

  • File names should be Capitalised camel case.
  • Folder structure also needs to be updated.
    Please refer to the core-connection repo for that.


interface EmailViewerProps {
handleBack: () => void;
}

const DummyEmail: React.FC<EmailViewerProps> = ({ handleBack }) => {
return (
<Card className="w-full h-fit flex-1 py-6 px-4 md:px-8 gap-6">
<Box cursor="pointer" onClick={handleBack}>
<Back size={24} />
</Box>
<Box display="flex" justifyContent="space-between" alignSelf="stretch">
<Box
display="flex"
flexDirection="column"
gap="spacing-xs"
width="100%"
>
<Box
display="flex"
justifyContent="space-between"
alignItems="center"
width="100%"
css={css`
padding-left: 48px;
@media (max-width: 768px) {
padding-left: 0px;
}
`}
>
<Text variant="h4-semibold">GM! Web3 Email</Text>
<Box>
<Text variant="bes-semibold">now</Text>
</Box>
</Box>
<Box display="flex" gap="spacing-xxs">
<PushLogo height={36} width={40} />
<Box display="flex" flexDirection="column" gap="spacing-xxxs">
<Text variant="bes-semibold">Push Fam</Text>
<Text variant="bes-semibold" color="text-tertiary">
To:
</Text>
</Box>
</Box>
</Box>
</Box>
<Box
display="flex"
flexDirection="column"
maxWidth="600px"
alignSelf="center"
gap="spacing-md"
css={css`
padding: 0px 48px;
@media (max-width: 768px) {
padding: 0px;
}
`}
>
<img src="/DummyHeader.png" />
<Text variant="bs-regular">
Hello Degen, <br />
Welcome to the future of email, where web3 meets seamless unified
across all chains! With this app, you can easily connect with your
fellow Solana, Ethereum, Polygon, Optimism and other blockchain users.
</Text>
<Box
display="flex"
gap="spacing-lg"
alignItems="flex-start"
css={css`
flex-direction: row;
flex: 1;
@media (max-width: 768px) {
flex-direction: column;
}
`}
>
<Box
display="flex"
flexDirection="column"
gap="spacing-xxs"
alignItems="flex-start"
css={css`
flex: 1;
@media (max-width: 768px) {
flex: none;
}
`}
>
<img src="/DummyEmail.png" height={75} width={75} />
<Box>
<Text variant="bm-bold">About Push Email</Text>
<Text variant="bs-regular">
Push Email is a sample Devnet app designed to showcase the power
of a shared state email app.
</Text>
<br />
<Text variant="bs-semibold">
Please note that in this version, emails sent and received are
not encrypted.
</Text>
</Box>
</Box>
<Box
display="flex"
flexDirection="column"
gap="spacing-xxs"
alignItems="flex-start"
css={css`
flex: 1;
@media (max-width: 768px) {
flex: none;
}
`}
>
<img src="/DummyDiscord.png" height={75} width={75} />
<Box>
<Text variant="bm-bold">No Frens? No Problem!</Text>
<Text variant="bs-regular">
Feeling too busy for frens? Don’t worry! We’ve got your back.
Test out the email experience by chatting with our sassy email
bot.
</Text>
<br />
<Text variant="bs-semibold">
It’s quick, fun, and always ready to banter.
</Text>
</Box>
</Box>
</Box>
<Box display="flex" flexDirection="column" alignItems="flex-start">
<Text variant="bs-regular">Happy emailing,</Text>
<Text variant="bs-bold">Push Fam</Text>
</Box>
</Box>
</Card>
);
};

export default DummyEmail;
Loading