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

Yana/pending staking events #5400

Merged
merged 86 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
1b770bf
Add pending events to stake table
yanok87 Jan 27, 2025
c8510dc
Add additional tanstack refetch on user stake/unstake/redeem rewards
yanok87 Jan 29, 2025
cb66685
refactor repeated fetch functions
yanok87 Jan 30, 2025
19f394d
clean up fetching functions
yanok87 Jan 30, 2025
be5b277
refactor & clean up
yanok87 Jan 30, 2025
2ecf00f
Add epoch waiting message on epoch change delay
yanok87 Jan 30, 2025
15a66ea
fine tune epoch change
yanok87 Jan 30, 2025
81791a9
clean up
yanok87 Jan 30, 2025
53b9be5
refactor imports
yanok87 Jan 30, 2025
33ea65e
Add transaction hash to successful redeem rewards InfoModal
yanok87 Jan 30, 2025
6cd6557
fix epoch time check and mobile header
yanok87 Jan 30, 2025
0cb2c12
Fix Loading modal width on mobile
yanok87 Jan 30, 2025
0abef84
fix epoch logic
yanok87 Jan 30, 2025
18248a0
clean up
yanok87 Jan 30, 2025
55b651b
clean up logs
yanok87 Jan 30, 2025
219c1e7
add waiting for epoch to start to landing page
yanok87 Jan 31, 2025
7a669b1
clean up
yanok87 Jan 31, 2025
25976c5
Add refetch of all queries on epoch change
yanok87 Feb 1, 2025
5ea8a80
Finalise state change on epoch change
yanok87 Feb 3, 2025
67d1a54
clean up
yanok87 Feb 3, 2025
352fd12
fix build
yanok87 Feb 3, 2025
6c08eb0
Fix NodesTable mobile view
yanok87 Feb 1, 2025
00f1c74
Merge pull request #5421 from nymtech/yana/nodes-table-mobile-fix
yanok87 Feb 3, 2025
a97b5fd
Fix stake table mobile view
yanok87 Feb 3, 2025
b9b7a92
fix typo
yanok87 Feb 3, 2025
3379b28
Fix blog articles height
yanok87 Feb 3, 2025
657c96d
Add loading skeletons to landing page cards
yanok87 Feb 3, 2025
2ab1458
clean up
yanok87 Feb 3, 2025
fdbfacb
Add skeletons to cards
yanok87 Feb 4, 2025
d7cc80d
Add skeletons, and loading/error refetch on wallet balnce
yanok87 Feb 4, 2025
c5a9c76
clean up
yanok87 Feb 4, 2025
501d47f
Add active stakers card
yanok87 Feb 4, 2025
4a83324
clean up
yanok87 Feb 4, 2025
df7a61b
change NGM to mixnet
yanok87 Feb 4, 2025
9cfcca0
Add TVL to Tokenomics card
yanok87 Feb 4, 2025
0a48c2a
Add last total stake to Stake Card
yanok87 Feb 4, 2025
6e94a7a
clean up
yanok87 Feb 4, 2025
f964a69
Fix stake sorting function in Stake Table
yanok87 Feb 4, 2025
bbf8231
Add wrap of identity key and address to Basic Info Card
yanok87 Feb 4, 2025
19c7128
Add counter to epoch time on staking page
yanok87 Feb 4, 2025
cbf1009
clean up
yanok87 Feb 4, 2025
4fe87b5
update epoch labels
yanok87 Feb 4, 2025
50ea133
Add circular loading on Toggle Button
yanok87 Feb 4, 2025
e7efec6
Update Toggle button loading functionality
yanok87 Feb 4, 2025
f27b7a7
Add skeletons to account cards
yanok87 Feb 4, 2025
7c2ad88
Add search functionality on Enter
yanok87 Feb 4, 2025
a9b7be8
clean up
yanok87 Feb 4, 2025
f1008e4
DOMpurify node name and description
yanok87 Feb 5, 2025
0bf6cfd
Add column with id and identity key, wrap names to 2 lines
yanok87 Feb 5, 2025
a23404f
Set width of column headers to 110px
yanok87 Feb 5, 2025
076fc28
fix pending events for delegations
yanok87 Feb 5, 2025
e550b4e
Fix Stake button proppagation
yanok87 Feb 5, 2025
23b730f
Add full country name to tooltips
yanok87 Feb 5, 2025
a61d360
Take out connect wallet from mobile menu toggle
yanok87 Feb 5, 2025
57d8226
finetune epoch change intervals
yanok87 Feb 5, 2025
a11b975
Add error text to Magic Search
yanok87 Feb 5, 2025
79ab898
fix build
yanok87 Feb 5, 2025
bd102a6
Add react-markdown for Blog articles
yanok87 Feb 5, 2025
513b9ed
fix graph's width and Table column headings
yanok87 Feb 6, 2025
26f61ba
fix Magic Search loading
yanok87 Feb 6, 2025
fc58246
Fix grid on account page
yanok87 Feb 6, 2025
53f4ff6
fix account card address width
yanok87 Feb 6, 2025
b5d765c
Fix permanent loading spinner on ToggleButton
yanok87 Feb 7, 2025
c8e4c06
clean up URL's, fix copy address on the Basic Card
yanok87 Feb 7, 2025
321e8d5
replace mintscan with ping, open tx link on new page
yanok87 Feb 7, 2025
c937b95
Take out toggle button if no node bonded by address
yanok87 Feb 7, 2025
aa36e77
Set fixed column width on tables
yanok87 Feb 7, 2025
4c26b98
Add not-found page to account, when no node bonded
yanok87 Feb 9, 2025
1dc9d56
Add full country name to tables and node profile card
yanok87 Feb 9, 2025
82eda41
clean up
yanok87 Feb 9, 2025
3c5fa83
Table fixes
yanok87 Feb 9, 2025
8d326fd
Fix sorting in Delegations table Node page
yanok87 Feb 9, 2025
3adae8a
clean up
yanok87 Feb 9, 2025
415d612
Fix line chart view
yanok87 Feb 9, 2025
4cbd5e5
refactor epoch progress bar
fmtabbara Feb 10, 2025
5174b89
remove unused imports
fmtabbara Feb 10, 2025
476a096
remove tanstack delclaration module
fmtabbara Feb 11, 2025
aec6479
create epoch data provider
fmtabbara Feb 11, 2025
120ad25
remove logic from togglebutton component
fmtabbara Feb 11, 2025
f0ba9ce
use epoch provider in components
fmtabbara Feb 11, 2025
f491cb6
invalidateQueries should be awaited
fmtabbara Feb 11, 2025
76188c3
tidy-ups
fmtabbara Feb 11, 2025
b078cb4
fix components
fmtabbara Feb 11, 2025
ca8fbd4
fix component
fmtabbara Feb 12, 2025
6666f20
tidy up QualityIndicatorsCard component formatting
fmtabbara Feb 12, 2025
f5d689d
fix infinite loop in epoch provider
yanok87 Feb 12, 2025
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
3 changes: 3 additions & 0 deletions explorer-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@
"@nymproject/react": "1.0.0",
"@tanstack/react-query": "^5.64.2",
"@tanstack/react-query-devtools": "^5.64.2",
"@tanstack/react-query-next-experimental": "^5.66.0",
"@tanstack/react-table": "^8.20.6",
"@uidotdev/usehooks": "^2.4.1",
"chain-registry": "^1.69.64",
"cldr-compact-number": "^0.4.0",
"date-fns": "^4.1.0",
"isomorphic-dompurify": "^2.21.0",
"material-react-table": "^3.0.3",
"next": "15.0.3",
"qrcode.react": "^4.1.0",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"react-markdown": "^9.0.3",
"react-random-avatars": "^1.3.1",
"react-world-flags": "^1.6.0",
"zod": "^3.24.1"
Expand Down
15 changes: 0 additions & 15 deletions explorer-nextjs/src/actions/getNymNodes.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import BlogArticlesCards from "@/components/blogs/BlogArticleCards";
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import ExplorerButtonGroup from "@/components/toggleButton/ToggleButton";
import { Box, Typography } from "@mui/material";
import Grid from "@mui/material/Grid2";

export default async function Account({
params,
}: {
params: Promise<{ address: string }>;
}) {
try {
const address = (await params).address;

return (
<ContentLayout>
<Grid container columnSpacing={5} rowSpacing={5}>
<Grid size={12}>
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
<SectionHeading title="Nym Node Details" />
<ExplorerButtonGroup
options={[
{
label: "Nym Node",
isSelected: true,
link: `/account/${address}/not-found/`,
},
{
label: "Account",
isSelected: false,
link: `/account/${address}`,
},
]}
/>
</Box>
</Grid>
</Grid>
<Typography variant="h5">
Is this your accont? Set up your node!
</Typography>
<Grid container columnSpacing={5} rowSpacing={5}>
<Grid size={12}>
<SectionHeading title="Onboarding" />
</Grid>
<BlogArticlesCards limit={4} />
</Grid>
</ContentLayout>
);
} catch (error) {
let errorMessage = "An error occurred";
if (error instanceof Error) {
errorMessage = error.message;
}
throw new Error(errorMessage);
}
}
77 changes: 16 additions & 61 deletions explorer-nextjs/src/app/(pages)/account/[address]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,34 @@
import type { IAccountBalancesInfo, NymTokenomics } from "@/app/api/types";
import type NodeData from "@/app/api/types";
import { NYM_ACCOUNT_ADDRESS, NYM_NODES, NYM_PRICES_API } from "@/app/api/urls";
import { AccountBalancesCard } from "@/components/accountPageComponents/AccountBalancesCard";
import { AccountInfoCard } from "@/components/accountPageComponents/AccountInfoCard";
import BlogArticlesCards from "@/components/blogs/BlogArticleCards";
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import ExplorerButtonGroup from "@/components/toggleButton/ToggleButton";
import { fetchNodes } from "@/app/api";
import type { NodeData } from "@/app/api/types";
import { Box, Typography } from "@mui/material";
import Grid from "@mui/material/Grid2";
import { AccountBalancesCard } from "../../../../components/accountPageComponents/AccountBalancesCard";
import { AccountInfoCard } from "../../../../components/accountPageComponents/AccountInfoCard";
import { ContentLayout } from "../../../../components/contentLayout/ContentLayout";
import SectionHeading from "../../../../components/headings/SectionHeading";
import ExplorerButtonGroup from "../../../../components/toggleButton/ToggleButton";

export default async function Account({
Comment on lines +5 to 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use the @ import alias for imports. It's a bit neater.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason I've started having import red errors with "@/...", have refactored to this to get rid of the errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the errors?

params,
}: {
params: Promise<{ address: string }>;
}) {
try {
const { address } = await params;
const address = (await params).address;

const accountData = await fetch(`${NYM_ACCOUNT_ADDRESS}${address}`, {
headers: {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
},
next: { revalidate: 60 },
// refresh event list cache at given interval
});

const response = await fetch(NYM_NODES, {
headers: {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
},
next: { revalidate: 60 },
// refresh event list cache at given interval
});

const nymNodes: NodeData[] = await response.json();
const nymNodes: NodeData[] = await fetchNodes();

const nymNode = nymNodes.find(
(node) => node.bond_information.owner === address,
);

const nymAccountBalancesData: IAccountBalancesInfo =
await accountData.json();

if (!nymAccountBalancesData) {
return <Typography>Account not found</Typography>;
}

const nymPrice = await fetch(NYM_PRICES_API, {
headers: {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
},
next: { revalidate: 60 },
// refresh event list cache at given interval
});

const nymPriceData: NymTokenomics = await nymPrice.json();

return (
<ContentLayout>
<Grid container columnSpacing={5} rowSpacing={5}>
<Grid size={6}>
<SectionHeading title="Account Details" />
</Grid>

<Grid size={6} justifyContent="flex-end">
<Box sx={{ display: "flex", justifyContent: "end" }}>
<ExplorerButtonGroup
Expand All @@ -75,7 +38,7 @@ export default async function Account({
isSelected: false,
link: nymNode
? `/nym-node/${nymNode.node_id}`
: "/nym-node/not-found",
: `/account/${address}/not-found`,
},
{
label: "Account",
Expand All @@ -86,21 +49,13 @@ export default async function Account({
/>
</Box>
</Grid>
<Grid size={4}>
<AccountInfoCard accountInfo={nymAccountBalancesData} />
</Grid>
<Grid size={8}>
<AccountBalancesCard
accountInfo={nymAccountBalancesData}
nymPrice={nymPriceData.quotes.USD.price}
/>

<Grid size={{ xs: 12, md: 4 }}>
<AccountInfoCard address={address} />
</Grid>
</Grid>
<Grid container columnSpacing={5} rowSpacing={5}>
<Grid size={12}>
<SectionHeading title="Onboarding" />
<Grid size={{ xs: 12, md: 8 }}>
<AccountBalancesCard address={address} />
</Grid>
<BlogArticlesCards limit={4} />
</Grid>
</ContentLayout>
);
Expand Down
7 changes: 3 additions & 4 deletions explorer-nextjs/src/app/(pages)/explorer/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import BlogArticlesCards from "@/components/blogs/BlogArticleCards";
import CardSkeleton from "@/components/cards/Skeleton";
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import NodeTableWithAction from "@/components/nodeTable/NodeTableWithAction";
import { Wrapper } from "@/components/wrapper";
import { Box } from "@mui/material";
import Grid from "@mui/material/Grid2";
import { Suspense } from "react";

export default function ExplorerPage() {
return (
<ContentLayout>
<Wrapper>
<SectionHeading title="Explorer" />
<Suspense fallback={<CardSkeleton sx={{ mt: 5 }} />}>
<Box sx={{ mt: 5 }}>
<NodeTableWithAction />
</Suspense>
</Box>
<Grid container columnSpacing={5} rowSpacing={5} mt={10}>
<Grid size={12}>
<SectionHeading title="Onboarding" />
Expand Down
30 changes: 2 additions & 28 deletions explorer-nextjs/src/app/(pages)/nym-node/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { IObservatoryNode } from "@/app/api/types";
import { DATA_OBSERVATORY_NODES_URL } from "@/app/api/urls";
import BlogArticlesCards from "@/components/blogs/BlogArticleCards";
import { fetchNodeInfo } from "@/app/api";
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import { BasicInfoCard } from "@/components/nymNodePageComponents/BasicInfoCard";
Expand All @@ -22,25 +20,7 @@ export default async function NymNode({
try {
const id = Number((await params).id);

const observatoryResponse = await fetch(DATA_OBSERVATORY_NODES_URL, {
headers: {
Accept: "application/json",
"Content-Type": "application/json; charset=utf-8",
},
next: { revalidate: 60 },
// refresh event list cache at given interval
});

const observatoryNymNodes: IObservatoryNode[] =
await observatoryResponse.json();

if (!observatoryNymNodes) {
return null;
}

const observatoryNymNode = observatoryNymNodes.find(
(node) => node.node_id === id,
);
const observatoryNymNode = await fetchNodeInfo(id);

if (!observatoryNymNode) {
return null;
Expand Down Expand Up @@ -126,12 +106,6 @@ export default async function NymNode({
<NodeChatCard />
</Grid>
</Grid>
<Grid container columnSpacing={5} rowSpacing={5}>
<Grid size={12}>
<SectionHeading title="Onboarding" />
</Grid>
<BlogArticlesCards limit={4} />
</Grid>
</ContentLayout>
);
} catch (error) {
Expand Down
14 changes: 0 additions & 14 deletions explorer-nextjs/src/app/(pages)/nym-node/not-found/page.tsx

This file was deleted.

3 changes: 2 additions & 1 deletion explorer-nextjs/src/app/(pages)/onboarding/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Box, Stack, Typography } from "@mui/material";
import Grid from "@mui/material/Grid2";
import { format } from "date-fns";
import Image from "next/image";
import Markdown from "react-markdown";

export default async function BlogPage({
params,
Expand Down Expand Up @@ -104,7 +105,7 @@ export default async function BlogPage({
<SectionHeading title={section.heading} />
{section.text.map(({ text }) => (
<Typography key={text} variant="body2" sx={{ mt: 3 }}>
{text}
<Markdown>{text}</Markdown>
</Typography>
))}
</Box>
Expand Down
10 changes: 5 additions & 5 deletions explorer-nextjs/src/app/(pages)/stake/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ContentLayout } from "@/components/contentLayout/ContentLayout";
import SectionHeading from "@/components/headings/SectionHeading";
import OverviewCards from "@/components/staking/OverviewCards";
import StakeTableWithAction from "@/components/staking/StakeTableWithAction";
import SubHeaderRow from "@/components/staking/SubHeaderRow";
import { ContentLayout } from "../../../components/contentLayout/ContentLayout";
import SectionHeading from "../../../components/headings/SectionHeading";
import OverviewCards from "../../../components/staking/OverviewCards";
import StakeTableWithAction from "../../../components/staking/StakeTableWithAction";
import SubHeaderRow from "../../../components/staking/SubHeaderRow";

export default async function StakingPage() {
return (
Expand Down
Loading
Loading