forked from solana-labs/explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port the Explorer from Create React App to Next 13 (w/ App Router)
- Loading branch information
1 parent
fa28f1a
commit 5577645
Showing
706 changed files
with
39,016 additions
and
95,987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": ["next/core-web-vitals", "@solana/eslint-config-solana"], | ||
"plugins": ["testing-library"], | ||
"overrides": [ | ||
// Only uses Testing Library lint rules in test files | ||
{ | ||
"files": ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"], | ||
"extends": ["plugin:testing-library/react"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
Build-And-Test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install package manager | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.2.0 | ||
|
||
- name: Setup Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build | ||
run: pnpm build | ||
|
||
- name: Test | ||
run: pnpm test:ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,41 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
|
||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
/wasm/target | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.eslintcache | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
#comment | ||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# Sentry Auth Token | ||
.sentryclirc | ||
|
||
# Speedy Web Compiler | ||
.swc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
auto-install-peers=true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/.pnpm/[email protected]/node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use client'; | ||
|
||
import { AnchorAccountCard } from '@components/account/AnchorAccountCard'; | ||
import { ParsedAccountRenderer } from '@components/account/ParsedAccountRenderer'; | ||
import { LoadingCard } from '@components/common/LoadingCard'; | ||
import { Suspense } from 'react'; | ||
import React from 'react'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
function AnchorAccountCardRenderer({ | ||
account, | ||
onNotFound, | ||
}: React.ComponentProps<React.ComponentProps<typeof ParsedAccountRenderer>['renderComponent']>) { | ||
if (!account) { | ||
return onNotFound(); | ||
} | ||
return ( | ||
<Suspense fallback={<LoadingCard message="Decoding account data using anchor interface" />}> | ||
<AnchorAccountCard account={account} /> | ||
</Suspense> | ||
); | ||
} | ||
|
||
export default function AnchorAccountPageClient({ params: { address } }: Props) { | ||
return <ParsedAccountRenderer address={address} renderComponent={AnchorAccountCardRenderer} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Metadata } from 'next/types'; | ||
|
||
import AnchorAccountPageClient from './page-client'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
export async function generateMetadata({ params: { address } }: Props): Promise<Metadata> { | ||
return { | ||
description: `Contents of the Anchor Account at address ${address} on Solana`, | ||
title: `Anchor Account Data | ${address} | Solana`, | ||
}; | ||
} | ||
|
||
export default function AnchorAccountPage(props: Props) { | ||
return <AnchorAccountPageClient {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { AnchorProgramCard } from '@components/account/AnchorProgramCard'; | ||
import { LoadingCard } from '@components/common/LoadingCard'; | ||
import { Metadata } from 'next/types'; | ||
import { Suspense } from 'react'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
export async function generateMetadata({ params: { address } }: Props): Promise<Metadata> { | ||
return { | ||
description: `The Interface Definition Language (IDL) file for the Anchor program at address ${address} on Solana`, | ||
title: `Anchor Program IDL | ${address} | Solana`, | ||
}; | ||
} | ||
|
||
export default function AnchorProgramIDLPage({ params: { address } }: Props) { | ||
return ( | ||
<Suspense fallback={<LoadingCard message="Loading anchor program IDL" />}> | ||
<AnchorProgramCard programId={address} /> | ||
</Suspense> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use client'; | ||
|
||
import { MetaplexNFTAttributesCard } from '@components/account/MetaplexNFTAttributesCard'; | ||
import { ParsedAccountRenderer } from '@components/account/ParsedAccountRenderer'; | ||
import React from 'react'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
function MetaplexNFTAttributesCardRenderer({ | ||
account, | ||
onNotFound, | ||
}: React.ComponentProps<React.ComponentProps<typeof ParsedAccountRenderer>['renderComponent']>) { | ||
const parsedData = account?.data?.parsed; | ||
if (!parsedData || parsedData.program !== 'spl-token' || parsedData.parsed.type !== 'mint' || !parsedData.nftData) { | ||
return onNotFound(); | ||
} | ||
return <MetaplexNFTAttributesCard nftData={parsedData.nftData} />; | ||
} | ||
|
||
export default function MetaplexNFTAttributesPageClient({ params: { address } }: Props) { | ||
return <ParsedAccountRenderer address={address} renderComponent={MetaplexNFTAttributesCardRenderer} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Metadata } from 'next/types'; | ||
|
||
import NFTAttributesPageClient from './page-client'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
export async function generateMetadata({ params: { address } }: Props): Promise<Metadata> { | ||
return { | ||
description: `Attributes of the Metaplex NFT with address ${address} on Solana`, | ||
title: `Metaplex NFT Attributes | ${address} | Solana`, | ||
}; | ||
} | ||
|
||
export default function MetaplexNFTAttributesPage(props: Props) { | ||
return <NFTAttributesPageClient {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use client'; | ||
|
||
import { BlockhashesCard } from '@components/account/BlockhashesCard'; | ||
import { ParsedAccountRenderer } from '@components/account/ParsedAccountRenderer'; | ||
import React from 'react'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
function BlockhashesCardRenderer({ | ||
account, | ||
onNotFound, | ||
}: React.ComponentProps<React.ComponentProps<typeof ParsedAccountRenderer>['renderComponent']>) { | ||
const parsedData = account?.data?.parsed; | ||
if (!parsedData || parsedData.program !== 'sysvar' || parsedData.parsed.type !== 'recentBlockhashes') { | ||
return onNotFound(); | ||
} | ||
return <BlockhashesCard blockhashes={parsedData.parsed.info} />; | ||
} | ||
|
||
export default function RecentBlockhashesPageClient({ params: { address } }: Props) { | ||
return <ParsedAccountRenderer address={address} renderComponent={BlockhashesCardRenderer} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import RecentBlockhashesPageClient from './page-client'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
export const metadata = { | ||
description: `Recent blockhashes on Solana`, | ||
title: `Recent Blockhashes | Solana`, | ||
}; | ||
|
||
export default function RecentBlockhashesPage(props: Props) { | ||
return <RecentBlockhashesPageClient {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { DomainsCard } from '@components/account/DomainsCard'; | ||
import { Metadata } from 'next/types'; | ||
|
||
type Props = Readonly<{ | ||
params: { | ||
address: string; | ||
}; | ||
}>; | ||
|
||
export async function generateMetadata({ params: { address } }: Props): Promise<Metadata> { | ||
return { | ||
description: `Domain names owned by the address ${address} on Solana`, | ||
title: `Domains | ${address} | Solana`, | ||
}; | ||
} | ||
|
||
export default function OwnedDomainsPage({ params: { address } }: Props) { | ||
return <DomainsCard address={address} />; | ||
} |
Oops, something went wrong.