Skip to content

Commit 523df77

Browse files
authored
Merge pull request #516 from elizaOS/develop
ship
2 parents d322f50 + c4a5880 commit 523df77

File tree

5 files changed

+49
-9
lines changed

5 files changed

+49
-9
lines changed

packages/client/src/components/grid-view.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ export const GridItem = ({ token }: { token: IToken }) => {
2828
<div className="absolute left-0 bottom-0 p-2 px-3 w-full z-10">
2929
<div className="flex items-center gap-4 justify-between">
3030
<div className="flex items-center gap-2 w-full min-w-0">
31-
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-primary text-lg font-bold font-dm-mono uppercase leading-normal tracking-widest truncate min-w-0 drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
31+
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-primary text-base md:text-md xl:text-xl font-bold font-dm-mono uppercase leading-normal tracking-widest truncate min-w-0 drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
3232
${token.ticker}
3333
</div>
3434
<Verified isVerified={token?.verified ? true : false} />
3535
</div>
36-
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-primary text-lg shrink-0 font-medium font-dm-mono drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
36+
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-primary text-base md:text-lg xl:text-xl font-medium shrink-0 font-dm-mono drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
3737
{fromNow(token.createdAt, true)}
3838
</div>
3939
</div>
4040
</div>
4141
<div className="flex flex-col w-full min-w-0 z-10">
4242
<div className="absolute flex flex-col top-0 right-0 p-2 px-3 items-end min-w-0 gap-2">
43-
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-highlight text-xl font-medium font-dm-mono leading-7 truncate drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
43+
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-highlight text-base md:text-lg xl:text-xl font-medium font-dm-mono leading-7 truncate drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
4444
MC {abbreviateNumber(token.marketCapUSD)}
4545
</div>
46-
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-primary text-xl font-medium font-dm-mono leading-7 truncate drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
46+
<div className="bg-autofun-background-muted/65 px-1 text-autofun-text-primary text-base md:text-lg xl:text-xl font-medium font-dm-mono leading-7 truncate drop-shadow-[0_0px_2px_rgba(0,0,0,0.4)] z-[2]">
4747
Vol {abbreviateNumber(token.volume24h)}
4848
</div>
4949
</div>

packages/client/src/components/swaps-table.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import usePause from "@/hooks/use-pause";
1010
import { IToken } from "@/types";
1111
import {
1212
formatNumber,
13-
formatNumberSubscript,
13+
formatNumberSubscriptSmart,
1414
fromNow,
1515
LAMPORTS_PER_SOL,
1616
resizeImage,
@@ -162,8 +162,7 @@ export default function SwapsTable({ token }: { token: IToken }) {
162162
className="size-2.5 rounded-full"
163163
/>
164164
<span className="text-sm">
165-
{formatNumberSubscript(Number(solana), 2)}
166-
{/* {formatNumber(solana, true, true)} */}
165+
{formatNumberSubscriptSmart(Number(solana), 2)}
167166
</span>
168167
{usdValue ? (
169168
<span className="text-autofun-text-secondary text-xs">

packages/client/src/components/verified.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ export default function Verified({ isVerified }: { isVerified?: boolean }) {
99
<span>Verified</span>
1010
</Tooltip>
1111

12-
<img src="/verified.svg" id="verified" className="size-5 select-none" />
12+
<img
13+
src="/verified.svg"
14+
id="verified"
15+
className="size-4 lg:size-5 select-none"
16+
/>
1317
</Fragment>
1418
);
1519
}

packages/client/src/utils/index.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,43 @@ export const formatNumberSubscript = (
138138
}
139139
};
140140

141+
export const formatNumberSubscriptSmart = (
142+
num: number,
143+
decimals: number = 4,
144+
): string => {
145+
if (num === 0) return "0";
146+
let sign = "";
147+
if (num < 0) {
148+
sign = "-";
149+
num = Math.abs(num);
150+
}
151+
152+
if (num >= 1) {
153+
return sign + num.toFixed(decimals).toString();
154+
}
155+
156+
const expStr = num.toExponential();
157+
const [mantissa, exponentStr] = expStr.split("e");
158+
const exponent = parseInt(exponentStr, 10);
159+
let totalZeros = -exponent - 1;
160+
161+
if (totalZeros < 0) {
162+
totalZeros = 0;
163+
}
164+
165+
if (totalZeros >= decimals) {
166+
const mantissaDigits = mantissa.replace(".", "").slice(0, decimals + 1);
167+
return sign + "0." + toSubscript(totalZeros) + mantissaDigits;
168+
} else {
169+
const roundedMantissa =
170+
Math.ceil(Number(mantissa) * 10 ** decimals) / 10 ** decimals;
171+
const roundedString = roundedMantissa.toFixed(decimals);
172+
const mantissaDigits = roundedString.replace(".", "").slice(0, decimals);
173+
174+
return sign + "0." + "0".repeat(totalZeros) + mantissaDigits;
175+
}
176+
};
177+
141178
export const isFromDomain = (url: string, domain: string): boolean => {
142179
// if url does not have http or https, add it
143180
if (!url.startsWith("http") && !url.startsWith("https")) {

packages/server/src/routes/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ tokenRouter.get("/tokens", async (c) => {
13191319
// Define the two token addresses to prioritize
13201320
const priorityTokenAddresses: string[] = [
13211321
"8btUuvx2Bu4zTd8g1tN5wCKMULyPgqiPaDiJbFbWkFUN",
1322-
"D7qqKEr7JFpAd82m9nvJL2psdPmU1oW54g1LHvDUYFAN",
1322+
"CdZuiJEgdwQVZBWZrd6MvYwZshsT5HvB6tJYAjzuUTAP",
13231323
"HN8GGgzBFvuePPL3DGPg7uuq2dVgLApnNcW4pxY9a11o",
13241324
"J3NrhzUeKBSA3tJQjNq77zqpWJNz3FS9TrX7H7SLKcom",
13251325
];

0 commit comments

Comments
 (0)