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

2x weekly promotion of develop to main #1346

Merged
merged 23 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4e664a8
feat: update communities page
flmel Sep 5, 2024
c725df6
Merge branch 'develop' into feat/communities
flmel Sep 5, 2024
8cb4f3b
fix: move faqs to component
flmel Sep 5, 2024
3397de7
fix: faqs
flmel Sep 5, 2024
8718ebe
fix: reword button
flmel Sep 5, 2024
fff06fa
wip
matiasbenary Oct 21, 2024
73097f4
feat: vm cookie was replaced by native for the app
matiasbenary Oct 23, 2024
1cb190d
Merge branch 'develop' into feat/add-claim-page
matiasbenary Oct 25, 2024
93a2ec3
feat: add claim page
matiasbenary Nov 2, 2024
39f96b1
feat: add claim page
matiasbenary Nov 2, 2024
a294a05
feat: merge with develop
matiasbenary Nov 8, 2024
7826497
feat: update style for commuities page
matiasbenary Nov 12, 2024
544f7ab
feat: add close button banner
matiasbenary Nov 13, 2024
0769786
fix(wallet-utilities): fix balance display issue and ensure accurate …
Pawar7349 Nov 19, 2024
19bad57
Merge pull request #1337 from matiasbenary/feat/replace-vm-cookie-wit…
flmel Nov 19, 2024
fd49528
Merge pull request #1345 from Pawar7349/fix/wallet-utilities-formatting
gagdiez Nov 21, 2024
53a638e
fix: minor style issues
gagdiez Nov 22, 2024
aa7bcf6
Merge pull request #1341 from matiasbenary/feat/add-claim-page
gagdiez Nov 22, 2024
a5eef38
Merge branch 'near:develop' into feat/communities
gagdiez Nov 22, 2024
6fbbc17
fix: styles
gagdiez Nov 22, 2024
64a140a
Merge pull request #1344 from matiasbenary/feat/communities
gagdiez Nov 22, 2024
02908a3
fix(styles): center newsletterBanner
matiasbenary Nov 22, 2024
0995aae
Merge pull request #1347 from matiasbenary/feat/add-close-button-news…
gagdiez Nov 22, 2024
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"prettier": "prettier --check 'src/**/*.{js,jsx,ts,tsx,json}'",
"prettier": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json}\"",
"prettier:write": "prettier --write 'src/**/*.{js,jsx,ts,tsx,json}'",
"prepare": "is-ci || husky install && npm install commitizen -g",
"pre-commit": "pnpm prettier && pnpm lint --max-warnings 0 && pnpm ts:check",
Expand Down
40 changes: 40 additions & 0 deletions src/assets/images/meteor.svg
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 src/assets/images/my_near_wallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 125 additions & 5 deletions src/components/CookiePrompt.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Button, Dialog } from '@near-pagoda/ui';
import Link from 'next/link';
import { useState } from 'react';
import styled from 'styled-components';

import { useBosComponents } from '@/hooks/useBosComponents';
import { useCookieStore } from '@/stores/cookieData';

import { VmComponent } from './vm/VmComponent';
import { cookiePreferences, optOut } from '@/utils/analytics';

const Wrapper = styled.div`
position: fixed;
Expand All @@ -12,12 +13,131 @@ const Wrapper = styled.div`
right: 0;
`;

const Cookies = styled.div`
position: fixed;
bottom: 0;
left: 0;
right: 0;
box-shadow: 0 8px 48px rgba(0, 0, 0, 0.15);
background-color: white;
border-radius: 4px;
margin: 8px auto;
max-width: 100%;
width: 714px;
padding: 12px;
display: flex;
gap: 10px;
align-items: center;
font-size: 12px;
line-height: 18px;
font-weight: 400;

p {
margin-bottom: 0;
}

.buttons {
display: flex;
gap: 10px;
}

@media (max-width: 800px) {
flex-direction: column;
align-items: flex-start;
margin: 0;
border-radius: 0;
width: 100%;
}
`;

const CustomizeDialogContent = styled.div`
padding: 15px;
display: flex;
flex-direction: column;
gap: 50px;
font-size: 12px;
line-height: 18px;
font-weight: 400;

.info {
display: flex;
flex-direction: column;
gap: 20px;

h2 {
font-size: 16px;
}
}
`;

const ActionWrapper = styled.div`
display: flex;
gap: 12px;
justify-content: flex-end;
flex-wrap: wrap;
justify-content: center;
`;
export const CookiePrompt = () => {
const cookieData = useCookieStore((state) => state.cookieData);
const components = useBosComponents();
const [cookieAcceptance, setCookieAcceptance] = useState(false);

const [open, setOpen] = useState(false);
if (cookieData || cookieAcceptance) return null;

const onAccept = ({ all, onlyRequired = false }: { all?: boolean; onlyRequired?: boolean }) => {
setCookieAcceptance(true);
localStorage.setItem('cookiesAcknowledged', all ? cookiePreferences.all : cookiePreferences.onlyRequired);
optOut(onlyRequired);
};
return (
<Wrapper>
<VmComponent src={components.nearOrg.cookiePrompt} props={{ cookiesAcknowleged: cookieData }} />
<Dialog.Root open={open} onOpenChange={setOpen}>
<Dialog.Content title="Customize Cookies">
<CustomizeDialogContent>
<div className="info">
<div>
<h2>Necessary Cookies</h2>
<p>
These cookies are required for website functionality such as storing your settings and preferences, as
detailed <Link href="/cookies/details">here</Link>.
</p>
</div>
<div>
<h2>Marketing & Analytics Cookies</h2>
<p>
We recommend accepting these cookies, which include third-party cookies, for the improvement of user
experience and discoverability on the B.O.S. These cookies contribute to anonymized statistics which
are analyzed in aggregate.
</p>
</div>
<ActionWrapper>
<Button type="button" label="Accept All" size="small" onClick={() => onAccept({ all: true })} />
<Button
type="button"
label="Required Only"
fill="outline"
size="small"
onClick={() => onAccept({ onlyRequired: true })}
/>
</ActionWrapper>
</div>
</CustomizeDialogContent>
</Dialog.Content>
</Dialog.Root>
<Cookies>
<p>
We use our own and third-party cookies on our website to enhance your experience, analyze traffic, and for
marketing. For more information see our{' '}
<Link href="/cookies" target="_blank">
Cookie Policy
</Link>
.{' '}
</p>
<div className="buttons">
<Button type="button" label="Customize" fill="outline" size="small" onClick={() => setOpen(true)} />
<Button type="button" label="Accept" size="small" onClick={() => onAccept({ all: true })} />
</div>
</Cookies>
</Wrapper>
);
};
24 changes: 24 additions & 0 deletions src/components/claim/FTPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Flex, Text } from '@near-pagoda/ui';
import Image from 'next/image';

type FT = {
decimals: number;
icon: string;
name: string;
symbol: string;
total_supply: string;
};

const FTPreview = ({ token }: { token: FT }) => {
return (
<Flex justify="space-between" align="center" style={{ flexDirection: 'column' }}>
<Text size="text-xl">{token.name}</Text>
<Image src={token.icon} alt={token.name} width={50} height={50} />
<Text>
{(BigInt(token.total_supply) / BigInt(10 ** token.decimals)).toString()} {token.symbol}
</Text>
</Flex>
);
};

export default FTPreview;
35 changes: 35 additions & 0 deletions src/components/claim/NFTPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Flex, Text } from '@near-pagoda/ui';
import { useContext, useEffect, useState } from 'react';

import type { NFT } from '@/utils/types';

import { NftImage } from '../NTFImage';
import { NearContext } from '../wallet-selector/WalletSelector';

const NFTPreview = ({ nft }: { nft: NFT }) => {
const [infoNft, setInfoNft] = useState<NFT | undefined>(undefined);
const { wallet } = useContext(NearContext);
useEffect(() => {
if (!wallet) return;
const fetchNftInfo = async () => {
setInfoNft(
await wallet.viewMethod({
contractId: nft.contract_id,
method: 'nft_token',
args: { token_id: nft.token_id },
}),
);
};
fetchNftInfo();
}, [nft, wallet]);

return (
<Flex justify="space-between" align="center" style={{ flexDirection: 'column' }}>
<Text size="text-xl">{infoNft?.metadata?.title}</Text>
<NftImage nft={infoNft} />
<Text>{infoNft?.metadata?.description}</Text>
</Flex>
);
};

export default NFTPreview;
16 changes: 16 additions & 0 deletions src/components/claim/NearPreview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Flex, Text } from '@near-pagoda/ui';
import Image from 'next/image';

import NearIconSvg from '@/assets/images/near-icon.svg';

const NearPreview = ({ amount }: { amount: string }) => {
return (
<Flex justify="space-between" align="center" style={{ flexDirection: 'column' }}>
<Text size="text-xl">NEAR</Text>
<Image src={NearIconSvg} alt="NEAR" width={50} height={50} />
<Text>{amount} NEAR</Text>
</Flex>
);
};

export default NearPreview;
54 changes: 54 additions & 0 deletions src/components/claim/Wallets.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Flex } from '@near-pagoda/ui';
import Image from 'next/image';
import styled from 'styled-components';

import Meteor from '@/assets/images/meteor.svg';
import MyNearWallet from '@/assets/images/my_near_wallet.png';
import { networkId } from '@/config';

const StyledButton = styled.a`
background-color: #1e2030;
color: #fff;
border: none;
border-radius: 25px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.3s;
&:hover {
background-color: #101124;
}
`;

const WalletButton = styled(StyledButton)`
background-color: #212529;
text-decoration: none;
&:hover {
background-color: #11111c;
}
`;

const Wallets = ({ url }: { url: string }) => {
// https://docs.keypom.xyz/docs/next/keypom-sdk/Core/modules#supportedlinkdropclaimpages
const meteorWalletUrl = 'https://wallet.meteorwallet.app/linkdrop/';
const myNearWalletUrl =
networkId === 'testnet' ? 'https://testnet.mynearwallet.com/linkdrop/' : 'https://app.mynearwallet.com/linkdrop/';

return (
<Flex stack style={{ paddingTop: '1rem' }} gap="m">
<WalletButton href={`${meteorWalletUrl}${url}`} target="_blank">
<Image height={20} alt="Mintbase Logo" src={Meteor} />
<span style={{ textDecoration: 'none', marginLeft: '1rem' }}>Meteor Wallet</span>
</WalletButton>
<WalletButton href={`${myNearWalletUrl}${url}`} target="_blank">
<Image height={19} alt="My Near Wallet Logo" src={MyNearWallet} />
<span style={{ textDecoration: 'none', marginLeft: '1rem' }}>My Near Wallet</span>
</WalletButton>
</Flex>
);
};

export default Wallets;
Loading
Loading