Skip to content

Commit

Permalink
Meme nft7 (#631)
Browse files Browse the repository at this point in the history
* Feat nft 7

* update meme rules

* Feat near farm

* feat: chang apr to apy

* Fix select token

* fix: ui bug fix

* fix:apy

* fix: need not fetch balance if unlogin

* Fix select token

* Fix meme NFT TaskModal

---------

Co-authored-by: lq0-github <[email protected]>
Co-authored-by: deep-path <[email protected]>
Co-authored-by: naturexie <[email protected]>
  • Loading branch information
4 people authored Nov 1, 2024
1 parent cbbcfb5 commit cc9f3a8
Show file tree
Hide file tree
Showing 16 changed files with 169 additions and 151 deletions.
39 changes: 21 additions & 18 deletions src/components/forms/SelectToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,29 @@ export default function SelectToken({
balances,
visible
);
const sortTypes = useMemo(
() => ({
up: {
class: 'sort-up',
fn: (a: any, b: any) => sort(a[sortBy], b[sortBy]),
},
down: {
class: 'sort-down',
fn: (a: any, b: any) => sort(b[sortBy], a[sortBy]),
},
default: {
class: 'sort',
fn: (a: any, b: any) => a,
},
}),
[sortBy]
);
useEffect(() => {
if (allTokensData?.length && !loadingAllTokensData) {
allTokensData.sort(sortTypes[currentSort].fn);
setAllListData(allTokensData);
const sortedData = [...allTokensData].sort(sortTypes[currentSort].fn);
setAllListData(sortedData);
}
}, [allTokensData?.length, loadingAllTokensData, currentSort]);
}, [allTokensData?.length, loadingAllTokensData]);
useEffect(() => {
if (searchResultslistData?.length) {
searchResultslistData.sort(sortTypes[currentSort].fn);
Expand Down Expand Up @@ -617,20 +634,6 @@ export default function SelectToken({
getLatestCommonBassesTokens();
}, [tokensData]);

const sortTypes: { [key: string]: any } = {
up: {
class: 'sort-up',
fn: (a: any, b: any) => sort(a[sortBy], b[sortBy]),
},
down: {
class: 'sort-down',
fn: (a: any, b: any) => sort(b[sortBy], a[sortBy]),
},
default: {
class: 'sort',
fn: (a: any, b: any) => a,
},
};
const sortBySymbol = (a: TokenMetadata, b: TokenMetadata) => {
if (+a.near == 0 && +b.near == 0) {
const a_symbol = toRealSymbol(a.symbol).toLocaleLowerCase();
Expand Down Expand Up @@ -1496,4 +1499,4 @@ export const SelectTokenForList = ({
</div>
</div>
);
};
};
6 changes: 3 additions & 3 deletions src/components/layout/SelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ export const SelectModal = ({

<div
className={`py-2 px-2 w-full hover:bg-white hover:bg-opacity-10 text-white text-opacity-40 ${
sortMode === 'apr' ? 'bg-white bg-opacity-10 text-opacity-100' : ''
sortMode === 'apy' ? 'bg-white bg-opacity-10 text-opacity-100' : ''
} z-30`}
onClick={() => {
onSortChange('apr');
onSortChange('apy');
setShowModal(false);
}}
>
<FormattedMessage id="apr" defaultMessage="APR" />
<FormattedMessage id="apy" defaultMessage="APY" />
</div>

<div
Expand Down
4 changes: 2 additions & 2 deletions src/components/meme/CheckInModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ const CheckInModal = (props: any) => {
</div>
<div class="flex items-start gap-1.5">
<span class="relative top-1.5 w-1 h-1 rounded-full bg-white flex-shrink-0"></span>
<span>Unlock MEME Honorary NFT 6 for all users in MEME Season 6 by completing tasks.</span>
<span>Unlock MEME Honorary NFT 7 for all users in MEME Season 7 by completing tasks.</span>
</div>
<div class="flex items-start gap-1.5">
<span class="relative top-1.5 w-1 h-1 rounded-full bg-white flex-shrink-0"></span>
<span>All NFTs boost the luck in Daily Check-in draws.</span>
</div>
<div class="flex items-start gap-1.5">
<span class="relative top-1.5 w-1 h-1 rounded-full bg-white flex-shrink-0"></span>
<span>Holders of MEME Honorary NFT can accelerate MEME token acquisition and participate in Season 6 staking.</span>
<span>Holders of MEME Honorary NFT can accelerate MEME token acquisition and participate in Season 7 staking.</span>
</div>
<div class="flex items-start gap-1.5">
<span class="relative top-1.5 w-1 h-1 rounded-full bg-white flex-shrink-0"></span>
Expand Down
1 change: 1 addition & 0 deletions src/components/meme/MemeVoteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function MemeVoteModal(props: any) {
memeContractConfig,
} = useContext(MemeContext);
const { delay_withdraw_sec } = memeContractConfig;
console.log(memeContractConfig, 'memeContractConfig');
useEffect(() => {
if (!isEmpty(xrefSeeds)) {
setSelectedTab(
Expand Down
6 changes: 3 additions & 3 deletions src/components/meme/NFTTaskModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const NFTTaskModal = (props: any) => {
function share() {
setShareButtonClicked('1');
onRequestClose();
window.open('https://x.com/intent/retweet?tweet_id=1840935987545063790');
window.open('https://x.com/finance_ref/status/1852016524456047028');
}
return (
<Modal
Expand All @@ -33,14 +33,14 @@ const NFTTaskModal = (props: any) => {
>
<div className="flex items-center justify-between">
<span className="text-white text-base gotham_bold">
MEME Honorary NFT6
MEME Honorary NFT7
</span>
<ModalCloseIcon className="cursor-pointer" onClick={onRequestClose} />
</div>
<div className="flex flex-col items-center mt-3 text-white text-sm gap-2">
<p className="text-left">
Unlock endless rewards from the MEME world, exclusive to MEME Season
6! Complete the following tasks to claim:
7! Complete the following tasks to claim:
</p>
<div className="flex items-start justify-start w-full gap-1.5 text-left">
<span className="relative top-1.5 w-1 h-1 rounded-full bg-white flex-shrink-0"></span>
Expand Down
12 changes: 6 additions & 6 deletions src/components/meme/memeConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ export function getMemeCheckInConfig(): any {
return {
token_id_list: ['ref.fakes.testnet', 'usdt.fakes.testnet'],
nftMetaData: {
title: 'MEME Honorary NFT 6',
description: 'REF MemeSeason6 NFT',
title: 'MEME Honorary NFT 7',
description: 'REF MemeSeason7 NFT',
},
level: {
0: {
Expand All @@ -672,8 +672,8 @@ export function getMemeCheckInConfig(): any {
return {
token_id_list: ['ref.fakes.testnet', 'usdt.fakes.testnet'],
nftMetaData: {
title: 'MEME Honorary NFT 6',
description: 'REF MemeSeason6 NFT',
title: 'MEME Honorary NFT 7',
description: 'REF MemeSeason7 NFT',
},
level: {
0: {
Expand Down Expand Up @@ -703,8 +703,8 @@ export function getMemeCheckInConfig(): any {
'gp.token0.near',
],
nftMetaData: {
title: 'MEME Honorary NFT 6',
description: 'REF MemeSeason6 NFT',
title: 'MEME Honorary NFT 7',
description: 'REF MemeSeason7 NFT',
},
level: {
0: {
Expand Down
10 changes: 5 additions & 5 deletions src/pages/pools/DetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,7 @@ export default function PoolDetailsPage() {
return (
<div
className={`rounded-lg xs:w-full md:w-full xs:mr-0 md:mr-0 ${
id !== 'apr' ? 'mr-3' : ''
id !== 'apy' ? 'mr-3' : ''
} py-3 w-full px-4 flex flex-col`}
style={{
background: 'rgba(29, 41, 50, 0.5)',
Expand Down Expand Up @@ -2847,7 +2847,7 @@ export default function PoolDetailsPage() {
<InfoCard
title={
<>
<FormattedMessage id="apr" defaultMessage="APR" />
<FormattedMessage id="apy" defaultMessage="APY" />
&nbsp;
{/* {dayVolume && seedFarms && BaseApr().rawApr > 0 && (
<>
Expand All @@ -2858,7 +2858,7 @@ export default function PoolDetailsPage() {
)} */}
</>
}
id="apr"
id="apy"
value={
<div
data-type="info"
Expand Down Expand Up @@ -2939,7 +2939,7 @@ export default function PoolDetailsPage() {
<InfoCard
title={
<>
<FormattedMessage id="apr" defaultMessage="APR" />
<FormattedMessage id="apy" defaultMessage="APY" />
&nbsp;
{/* {dayVolume && seedFarms && BaseApr().rawApr > 0 && (
<>
Expand All @@ -2950,7 +2950,7 @@ export default function PoolDetailsPage() {
)} */}
</>
}
id="apr"
id="apy"
value={
<div
data-type="info"
Expand Down
30 changes: 15 additions & 15 deletions src/pages/pools/LiquidityPage/LiquidityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ function WatchListCard({

<div className="col-span-1 justify-self-center relative right-1 md:hidden flex items-center">
<div className="pr-1 ">
<FormattedMessage id="apr" defaultMessage="APR" />
<FormattedMessage id="apy" defaultMessage="APY" />
</div>
</div>

Expand Down Expand Up @@ -978,13 +978,13 @@ function PcLiquidityPage({
if (order === 'desc') {
if (reSortBy === 'volume') {
return v2 - v1;
} else if (reSortBy === 'apr') {
} else if (reSortBy === 'apy') {
return apr2 - apr1;
}
} else if (order === 'asc') {
if (reSortBy === 'volume') {
return v1 - v2;
} else if (reSortBy === 'apr') {
} else if (reSortBy === 'apy') {
return apr1 - apr2;
}
}
Expand Down Expand Up @@ -1497,7 +1497,7 @@ function PcLiquidityPage({
onOrderChange(order === 'desc' ? 'asc' : 'desc');
}}
>
<FormattedMessage id="apr" defaultMessage="APR" />
<FormattedMessage id="apy" defaultMessage="APY" />
</span>

<span
Expand Down Expand Up @@ -2765,7 +2765,7 @@ function StablePoolCard({
>
<div className="lg:hidden w-full flex justify-between text-sm text-white">
<div className="text-xs text-v3SwapGray">
<FormattedMessage id="apr" defaultMessage={'APR'} />
<FormattedMessage id="apy" defaultMessage={'APY'} />
</div>

<div className="flex flex-col items-end ">
Expand Down Expand Up @@ -3040,15 +3040,15 @@ function StablePoolList({
if (orderStable === 'desc') {
if (sortBy === 'tvl') {
return v2 - v1;
} else if (sortBy == 'apr') {
} else if (sortBy == 'apy') {
return apr2 - apr1;
} else {
return vol2 - vol1;
}
} else {
if (sortBy === 'tvl') {
return v1 - v2;
} else if (sortBy == 'apr') {
} else if (sortBy == 'apy') {
return apr1 - apr2;
} else {
return vol1 - vol2;
Expand Down Expand Up @@ -3084,31 +3084,31 @@ function StablePoolList({
<span
className={`pr-1 cursor-pointer
${sortBy !== 'apr' ? 'hover:text-white' : 'text-gradientFrom'}
${sortBy !== 'apy' ? 'hover:text-white' : 'text-gradientFrom'}
`}
onClick={() => {
setClicked(true);
setSortBy('apr');
setSortBy('apy');

setorderStable(
orderStable === 'desc' && sortBy === 'apr' ? 'asc' : 'desc'
orderStable === 'desc' && sortBy === 'apy' ? 'asc' : 'desc'
);
}}
>
<FormattedMessage id="apr" defaultMessage="APR" />
<FormattedMessage id="apy" defaultMessage="APY" />
</span>
<span
className={`cursor-pointer ${sortBy !== 'apr' ? 'hidden' : ''} `}
className={`cursor-pointer ${sortBy !== 'apy' ? 'hidden' : ''} `}
onClick={() => {
setClicked(true);
setSortBy('apr');
setSortBy('apy');
setorderStable(
orderStable === 'desc' && sortBy === 'apr' ? 'asc' : 'desc'
orderStable === 'desc' && sortBy === 'apy' ? 'asc' : 'desc'
);
}}
>
{orderStable === 'desc' && sortBy === 'apr' ? (
{orderStable === 'desc' && sortBy === 'apy' ? (
<DownArrowLight />
) : (
<UpArrowLight />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ const LiquidityV1PoolsMobile = ({
}}
>
<label>
<FormattedMessage id={sortBy} defaultMessage={sortBy} />
<FormattedMessage
id={sortBy}
defaultMessage={sortBy == 'apy' ? 'APY' : sortBy}
/>
</label>
<ArrowDownLarge />
</span>
Expand All @@ -255,7 +258,7 @@ const LiquidityV1PoolsMobile = ({
</div>
</div>
</header>
{sortBy === 'apr' && (
{sortBy === 'apy' && (
<div className="text-right text-farmText text-xs mr-3 mb-0.5">
*Pool Fee APY/Top Bin APR + Farm Rewards APR
</div>
Expand Down
Loading

0 comments on commit cc9f3a8

Please sign in to comment.