diff --git a/components/portfolio/Breakdown.tsx b/components/portfolio/Breakdown.tsx index a323321d0..0fb060dd2 100644 --- a/components/portfolio/Breakdown.tsx +++ b/components/portfolio/Breakdown.tsx @@ -113,13 +113,13 @@ export const BreakdownSlot = ({ }: BreakdownSlotProps) => { return ( <> -

{title}

-
-
+

{title}

+
+
{formatNumberLocalized(value.div(ZTG).toNumber())} ZTG
-
+
$ {formatNumberLocalized( usdZtgPrice?.mul(value.div(ZTG)).toNumber() ?? 0, diff --git a/components/portfolio/MarketPositionHeader.tsx b/components/portfolio/MarketPositionHeader.tsx index ed475d1a1..2bdc3bc3e 100644 --- a/components/portfolio/MarketPositionHeader.tsx +++ b/components/portfolio/MarketPositionHeader.tsx @@ -8,7 +8,7 @@ const MarketPositionHeader = ({ question?: string; }) => { return ( -

+

{question}

); diff --git a/components/portfolio/PortfolioIdentity.tsx b/components/portfolio/PortfolioIdentity.tsx index 56a4fb9d8..2914b10c7 100644 --- a/components/portfolio/PortfolioIdentity.tsx +++ b/components/portfolio/PortfolioIdentity.tsx @@ -37,22 +37,22 @@ const PortfolioIdentity = ({ address }: { address: string }) => { return ( <>
-
+
{address && }
-
+
{isOwned && !hasIdentity && ( -
+
wallet name
)} {isOwned && hasIdentity && ( -
+
on chain name
)} -
+
{name}{" "}
@@ -68,25 +68,30 @@ const PortfolioIdentity = ({ address }: { address: string }) => {
)}
-
{address}
+
+ {address} +
+
+ {shortenAddress(address, 12, 26)} +
-
+
{identity?.twitter && ( - {identity.twitter} + {identity.twitter} )} {identity?.discord && ( -
+
- {identity.discord} + {identity.discord}
)} { leaveTo="opacity-0" show={isProxying} > -
+
Your are acting proxy for this account.
diff --git a/components/ui/Table.tsx b/components/ui/Table.tsx index d6bd47db5..38178f0e9 100644 --- a/components/ui/Table.tsx +++ b/components/ui/Table.tsx @@ -125,13 +125,11 @@ const Cell = ({ isLoadingError: ztgIsLoadingError, } = useZtgPrice(); - const base = `dark:text-white px-ztg-15 h-ztg-72 ${ - onClick ? "cursor-pointer" : "" - }`; + const base = `dark:text-white px-4 h-16 ${onClick ? "cursor-pointer" : ""}`; const style = { height: `${rowHeight}px` }; const skeletonElement = ( @@ -149,7 +147,7 @@ const Cell = ({ case "text": return ( @@ -194,7 +192,7 @@ const Cell = ({ case "paragraph": return ( @@ -209,10 +207,10 @@ const Cell = ({ ) { return ( -
+
{formatNumberLocalized(value.value)}
-
+
$ {( value.usdValue ?? (ztgPrice?.toNumber() ?? 0) * value.value @@ -228,7 +226,7 @@ const Cell = ({
-
+
{typeof value === "string" ? value : ""}
@@ -239,10 +237,7 @@ const Cell = ({ return (
-
+
{value.label}
@@ -255,11 +250,11 @@ const Cell = ({
- + {value.label}
@@ -268,11 +263,7 @@ const Cell = ({ } case "percentage": return ( - + <>{value}% ); @@ -322,7 +313,7 @@ const Table = ({ }, [loadMoreRef, loadMoreInView, loadMoreThresholdIndex, data]); const getHeaderClass = (column: TableColumn) => { - const base = "px-ztg-15 text-[13px] text-left font-medium"; + const base = "px-4 text-xxs sm:text-xs text-left font-medium"; if (column.alignment) { return `${column.alignment} ${base}`; @@ -414,7 +405,7 @@ const Table = ({ } > - + {renderColumns.map((column, index) => ( ) : ( <> @@ -486,7 +477,7 @@ const Table = ({ : "" } ${rowColorClass} - ${onRowClick ? "cursor-pointer" : ""} mx-ztg-5`} + ${onRowClick ? "cursor-pointer" : ""} mx-1`} onClick={() => handleRowClick(row)} > {row.cells @@ -516,15 +507,13 @@ const Table = ({
{loadingMore && range(0, loadingNumber).map((index) => ( - + ))}
{!loadingMore && rows.length === 0 ? (
-
- {noDataMessage} -
+
{noDataMessage}
) : ( <> @@ -534,9 +523,9 @@ const Table = ({ {onPaginate ? : <>} {onLoadMore && !hideLoadMore && ( -
+
diff --git a/lib/util/index.ts b/lib/util/index.ts index ce2d44e37..7b68ac583 100644 --- a/lib/util/index.ts +++ b/lib/util/index.ts @@ -31,13 +31,12 @@ const hexChars = [ export const formatNumberLocalized = ( num: number | bigint, locale: string = "en-US", + maximumFractionDigits: number = 2, ) => { // Ensure displaying absolute zeros are unsigned(-), because javascript sucks sometimes. if (num === 0 || num === 0n) num = 0; - return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format( - num, - ); + return new Intl.NumberFormat(locale, { maximumFractionDigits }).format(num); }; export const isValidPolkadotAddress = (address: string) => { diff --git a/pages/portfolio/[address].tsx b/pages/portfolio/[address].tsx index d2f552152..4e5a148f4 100644 --- a/pages/portfolio/[address].tsx +++ b/pages/portfolio/[address].tsx @@ -12,7 +12,6 @@ import { MarketPositionsSkeleton, } from "components/portfolio/MarketPositions"; import PortfolioIdentity from "components/portfolio/PortfolioIdentity"; -import { Loader } from "components/ui/Loader"; import SubTabsList from "components/ui/SubTabsList"; import PortfolioLayout from "layouts/PortfolioLayout"; import { NextPageWithLayout } from "layouts/types"; @@ -20,9 +19,7 @@ import { usePortfolioPositions } from "lib/hooks/queries/usePortfolioPositions"; import { useZtgPrice } from "lib/hooks/queries/useZtgPrice"; import { useQueryParamState } from "lib/hooks/useQueryParamState"; import { useCrossChainApis } from "lib/state/cross-chain"; -import { useDelayQueue } from "lib/state/delay-queue"; import { isValidPolkadotAddress } from "lib/util"; -import { assetsAreEqual } from "lib/util/assets-are-equal"; import { groupBy, range } from "lodash-es"; import { useRouter } from "next/router"; import NotFoundPage from "pages/404"; @@ -90,7 +87,7 @@ const Portfolio: NextPageWithLayout = () => { return (
{address && } -
+
{ "Badges", "History", ].map((title, index) => ( - + {({ selected }) => (
{title}
@@ -134,10 +131,10 @@ const Portfolio: NextPageWithLayout = () => {
- + {!marketPositionsByMarket || !ztgPrice ? ( range(0, 8).map((i) => ( - + )) ) : Object.values(marketPositionsByMarket).length > 0 ? ( Object.values(marketPositionsByMarket).map( @@ -164,7 +161,7 @@ const Portfolio: NextPageWithLayout = () => { return ( diff --git a/tailwind.config.js b/tailwind.config.js index 4d2deacb2..56567fc4c 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -132,8 +132,8 @@ module.exports = { "0px 126px 50px rgba(0, 0, 0, 0.01), 0px 71px 43px rgba(0, 0, 0, 0.05), 0px 32px 32px rgba(0, 0, 0, 0.09), 0px 8px 17px rgba(0, 0, 0, 0.1), 0px 0px 0px rgba(0, 0, 0, 0.1);", }, fontSize: { + xxs: "0.625rem", "lg-2": ["1.375rem", "1.875rem"], - xxs: ["0.5625rem", "0.75rem"], "2.5xl": "1.75rem", // NEW