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

chore: Various fixes and enhancements #1628

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 0 additions & 12 deletions src/components/Berachain/BerachainExploreProtocol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ export const BerachainExploreProtocol = ({
return (
<Container>
<Background />
<Link href="/berachain/explore" style={{ textDecoration: 'none' }}>
<BerachainBackButton>
<ArrowBackIcon />
<Typography variant="bodySmallStrong">Explore Berachain</Typography>
</BerachainBackButton>
</Link>
<BerachainProtocolInformation />
</Container>
);
Expand All @@ -60,12 +54,6 @@ export const BerachainExploreProtocol = ({
return (
<Container>
<Background />
<Link href="/berachain/explore" style={{ textDecoration: 'none' }}>
<BerachainBackButton>
<ArrowBackIcon />
<Typography variant="bodySmallStrong">Explore Berachain</Typography>
</BerachainBackButton>
</Link>
{/* {card && */}
<BerachainProtocolInformation
market={roycoDataMarket}
Expand Down
17 changes: 17 additions & 0 deletions src/components/Berachain/components/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ReactNode } from 'react';
import { Link, Typography } from '@mui/material';
import { BerachainBackButton } from '@/components/Berachain/Berachain.style';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';

function BackButton() {
return (
<Link href="/berachain/explore" style={{ textDecoration: 'none' }}>
<BerachainBackButton>
<ArrowBackIcon />
<Typography variant="bodySmallStrong">Explore Berachain</Typography>
</BerachainBackButton>
</Link>
);
}

export default BackButton;
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ export const BerachainMarketCard = ({
}}
>
<DigitTokenSymbolCard
sx={(theme) => ({
'.tooltip-icon': {
color: theme.palette.alphaLight500.main,
},
'.title': {
color: '#8b8989',
fontSize: '0.75rem',
},
})}
title={deposited ? 'Deposited' : 'Deposit'}
tooltipText={deposited ? DEPOSITED_TOOLTIP : DEPOSIT_TOOLTIP}
tokenImage={roycoData?.input_token_data?.image}
Expand All @@ -185,9 +194,19 @@ export const BerachainMarketCard = ({
hasDeposited={deposited ? true : false}
/>
<DigitCard
sx={{
sx={(theme) => ({
'.tooltip-icon': {
color: theme.palette.alphaLight500.main,
},
alignItems: 'flex-end',
}}
'.title': {
color: '#8b8989',
fontSize: '0.75rem',
},
'.content': {
marginTop: 1,
},
})}
title={'TVL'}
tooltipText={TVL_TOOLTIP}
digit={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const BerachainProgressCard = ({
</Typography>
{(tooltip || showTooltipIcon) && (
<Tooltip
className="tooltip-icon"
title={tooltip}
placement={'top'}
enterTouchDelay={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const DigitCard = ({
{title}
</Typography>
<Tooltip
className="tooltip-icon"
title={tooltipText}
placement={'top'}
enterTouchDelay={0}
Expand All @@ -61,6 +62,7 @@ const DigitCard = ({
marginTop={'4px'}
sx={(theme) => ({
display: 'inline-flex',
marginTop: 1,
typography: {
xs: theme.typography.titleXSmall,
sm: theme.typography.titleXSmall,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const DigitTokenSymbolCard = ({
<BeraChainProgressCardContent sx={sx}>
<BeraChainProgressCardHeader display={'flex'}>
<Typography
className="title"
variant="bodySmall"
sx={(theme) => ({
typography: {
Expand All @@ -42,6 +43,7 @@ const DigitTokenSymbolCard = ({
{title}
</Typography>
<Tooltip
className="tooltip-icon"
title={tooltipText}
placement={'top'}
enterTouchDelay={0}
Expand All @@ -65,7 +67,8 @@ const DigitTokenSymbolCard = ({
}}
>
<BerachainMarketCardTokenContainer
sx={{ display: 'flex', alignItems: 'center', gap: '4px' }}
className="content-wrapper"
sx={{ display: 'flex', alignItems: 'flex-end', gap: '4px' }}
key={`berachain-market-card-token-container-name-${title}`}
>
{tokenImage ? (
Expand All @@ -89,6 +92,7 @@ const DigitTokenSymbolCard = ({
className="content"
marginTop={'4px'}
sx={(theme) => ({
marginTop: 1,
typography: {
xs: theme.typography.titleXSmall,
sm: theme.typography.titleXSmall,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Breakpoint } from '@mui/material';
import type { Breakpoint, SxProps } from '@mui/material';
import { alpha, Box, Tooltip, Typography, useTheme } from '@mui/material';
import { BerachainProgressCard } from './BerachainProgressCard';
import { Theme } from '@mui/material/styles';

interface DigitCardProps {
title: string;
Expand All @@ -18,14 +19,17 @@ const DigitTooltipCard = ({ title, digit, tooltipText }: DigitCardProps) => {
title={title}
value={digit}
showTooltipIcon={true}
sx={{
sx={(theme) => ({
'.tooltip-icon': {
color: theme.palette.alphaLight500.main,
},
height: '100%',
padding: theme.spacing(1.5, 2),
display: 'flex',
[theme.breakpoints.up('sm' as Breakpoint)]: {
padding: theme.spacing(1.5, 2),
},
}}
})}
valueSx={{
color: alpha(theme.palette.white.main, 0.84),
fontSize: theme.typography.titleXSmall.fontSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ const TokenIncentivesCard = ({ marketData, tokens }: DigitCardProps) => {
</Typography>
<Tooltip title={''} placement={'top'} enterTouchDelay={0} arrow>
<InfoIcon
sx={{
sx={(theme) => ({
color: theme.palette.alphaLight500.main,
width: '16px',
height: '16px',
marginLeft: '4px',
color: 'inherit',
}}
})}
/>
</Tooltip>
</BeraChainProgressCardHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const BerachainSearch = () => {
},
}}
{...params}
placeholder="Search for markets"
placeholder="Search for markets or tokens"
InputLabelProps={{
...params.InputLabelProps,
shrink: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export const BerachainProtocolActionInfoBox = styled(Box)(({ theme }) => ({
maxWidth: 380,
},
[theme.breakpoints.up('md' as Breakpoint)]: {
maxWidth: 640,
maxWidth: 760,
padding: theme.spacing(3),
},
}));

export const BerachainInformationProtocolIntro = styled(Box)(({ theme }) => ({
display: 'flex',
flexDirection: 'row',
flexDirection: 'column',
gap: theme.spacing(2),
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
import InfoIcon from '@mui/icons-material/Info';
import LanguageIcon from '@mui/icons-material/Language';
import TelegramIcon from '@mui/icons-material/Telegram';
import XIcon from '@mui/icons-material/X';
import type { Theme } from '@mui/material';
import { Box, Skeleton, Typography, useMediaQuery } from '@mui/material';
import { Box, Skeleton, Stack, Typography, useMediaQuery } from '@mui/material';
import Image from 'next/image';
import { useTranslation } from 'react-i18next';
import { AccordionFAQ } from 'src/components/AccordionFAQ';
import { getSiteUrl } from 'src/const/urls';
import { useMenuStore } from 'src/stores/menu';
import type { Quest } from 'src/types/loyaltyPass';
import { BerachainWidget } from '../BerachainWidget/BerachainWidget';
Expand All @@ -23,8 +21,9 @@ import {
import { BerachainProtocolFaqAccordionHeader } from './BerachainProtocolFaqAccordionHeader';
import type { EnrichedMarketDataType } from 'royco/queries';
import { getStrapiBaseUrl } from '@/utils/strapi/strapiHelper';
import { WagmiProvider } from 'wagmi';
import BerachainWidgetLoader from '../BerachainWidget/WidgetLoader/WidgetLoader';
import BackButton from '@/components/Berachain/components/BackButton';
import { getFullTitle } from '@/components/Berachain/utils';

interface BerachainProtocolActionProps {
market?: EnrichedMarketDataType;
Expand All @@ -50,59 +49,64 @@ export const BerachainProtocolInformation = ({
(market ? (
<BerachainWidget
market={market}
appName={card?.attributes?.Title}
appName={getFullTitle(market!, card)}
appLink={detailInformation?.socials?.website}
/>
) : (
<BerachainWidgetLoader />
))}
<BerachainProtocolActionInfoBox>
<BerachainInformationProtocolIntro>
{!isMobile &&
(card?.attributes?.Image.data.attributes.url ? (
<Image
src={`${baseUrl}${card?.attributes.Image.data.attributes.url}`}
alt="Protocol image"
width={card?.attributes.Image.data.attributes.width}
height={card?.attributes.Image.data.attributes.height}
style={{
width: 144,
height: 'auto',
objectFit: 'contain',
}}
/>
) : (
<Skeleton
variant="circular"
sx={{
width: '144px',
height: '144px',
flexShrink: 0,
marginTop: '16px',
}}
/>
))}
<BackButton />
<BerachainInformationProtocolCard>
{card?.attributes?.Title ? (
<Typography variant="titleSmall">
What is {card?.attributes.Title}?
</Typography>
) : (
<Skeleton
variant="rectangular"
sx={{ height: '32px', width: '380px' }}
/>
)}
{card?.attributes?.Description ? (
<Typography variant="bodyMedium">
{card?.attributes.Description}
</Typography>
) : (
<Skeleton
variant="rectangular"
sx={{ height: '72px', width: '100%', borderRadius: '8px' }}
/>
)}
<Stack spacing={2} direction="row">
{!isMobile &&
(card?.attributes?.Image.data.attributes.url ? (
<Image
src={`${baseUrl}${card?.attributes.Image.data.attributes.url}`}
alt="Protocol image"
width={card?.attributes.Image.data.attributes.width}
height={card?.attributes.Image.data.attributes.height}
style={{
width: 144,
height: 'auto',
objectFit: 'contain',
}}
/>
) : (
<Skeleton
variant="circular"
sx={{
width: '144px',
height: '144px',
flexShrink: 0,
marginTop: '16px',
}}
/>
))}
<Stack spacing={2} direction="column">
{card?.attributes?.Title ? (
<Typography variant="titleSmall">
What is {card?.attributes.Title}?
</Typography>
) : (
<Skeleton
variant="rectangular"
sx={{ height: '32px', width: '380px' }}
/>
)}
{card?.attributes?.Description ? (
<Typography variant="bodyMedium" color="textSecondary">
{card?.attributes.Description}
</Typography>
) : (
<Skeleton
variant="rectangular"
sx={{ height: '72px', width: '100%', borderRadius: '8px' }}
/>
)}
</Stack>
</Stack>
<Box sx={{ display: 'flex', gap: '12px' }}>
{detailInformation?.socials && (
<>
Expand Down Expand Up @@ -187,7 +191,10 @@ export const BerachainProtocolInformation = ({
</BerachainProtocolActionInfoBox>
{!isMobile &&
(market ? (
<BerachainWidget market={market} />
<BerachainWidget
market={market}
appName={getFullTitle(market!, card)}
/>
) : (
<BerachainWidgetLoader />
))}
Expand Down
Loading
Loading