Skip to content

Commit

Permalink
Merge branch 'develop' into LF-11020-jumper-front-implement-the-new-w…
Browse files Browse the repository at this point in the history
…allet-linking-design
  • Loading branch information
dennyscode committed Jan 14, 2025
2 parents e8e0aa5 + a42baeb commit d34db44
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const BerachainMarketCard = ({
},
})}
>
{`${title} ${roycoData?.input_token_data?.symbol} Market`}
{title}
</Typography>
) : (
<Skeleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { useBerachainMarkets } from '@/components/Berachain/hooks/useBerachainMa
import type { EnrichedMarketDataType } from 'royco/queries';
import { useBerachainMarketsFilterStore } from '@/components/Berachain/stores/BerachainMarketsFilterStore';
import { useSearchParams } from 'next/navigation';
import {
getFullTitle,
includesCaseInsensitive,
} from '@/components/Berachain/utils';

export const BerachainMarkets = () => {
const searchParam = useSearchParams();
Expand Down Expand Up @@ -49,7 +53,10 @@ export const BerachainMarkets = () => {
);
})
.filter((data) => {
return search ? data.name?.toLowerCase().includes(search) : true;
const card = findFromStrapiByUid(data.market_id!);
const fullTitle = getFullTitle(data, card);

return search ? includesCaseInsensitive(fullTitle, search) : true;
})
.filter((data) => {
return !!findFromStrapiByUid(data.market_id!);
Expand All @@ -60,13 +67,15 @@ export const BerachainMarkets = () => {
}
const card = findFromStrapiByUid(roycoData.market_id!);

const fullTitle = getFullTitle(roycoData, card);

return (
<BerachainMarketCard
key={`berachain-market-card-${roycoData.id || 'protocol'}-${index}`}
roycoData={roycoData}
// chainId={roycoData.chain_id}
image={card?.attributes.Image}
title={card?.attributes.Title}
title={fullTitle}
// slug={roycoData.id}
// slug={card.attributes.Slug}
tokens={[]}
Expand Down
12 changes: 12 additions & 0 deletions src/components/Berachain/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { EnrichedMarketDataType } from 'royco/queries';
import type { Quest } from '@/types/loyaltyPass';

export function calculateTVLGoal(market: EnrichedMarketDataType) {
return (
Expand All @@ -8,3 +9,14 @@ export function calculateTVLGoal(market: EnrichedMarketDataType) {
100
);
}

export function getFullTitle(
roycoData: EnrichedMarketDataType,
strapiData?: Quest<never>,
) {
return `${strapiData?.attributes.Title} ${roycoData?.input_token_data?.symbol} Market`;
}

export function includesCaseInsensitive(str: string, searchString: string) {
return new RegExp(searchString, 'i').test(str);
}
32 changes: 16 additions & 16 deletions src/components/Menus/MainMenu/useMainMenuContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,22 @@ export const useMainMenuContent = () => {
});
},
},
{
label: 'Jump into Boyco',
prefixIcon: <BoycoIcon />,
showMoreIcon: false,
link: { url: JUMPER_BOYCO_PATH },
onClick: () => {
trackEvent({
category: TrackingCategory.Menu,
label: 'click-jumper-pass-berachain',
action: TrackingAction.ClickJumperCampaignLink,
data: { [TrackingEventParameter.Menu]: 'berachain' },
});
closeAllMenus();
router.push(JUMPER_BOYCO_PATH);
},
},
// {
// label: 'Jump into Boyco',
// prefixIcon: <BoycoIcon />,
// showMoreIcon: false,
// link: { url: JUMPER_BOYCO_PATH },
// onClick: () => {
// trackEvent({
// category: TrackingCategory.Menu,
// label: 'click-jumper-pass-berachain',
// action: TrackingAction.ClickJumperCampaignLink,
// data: { [TrackingEventParameter.Menu]: 'berachain' },
// });
// closeAllMenus();
// router.push(JUMPER_BOYCO_PATH);
// },
// },
{
label: t('navbar.navbarMenu.profile'),
prefixIcon: <AccountCircleIcon />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const QuestsCompletedCarousel = ({
id: pda?.id,
completed: true,
active: false,
title: `${capitalizeString(pda.reward?.type)} (${capitalizeString(pda?.reward?.name)})`,
title: capitalizeString(pda?.reward?.name),
image: pda?.reward?.image,
points: pda?.points,
};
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test.describe('Jumper full e2e flow', () => {
page,
}) => {
await openOrCloseMainMenu(page);
await checkTheNumberOfMenuItems(page, 10);
await checkTheNumberOfMenuItems(page, 9);
await page.locator('body').click();
await expect(page.getByRole('menu')).not.toBeVisible();
});
Expand Down

0 comments on commit d34db44

Please sign in to comment.