Skip to content

Commit

Permalink
Merge pull request #639 from ar-io/PE-7365-rnp-page
Browse files Browse the repository at this point in the history
feat(PE-7365): rnp page
  • Loading branch information
atticusofsparta authored Jan 9, 2025
2 parents 1fa5f8d + 63b4070 commit e9591f0
Show file tree
Hide file tree
Showing 11 changed files with 625 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@permaweb/aoconnect": "^0.0.59",
"@radix-ui/react-radio-group": "^1.2.1",
"@radix-ui/react-select": "^2.1.4",
"@radix-ui/react-switch": "^1.1.2",
"@sentry/react": "^7.45.0",
"@tanstack/react-query": "^5.51.21",
"@tanstack/react-query-persist-client": "^5.45.1",
Expand Down
14 changes: 14 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const SettingsLayout = React.lazy(
() => import('./components/pages/Settings/SettingsLayout'),
);

const RNPPage = React.lazy(() => import('./components/pages/RNPPage/RNPPage'));

const sentryCreateBrowserRouter =
Sentry.wrapCreateBrowserRouter(createHashRouter);

Expand Down Expand Up @@ -323,6 +325,18 @@ function App() {
</Suspense>
}
/>
<Route
path="/returned-names"
element={
<Suspense
fallback={
<PageLoader loading={true} message={'Loading, please wait'} />
}
>
<RNPPage />
</Suspense>
}
/>
</Route>
<Route
path="settings"
Expand Down
13 changes: 11 additions & 2 deletions src/components/data-display/charts/RNPChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AoGetCostDetailsParams, mARIOToken } from '@ar.io/sdk';
import { useCostDetails } from '@src/hooks/useCostDetails';
import { useGlobalState, useWalletState } from '@src/state';
import { formatARIOWithCommas, formatDateMDY } from '@src/utils';
import Lottie from 'lottie-react';
import { useEffect, useRef, useState } from 'react';
import {
Line,
Expand All @@ -14,14 +15,16 @@ import {
import { CategoricalChartState } from 'recharts/types/chart/types';
import { Coordinate } from 'recharts/types/util/types';

import arioLoading from '../../icons/ario-spinner.json';

const START_RNP_PREMIUM = 50;

export function RNPChart({
name,
purchaseDetails,
}: {
name: string;
purchaseDetails?: AoGetCostDetailsParams;
purchaseDetails?: Partial<AoGetCostDetailsParams>;
}) {
const [{ walletAddress }] = useWalletState();
const { data: costDetails } = useCostDetails({
Expand Down Expand Up @@ -180,7 +183,13 @@ export function RNPChart({
return <></>;
};

if (!chartData.length) return <></>;
if (!chartData?.length)
return (
<span className="h-fit flex flex-col text-white w-full items-center p-5 justify-center m-auto">
<Lottie animationData={arioLoading} loop={true} className="h-[100px]" />
<span>Loading Price Chart...</span>
</span>
);

if (!costDetails?.returnedNameDetails) return <></>;

Expand Down
Loading

0 comments on commit e9591f0

Please sign in to comment.