Skip to content

Commit

Permalink
Add meme guide (#536)
Browse files Browse the repository at this point in the history
* update meme rank

* Feat meme farming api

* update  stake ranking list

* Fix meme numerical precision

* Fix some bugs

* Fix meme Airdrop

* Fix centering problem

* Fix meme mobile popup display direction

* Fix meme userRankingModal mobile

* feat: add modal

* feat: guide

* feat: add meme intro

* update meme staking

* feat: intro

* perf: use stragety store position info

* perf:delete comments

* perf: update position left info

* perf: intro add got it

* Feat staking mobile

* feat: add intro

* Feat xREF staking Details and meme rank

* fix: fix page scroll

* Feat staking chart

* feat: only pc

* perf: prevent click intro

* Feat meme staking mobile

* Fix xref staking detaila mobile

* Feat meme xref staking Round

* fix: meme guide bug

* fix: add quto and modifity title

* feat meme Countdown

* Fix some bugs

* Fix Meme staking chart accuracy

* Fix meme mobile popup overflow

* Fix meme text

* Feat meme wallet title

* Add rank popup Coming soon

* Feat rank mobile min height

* Feat meme rank btn cursor not allowed

* Feat meme rank api url

* forbidden key guider in meme page

* fix key guider issue

* Feat meme finalist icon

* perf: change guide modal width

* Feat meme feed yours finalist

* add meme vote modal

* Fix rank mobile location

* update detail field in meme page

* Fix DGS Airdrop Announcement

* Fix Airdrop Announcement icon

* fix: scroll deal

* Update Countdown endDate

* Fix Meme staking margin

---------

Co-authored-by: lq0-github <[email protected]>
Co-authored-by: deep-path <[email protected]>
  • Loading branch information
3 people authored May 31, 2024
1 parent 67fd432 commit a222523
Show file tree
Hide file tree
Showing 29 changed files with 5,085 additions and 97 deletions.
37 changes: 32 additions & 5 deletions src/components/icon/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,33 @@ export function RemoveLiquidity() {
);
}

export function CloseIconWithCircle({
width,
height,
}: {
width?: string;
height?: string;
}) {
return (
<svg
width="22"
height="22"
viewBox="0 0 22 22"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="11" cy="11" r="11" fill="#061824" />
<circle cx="11" cy="11" r="10.5" stroke="white" strokeOpacity="0.3" />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M6.91679 13.5218C6.51406 13.9245 6.51406 14.5775 6.91679 14.9802C7.31952 15.383 7.97247 15.383 8.3752 14.9802L11.2921 12.0633L14.2091 14.9802C14.6118 15.383 15.2648 15.383 15.6675 14.9802C16.0702 14.5775 16.0702 13.9245 15.6675 13.5218L12.7505 10.6049L15.6672 7.68819C16.07 7.28546 16.07 6.63251 15.6672 6.22978C15.2645 5.82705 14.6116 5.82705 14.2088 6.22978L11.2921 9.14647L8.37545 6.22978C7.97272 5.82705 7.31977 5.82705 6.91705 6.22978C6.51432 6.63251 6.51432 7.28546 6.91705 7.68819L9.83373 10.6049L6.91679 13.5218Z"
fill="#7E8A93"
/>
</svg>
);
}

export function CloseIcon({
width,
height,
Expand Down Expand Up @@ -218,8 +245,8 @@ export function CloseIconBold() {
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
fillRule="evenodd"
clipRule="evenodd"
d="M0.302046 7.59408C-0.100682 7.99681 -0.100682 8.64977 0.302046 9.05249C0.704774 9.45522 1.35773 9.45522 1.76045 9.05249L4.6774 6.13555L7.59434 9.05249C7.99707 9.45522 8.65002 9.45522 9.05274 9.05249C9.45547 8.64977 9.45547 7.99681 9.05274 7.59408L6.1358 4.67714L9.05249 1.76045C9.45522 1.35773 9.45522 0.704774 9.05249 0.302046C8.64976 -0.100682 7.99681 -0.100682 7.59408 0.302046L4.6774 3.21874L1.76071 0.302046C1.35798 -0.100682 0.705027 -0.100682 0.302299 0.302046C-0.100429 0.704774 -0.100429 1.35773 0.302299 1.76045L3.21899 4.67714L0.302046 7.59408Z"
fill="currentColor"
/>
Expand Down Expand Up @@ -741,8 +768,8 @@ function Deposit() {
const viewMap = {
default: Default,
'Storage Deposit': Deposit,
Swap: Swap,
Withdraw: Withdraw,
Swap,
Withdraw,
'Register Tokens': RegisterToken,
'Add Liquidity': AddLiquidity,
'Remove Liquidity': RemoveLiquidity,
Expand All @@ -753,7 +780,7 @@ const viewMap = {
'Claim Reward By Farm': AddLiquidity,
'Withdraw Reward': Withdraw,
'Near Deposit': Deposit,
Deposit: Deposit,
Deposit,
'Instant swap': Swap,
'Near Withdraw': Withdraw,
'Add Stable Liquidity': AddLiquidity,
Expand Down
5 changes: 3 additions & 2 deletions src/components/layout/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function AccountEntry({
showWalletSelector: boolean;
hasBalanceOnRefAccount: boolean;
}) {
const isInMemePage = window.location.pathname.includes('meme');
const history = useHistory();
const [hover, setHover] = useState(false);

Expand Down Expand Up @@ -340,7 +341,7 @@ function AccountEntry({
/>
</div>
</div>
{(isSignedIn && hover) || showGuider ? (
{(isSignedIn && hover) || (showGuider && !isInMemePage) ? (
<div
className={`absolute top-14 pt-2 right-0 w-64`}
style={{ zIndex: showGuider ? '1000' : '40' }}
Expand Down Expand Up @@ -530,7 +531,7 @@ function AccountEntry({
{accountId && keyModalShow ? (
<AccessKeyModal isOpen={keyModalShow} onRequestClose={closeKeyModal} />
) : null}
{showGuider && !isMobile ? (
{showGuider && !isMobile && !isInMemePage ? (
<div>
<Guider clearGuilder={clearGuilder} />
<LinkLine
Expand Down
239 changes: 239 additions & 0 deletions src/components/meme/BeginerGuideModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
import React, { useEffect, useState, useRef } from 'react';
import Modal from 'react-modal';
import { CloseIconWithCircle } from '../../components/icon/Actions';
import { translate } from '@near-wallet-selector/core';
const GuidedTourContext = React.createContext(null);

function BeginerGuideProvider({ children }: { children: any }) {
const modalContentArray = [
{
content: (
<p className="font-normal">
<span className="font-gothamBold pr-1">Stake</span>
xREF to help your favorite MemeToken earn higher farming yields, While
also receiving rewards from the Meme community.
</p>
),
title: 'Vote By xRef',
},
{
content: (
<p className="font-normal">
<span className="font-gothamBold pr-1">Donate </span>
your meme token to stakers of xRef, attracting more xRef holders to
stake their xRef into that MemeToken.
</p>
),
title: 'How show love for voters?',
},
{
content: (
<p className="font-normal">
<span className="font-gothamBold pr-1">Stake</span>
your meme token to help your favorite MemeToken earn higher farming
yields.
</p>
),
title: '',
},
{
content: (
<p className="font-normal">
Your staked MemeTokens will be displayed here.
</p>
),
title: '',
},
{
content: (
<p className="font-normal">
Unstaking requires a 5-day wait.Click
<span className="font-gothamBold px-1">Withdraw</span> at the bottom
of the page after this period to reclaim your MemeToken.
</p>
),
title: '',
},
];

const total = modalContentArray.length;
const [currentStepRefDetail, setCurrentStepRefDetail] = useState(
new Array(5)
);
const [getRef, setGetRef] = useState(false);

const [currentPage, setCurrentPage] = useState(1);

const pageChange = (key) => {
if (key == 'minus' && currentPage > 1) {
setCurrentPage(currentPage - 1);
} else if (key == 'add' && currentPage < total) {
setCurrentPage(currentPage + 1);
}
};

useEffect(() => {
// currentStepRefDetail[currentPage - 1].ref.scrollIntoView({
// behavior: 'smooth',
// });
window.scrollTo({
top: currentStepRefDetail[currentPage - 1].y,
behavior: 'smooth', //
});
}, [currentPage]);

// provider
const onDataLoaded = (stepRef, index) => {
const obj = {
x: stepRef.getBoundingClientRect().left + window.scrollX,
y: stepRef.getBoundingClientRect().top + window.scrollY,
ref: stepRef,
};
console.log(
stepRef.getBoundingClientRect().left,
stepRef.getBoundingClientRect().top,
window.scrollX,
window.screenY
);
// setCurrentPage(index);
const shadowCloneCurrentStepRefDetail = currentStepRefDetail;
shadowCloneCurrentStepRefDetail[index - 1] = obj;
setCurrentStepRefDetail(shadowCloneCurrentStepRefDetail);
setGetRef(true);

window.scrollTo({
top: currentStepRefDetail[currentPage - 1].y,
behavior: 'smooth', //
});
// window.scrollTo(
// currentStepRefDetail[currentPage - 1].x,
// currentStepRefDetail[currentPage - 1].y
// );
};

const intervalRef = useRef(null);
// useEffect(() => {
// //
// intervalRef.current = setInterval(updateModalHeight, 100); //

// return () => clearInterval(intervalRef.current);
// }, []);

// const [modalHeight, setModalHeight] = useState('100vh'); //

// const updateModalHeight = () => {
// const docHeight = Math.max(
// document.body.scrollHeight,
// document.documentElement.scrollHeight,
// document.body.offsetHeight,
// document.documentElement.offsetHeight,
// document.body.clientHeight,
// document.documentElement.clientHeight
// );
// setModalHeight(`${docHeight}px`);
// };

const renderTourContent = () => {
if (!getRef) return null;
return (
<>
<div
style={{
position: 'absolute',
zIndex: 101,
top: `${currentStepRefDetail[currentPage - 1]?.y + 'px'}`,
left: ` ${currentStepRefDetail[currentPage - 1]?.x + 'px'}`,
}}
>
{/* title */}
<h2 className=" font-gothamBold text-white mb-2 text-xl">
{modalContentArray[currentPage - 1].title}
</h2>
{/* main modal content */}
<div
className="bg-greenLight font-gotham text-base text-black p-3 rounded-2xl cursor-default relative"
style={{ width: '343px' }}
>
{modalContentArray.map(
(item, index) =>
index + 1 == currentPage && (
<div key={'content' + index} className="">
{item.content}
</div>
)
)}
{/* pagination */}
<div className="flex justify-end font-gothamBold text-sm cursor-pointer mt-2">
{currentPage > 1 && (
<span
className="mx-2 hover:opacity-50"
onClick={() => pageChange('minus')}
>
&lt; Pre
</span>
)}
{currentPage < modalContentArray.length &&
modalContentArray.length > 1 && (
<span
className="mx-2 hover:opacity-50"
onClick={() => pageChange('add')}
>
Next &gt;
</span>
)}
</div>

{/*dashed line */}
<div
className="absolute"
style={{
width: '1px',
height: '69px',
bottom: '-69px',
border: '1px dashed #00D6AF',
right: currentPage == 2 ? '100px' : '300px',
}}
>
<div
style={{
width: '14px',
height: '14px',
borderRadius: '50%',
backgroundColor: '#00D6AF',
boxShadow: '0px 0px 0px 4px rgba(255, 255, 255, 0.1)',
position: 'absolute',
bottom: '-7px',
left: '-7px',
}}
></div>
</div>
</div>
{/* close */}
<div className="flex justify-end items-center mt-2 mx-3 cursor-pointer text-white text-sm hover:opacity-80">
<span className="mr-2">Close</span>
<CloseIconWithCircle></CloseIconWithCircle>
</div>
</div>
</>
// </Modal>
);
};
return (
<GuidedTourContext.Provider value={{ pageChange, onDataLoaded }}>
{getRef ? (
<div
style={{
filter: 'blur(6px)',
}}
>
{children}
</div>
) : (
children
)}
{renderTourContent()}
</GuidedTourContext.Provider>
);
}

export { BeginerGuideProvider, GuidedTourContext };
Loading

0 comments on commit a222523

Please sign in to comment.