Skip to content

Commit 676ee6c

Browse files
authored
Merge pull request #2509 from pyth-network/cprussin/ui-50-fix-loading-jankiness
wip: add nextjs loading state
2 parents b587b87 + 95eaca7 commit 676ee6c

File tree

95 files changed

+3755
-3126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3755
-3126
lines changed

apps/insights/next.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ const config = {
33

44
pageExtensions: ["ts", "tsx", "mdx"],
55

6+
experimental: {
7+
useCache: true,
8+
},
9+
610
logging: {
711
fetches: {
812
fullUrl: true,

apps/insights/src/app/layout.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
export { Root as default } from "../components/Root";
22
export { metadata, viewport } from "../metadata";
3-
4-
export const dynamic = "error";
5-
export const revalidate = 3600;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { ChartPageLoading as default } from "../../../../components/PriceFeed/chart-page";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { ChartPage as default } from "../../../../components/PriceFeed/chart-page";
2+
3+
export const revalidate = 3600;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { FeedCountBadge as default } from "../../../../components/PriceFeed/feed-count-badge";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { PriceFeedHeader as default } from "../../../../components/PriceFeed/header";

apps/insights/src/app/price-feeds/[slug]/layout.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import type { Metadata } from "next";
22
import { notFound } from "next/navigation";
3+
import type { ReactNode } from "react";
34

45
import { Cluster, getFeeds } from "../../../services/pyth";
56

67
export { PriceFeedLayout as default } from "../../../components/PriceFeed/layout";
78

89
type Props = {
10+
feedCountBadge: ReactNode;
11+
header: ReactNode;
912
params: Promise<{
1013
slug: string;
1114
}>;
@@ -29,5 +32,4 @@ export const generateMetadata = async ({
2932
: notFound();
3033
};
3134

32-
export const dynamic = "error";
3335
export const revalidate = 3600;

apps/insights/src/app/price-feeds/[slug]/page.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { PublishersLoading as default } from "../../../../components/PriceFeed/publishers";
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export { Publishers as default } from "../../../../components/PriceFeed/publishers";
22

3-
export const dynamic = "error";
43
export const revalidate = 3600;

apps/insights/src/app/price-feeds/layout.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
import type { Metadata } from "next";
2+
13
export { PriceFeeds as default } from "../../components/PriceFeeds";
24

3-
export const dynamic = "error";
45
export const revalidate = 3600;
6+
7+
export const metadata: Metadata = {
8+
title: {
9+
default: "Price Feeds",
10+
template: "%s | Price Feeds | Pyth Network Insights",
11+
},
12+
description: "Explore market data on the Pyth network.",
13+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { PerformanceLoading as default } from "../../../../../components/Publisher/performance";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { Performance as default } from "../../../../../components/Publisher/performance";
2+
3+
export const revalidate = 3600;

apps/insights/src/app/publishers/[cluster]/[key]/layout.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { lookup } from "@pythnetwork/known-publishers";
22
import type { Metadata } from "next";
33

4-
export { PublishersLayout as default } from "../../../../components/Publisher/layout";
4+
export { PublisherLayout as default } from "../../../../components/Publisher/layout";
55

66
type Props = {
77
params: Promise<{
@@ -22,5 +22,4 @@ export const generateMetadata = async ({
2222
};
2323
};
2424

25-
export const dynamic = "error";
2625
export const revalidate = 3600;

apps/insights/src/app/publishers/[cluster]/[key]/page.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { PriceFeedsLoading as default } from "../../../../../components/Publisher/price-feeds";
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export { PriceFeeds as default } from "../../../../../components/Publisher/price-feeds";
22

3-
export const dynamic = "error";
43
export const revalidate = 3600;

apps/insights/src/app/publishers/layout.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
import type { Metadata } from "next";
12
export { Publishers as default } from "../../components/Publishers";
23

3-
export const dynamic = "error";
44
export const revalidate = 3600;
5+
6+
export const metadata: Metadata = {
7+
title: {
8+
default: "Publishers",
9+
template: "%s | Publishers | Pyth Network Insights",
10+
},
11+
description: "Explore publishers who contribute to the Pyth network.",
12+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Badge } from "@pythnetwork/component-library/Badge";
2+
import type { ComponentProps } from "react";
3+
4+
type Props = Omit<ComponentProps<typeof Badge>, "children"> & {
5+
children: string;
6+
};
7+
8+
export const AssetClassBadge = ({ children, ...props }: Props) => (
9+
<Badge variant="neutral" style="outline" size="xs" {...props}>
10+
{children.toUpperCase()}
11+
</Badge>
12+
);

apps/insights/src/components/AssetClassTag/index.tsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

apps/insights/src/components/EntityList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const EntityList = <T extends string>({
5555
{...props}
5656
>
5757
{isLoading ? (
58-
<GridListItem className={styles.entityItem ?? ""}>
58+
<GridListItem className={styles.entityItem ?? ""} textValue="Loading">
5959
<div className={styles.itemHeader}>{headerLoadingSkeleton}</div>
6060
<dl className={styles.itemDetails}>
6161
{fields.map((field) => (
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Info } from "@phosphor-icons/react/dist/ssr/Info";
22
import { Lightbulb } from "@phosphor-icons/react/dist/ssr/Lightbulb";
3-
import { Alert, AlertTrigger } from "@pythnetwork/component-library/Alert";
43
import { Button } from "@pythnetwork/component-library/Button";
54
import type { ComponentProps, ReactNode } from "react";
65

@@ -14,24 +13,21 @@ type Props = {
1413

1514
export const Explain = ({ size, title, children }: Props) => (
1615
<div className={styles.explain}>
17-
<AlertTrigger>
18-
<Button
19-
className={styles.trigger ?? ""}
20-
variant="ghost"
21-
size={size}
22-
beforeIcon={(props) => <Info weight="fill" {...props} />}
23-
rounded
24-
hideText
25-
>
26-
Explain {title}
27-
</Button>
28-
<Alert
29-
title={title}
30-
icon={<Lightbulb />}
31-
bodyClassName={styles.description}
32-
>
33-
{children}
34-
</Alert>
35-
</AlertTrigger>
16+
<Button
17+
className={styles.trigger ?? ""}
18+
variant="ghost"
19+
size={size}
20+
beforeIcon={(props) => <Info weight="fill" {...props} />}
21+
rounded
22+
hideText
23+
alert={{
24+
title,
25+
icon: <Lightbulb />,
26+
bodyClassName: styles.description,
27+
contents: children,
28+
}}
29+
>
30+
Explain {title}
31+
</Button>
3632
</div>
3733
);

apps/insights/src/components/LayoutTransition/index.tsx

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)