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

Staging Release #1562

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ Register on Crowdin and you can start translating the project into your preferre
Your contributions will help make our project accessible to a wider audience around the world.

Thank you for your support!


6 changes: 0 additions & 6 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ const nextConfig = {
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'effigy.im',
port: '',
pathname: '/a/**',
},
{
protocol: 'https',
hostname: 'raw.githubusercontent.com',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@widgetbot/react-embed": "^1.9.0",
"accept-language": "^3.0.20",
"axios": "^1.7.7",
"blo": "^1.2.0",
"dotenv-cli": "^7.4.2",
"ethers": "^6.13.4",
"fontaine": "^0.5.0",
Expand Down
1 change: 0 additions & 1 deletion public/default_effigy.svg

This file was deleted.

9 changes: 3 additions & 6 deletions src/app/api/profile/[walletAddress]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { getChainsQuery } from '@/hooks/useChains';
import { walletDigest } from '@/utils/walletDigest';
import { getLeaderboardUserQuery } from '@/hooks/useLeaderboard';
import type { PDA } from '@/types/loyaltyPass';
import render from '@/utils/effigy/blockiesPNG';
import { getSiteUrl } from '@/const/urls';
import { getImageResponseOptions } from '@/utils/ImageGeneration/getImageResponseOptions';
import useBlockieImg from '@/hooks/useBlockieImg';

const BASE_WIDTH = 800;
const BASE_HEIGHT = BASE_WIDTH / 1.91;
Expand Down Expand Up @@ -55,6 +55,7 @@ export async function GET(
) {
const walletAddress = (await params).walletAddress;
const loyaltyPass = await getLoyaltyPassData(walletAddress);
const imgLink = useBlockieImg(walletAddress);

return new ImageResponse(
(
Expand Down Expand Up @@ -90,12 +91,8 @@ export async function GET(
borderRadius: '50%',
border: '8px solid #fff',
}}
src={`data:image/png;base64, ${render({ seed: walletAddress.toLowerCase() }).toString('base64')}`}
src={imgLink}
/>
{/* <img
style={{ borderRadius: '50%' }}
src={`https://effigy.im/a/${walletAddress}.png`}
/>*/}
</div>
<div
style={{
Expand Down
17 changes: 3 additions & 14 deletions src/app/api/widget-review/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Example:
* ```
* http://localhost:3000/api/widget-review?fromToken=0x0000000000000000000000000000000000000000&fromChainId=137&toToken=0x0000000000000000000000000000000000000000&toChainId=42161&amount=10&highlighted=amount&theme=dark
* http://localhost:3000/api/widget-review?fromToken=0x0000000000000000000000000000000000000000&fromChainId=137&toToken=0x0000000000000000000000000000000000000000&toChainId=42161&amount=10&theme=dark
* ```
*
* @typedef {Object} SearchParams
Expand All @@ -17,14 +17,12 @@
* @property {number} amount - The amount of tokens.
* @property {boolean} [isSwap] - True if transaction is a swap, default and false if transaction is a bridge (optional).
* @property {'light'|'dark'} [theme] - The theme for the widget (optional).
* @property {'from'|'to'|'amount'} [highlighted] - The highlighted element (optional).
*
*/

import type { ChainId } from '@lifi/sdk';
import { ImageResponse } from 'next/og';
import type { CSSProperties } from 'react';
import type { HighlightedAreas } from 'src/components/ImageGeneration/ImageGeneration.types';
import { imageResponseOptions } from 'src/components/ImageGeneration/imageResponseOptions';
import { imageFrameStyles } from 'src/components/ImageGeneration/style';
import WidgetReviewImage from 'src/components/ImageGeneration/WidgetReviewImage';
Expand All @@ -37,16 +35,8 @@ const WIDGET_IMAGE_HEIGHT = 440;
const WIDGET_IMAGE_SCALING_FACTOR = 2;

export async function GET(request: Request) {
const {
fromChainId,
toChainId,
fromToken,
toToken,
isSwap,
theme,
amount,
highlighted,
} = parseSearchParams(request.url);
const { fromChainId, toChainId, fromToken, toToken, isSwap, theme, amount } =
parseSearchParams(request.url);

// Fetch data asynchronously before rendering
const fromTokenData = await fetchTokenData(fromChainId, fromToken);
Expand Down Expand Up @@ -92,7 +82,6 @@ export async function GET(request: Request) {
theme={theme as 'light' | 'dark'}
toChain={toChain}
amount={amount}
highlighted={highlighted as HighlightedAreas}
/>
</div>
),
Expand Down
3 changes: 0 additions & 3 deletions src/app/api/widget-selection/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* @property {string} toToken - The token address to send to.
* @property {number} toChainId - The chain ID to send to.
* @property {number} amount - The amount of tokens.
* @property {number} [amountUSD] - The USD equivalent amount (optional).
* @property {'light'|'dark'} [theme] - The theme for the widget (optional).
* @property {'from'|'to'|'amount'} [highlighted] - The highlighted element (optional).
*
Expand Down Expand Up @@ -45,7 +44,6 @@ export async function GET(request: Request) {
theme,
amount,
highlighted,
amountUSD,
} = parseSearchParams(request.url);

// Fetch data asynchronously before rendering
Expand Down Expand Up @@ -90,7 +88,6 @@ export async function GET(request: Request) {
fromChain={fromChain}
toChain={toChain}
amount={amount}
amountUSD={amountUSD}
theme={theme as 'light' | 'dark'}
highlighted={highlighted as HighlightedAreas}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/ImageGeneration/Fields/QuoteField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const QuoteField = ({
style={{
...fieldContainerStyle,
padding: `${extendedHeight ? 56 : 16}px 16px 16px`,
width: '100%',
...(highlighted && {
boxShadow: `inset 0 0 0 2px ${theme === 'dark' ? '#653BA3' : '#31007A'}`,
}),
Expand Down
10 changes: 2 additions & 8 deletions src/components/ImageGeneration/WidgetExecutionImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { CSSProperties } from 'react';
import ReviewField from './Fields/ReviewField';
import { FieldSkeleton } from './FieldSkeleton';
import type { HighlightedAreas, ImageTheme } from './ImageGeneration.types';
import ButtonLabel from './Labels/ButtonLabel';
import CardContent from './Labels/CardContent';
import CardTitle from './Labels/CardTitle';
import Title from './Labels/Title';
Expand Down Expand Up @@ -78,7 +77,7 @@ const WidgetExecutionImage = ({
fullWidth={false}
highlighted={highlighted === 'from'}
showSkeletons={true}
sx={{ padding: '0px 16px', marginTop: 14 }}
sx={{ padding: '0px 16px', marginTop: 0 }}
/>
<CardContent
cardContent={
Expand All @@ -102,18 +101,13 @@ const WidgetExecutionImage = ({
: null
}
showSkeletons={true}
sx={{ padding: '0px 16px', marginTop: 18 }}
sx={{ padding: '0px 16px', marginTop: 4 }}
/>
<FieldSkeleton
width={164}
height={12}
sx={{ marginTop: -12, marginLeft: 14 }}
/>
<ButtonLabel
buttonLabel={isSwap ? 'Start swapping' : 'Start bridging'}
theme={theme}
sx={{ marginTop: 53 }}
/>
</div>
</div>
</div>
Expand Down
6 changes: 1 addition & 5 deletions src/components/ImageGeneration/WidgetReviewImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ExtendedChain, Token } from '@lifi/sdk';
import type { CSSProperties } from 'react';
import ReviewField from './Fields/ReviewField';
import { FieldSkeleton } from './FieldSkeleton';
import type { HighlightedAreas, ImageTheme } from './ImageGeneration.types';
import type { ImageTheme } from './ImageGeneration.types';
import ButtonLabel from './Labels/ButtonLabel';
import CardTitle from './Labels/CardTitle';
import Title from './Labels/Title';
Expand All @@ -24,7 +24,6 @@ interface WidgetReviewImageProps {
amount?: string | null;
width: number;
height: number;
highlighted?: HighlightedAreas;
sx?: CSSProperties;
}

Expand All @@ -38,7 +37,6 @@ const WidgetReviewImage = ({
amount,
width,
height,
highlighted,
sx,
}: WidgetReviewImageProps) => {
const contentContainerStyle = contentContainerStyles({
Expand Down Expand Up @@ -77,7 +75,6 @@ const WidgetReviewImage = ({
token={fromToken}
amount={amount ? parseFloat(amount) : null}
fullWidth={false}
highlighted={highlighted === 'from'}
showSkeletons={true}
sx={{ marginTop: 0 }}
/>
Expand All @@ -86,7 +83,6 @@ const WidgetReviewImage = ({
token={toToken}
theme={theme}
fullWidth={false}
highlighted={highlighted === 'to'}
amount={
amount && fromToken && toToken
? (parseFloat(amount) * parseFloat(fromToken?.priceUSD)) /
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/Navbar.style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const NavbarContainer = styled(AppBar)<{ sticky?: boolean }>(
alignItems: 'center',
height: HeaderHeight.XS,
padding: theme.spacing(1, 2),
zIndex: 1500,
zIndex: 1300,
[theme.breakpoints.up('sm' as Breakpoint)]: {
height: HeaderHeight.SM,
padding: theme.spacing(2, 3),
Expand Down
39 changes: 0 additions & 39 deletions src/components/Navbar/NavbarButtons/ProfileButton.tsx

This file was deleted.

40 changes: 23 additions & 17 deletions src/components/Navbar/WalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import { Stack, Typography, useMediaQuery } from '@mui/material';
import { usePathname, useRouter } from 'next/navigation';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { JUMPER_LOYALTY_PATH, JUMPER_SCAN_PATH } from 'src/const/urls';
import useImageStatus from 'src/hooks/useImageStatus';
import {
DEFAULT_WALLET_ADDRESS,
JUMPER_LOYALTY_PATH,
JUMPER_SCAN_PATH,
} from 'src/const/urls';
import { useLoyaltyPass } from 'src/hooks/useLoyaltyPass';
import { JUMPER_WASH_PATH } from '../../const/urls';
import { XPIcon } from '../illustrations/XPIcon';
import { PromoLabel } from '../PromoLabel.style';
import {
ConnectButton,
ConnectButtonLabel,
Expand All @@ -30,6 +32,12 @@ import {
WalletMgmtChainAvatar,
WalletMgmtWalletAvatar,
} from './WalletButton.style';
import useBlockieImg from '@/hooks/useBlockieImg';
import { useWalletAddressImg } from '@/hooks/useAddressImg';
import { useEnsName } from 'wagmi';
import type { Address } from 'viem';
import { mainnet } from 'wagmi/chains';
import { getAddressLabel } from '@/utils/getAddressLabel';

export const WalletButtons = () => {
const { chains } = useChains();
Expand All @@ -39,17 +47,23 @@ export const WalletButtons = () => {
const { openWalletMenu } = useWalletMenu();
const { points, isLoading } = useLoyaltyPass(account?.address);
const router = useRouter();
const imgLink = useImageStatus(account?.address);
const imgLink = useWalletAddressImg(account?.address);
const isDesktop = useMediaQuery((theme: Theme) => theme.breakpoints.up('md'));
const pathname = usePathname();

const { openWalletMenu: _openWalletMenu, setWalletMenuState } = useMenuStore(
(state) => state,
);

const _walletDigest = useMemo(() => {
return walletDigest(account?.address);
}, [account?.address]);
const { data: ensName, isSuccess: isSuccessEnsName } = useEnsName({
address: account?.address as Address | undefined,
chainId: mainnet.id,
});
const addressLabel = getAddressLabel({
isSuccess: isSuccessEnsName,
ensName,
address: account?.address,
});

const activeChain = useMemo(
() => chains?.find((chainEl: Chain) => chainEl.id === account?.chainId),
Expand Down Expand Up @@ -90,7 +104,7 @@ export const WalletButtons = () => {
>
<ImageWalletMenuButton
src={imgLink}
alt="Effigy Wallet Icon"
alt={`${account?.address} wallet Icon`}
width={32}
height={32}
priority={false}
Expand All @@ -114,15 +128,7 @@ export const WalletButtons = () => {
<WalletMenuButton
id="wallet-digest-button"
onClick={handleWalletMenuClick}
sx={{
// delete with PromoLabel
overflow: 'visible',
position: 'relative',
}}
>
{/* when deleting PromoLabel, also clear related sx-styles in parent above */}
<PromoLabel component="span" variant="bodyXSmallStrong" />

{isSuccess && activeChain ? (
<WalletMgmtBadge
overlap="circular"
Expand All @@ -143,7 +149,7 @@ export const WalletButtons = () => {
</WalletMgmtBadge>
) : null}
<WalletLabel variant={'bodyMediumStrong'}>
{_walletDigest}
{addressLabel ?? walletDigest(account?.address)}
</WalletLabel>
</WalletMenuButton>
</Stack>
Expand Down
Loading
Loading