-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from allo-protocol/pool-detail
Pool detail page
- Loading branch information
Showing
32 changed files
with
1,038 additions
and
285 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 |
---|---|---|
|
@@ -33,4 +33,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
.spec/connect.toml | ||
.spec/connect.toml | ||
src/.env |
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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
"use client"; | ||
|
||
export default function GlobalError({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}) { | ||
return ( | ||
<html> | ||
<body> | ||
<h2>Something went wrong!</h2> | ||
<button onClick={() => reset()}>Try again</button> | ||
</body> | ||
</html> | ||
); | ||
} |
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,40 @@ | ||
import PoolDetailPage from "@/components/Pool/PoolDetail"; | ||
import { TPoolDetail } from "@/components/Pool/types"; | ||
import { getPoolDetailDataQuery } from "@/utils/query"; | ||
import { graphqlEndpoint } from "@/utils/utils"; | ||
import { request } from "graphql-request"; | ||
|
||
export default async function PoolDetail({ | ||
params, | ||
}: { | ||
params: { chain: string; id: string }; | ||
}) { | ||
|
||
const poolDetails: any = await request( | ||
graphqlEndpoint, | ||
getPoolDetailDataQuery, | ||
{ | ||
chainId: params.chain, | ||
poolId: params.id, | ||
}, | ||
); | ||
|
||
const { pool }: { pool: TPoolDetail } = poolDetails; | ||
|
||
let poolMetadata = "{}"; | ||
|
||
try { | ||
const response = await fetch( | ||
`https://ipfs.io/ipfs/${pool.metadataPointer}` | ||
); | ||
|
||
// Check if the response status is OK (200) | ||
if (response.ok) { | ||
poolMetadata = await response.text(); | ||
} | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
|
||
return <PoolDetailPage pool={pool} poolMetadata={poolMetadata} />; | ||
} |
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,30 @@ | ||
"use client"; // Error components must be Client Components | ||
|
||
import { useEffect } from "react"; | ||
|
||
export default function Error({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
useEffect(() => { | ||
// Log the error to an error reporting service | ||
console.error(error); | ||
}, [error]); | ||
|
||
return ( | ||
<div> | ||
<h2>Something went wrong!</h2> | ||
<button | ||
onClick={ | ||
// Attempt to recover by trying to re-render the segment | ||
() => reset() | ||
} | ||
> | ||
Try again | ||
</button> | ||
</div> | ||
); | ||
} |
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,6 +1,24 @@ | ||
"use client"; | ||
import { Loading } from "@/components/Loading"; | ||
import Pool from "@/components/Pool/Pool"; | ||
import { getPoolDataQuery } from "@/utils/query"; | ||
import { graphqlEndpoint } from "@/utils/utils"; | ||
import { request } from "graphql-request"; | ||
import { Suspense } from "react"; | ||
|
||
export default function PoolHome() { | ||
return <Pool />; | ||
export default async function PoolHome() { | ||
// FIXME: THE API DOES NOT RETURN THE STATUS | ||
|
||
const data: any = await request(graphqlEndpoint, getPoolDataQuery); | ||
const { pools } = data; | ||
|
||
return ( | ||
<Suspense fallback={<Loading />}> | ||
<Pool | ||
data={pools} | ||
header={"Pools"} | ||
description={"A list of all the pools in the registry on all supported networks"} | ||
/> | ||
</Suspense> | ||
); | ||
} | ||
1; |
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,38 @@ | ||
import ProfileDetail from "@/components/Registry/ProfileDetail"; | ||
import { TProfileDetails } from "@/components/Registry/types"; | ||
import { getProfileDetailDataQuery } from "@/utils/query"; | ||
import { graphqlEndpoint } from "@/utils/utils"; | ||
import request from "graphql-request"; | ||
|
||
export default async function ProfileDetailPage({ | ||
params, | ||
}: { | ||
params: { id: string, chain: number }; | ||
}) { | ||
const profileDetails: any = await request( | ||
graphqlEndpoint, | ||
getProfileDetailDataQuery, | ||
{ | ||
chainId: params.chain, | ||
profileId: params.id, | ||
}, | ||
); | ||
|
||
const profile: TProfileDetails = profileDetails.profile; | ||
|
||
const response = await fetch( | ||
`https://ipfs.io/ipfs/${profile.metadataPointer}`, | ||
); | ||
|
||
let metadata = ""; | ||
|
||
if (response.ok) { | ||
metadata = await response.text(); | ||
} | ||
|
||
return ( | ||
<div> | ||
<ProfileDetail profile={profile} metadata={metadata} /> | ||
</div> | ||
); | ||
} |
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,30 @@ | ||
"use client"; // Error components must be Client Components | ||
|
||
import { useEffect } from "react"; | ||
|
||
export default function Error({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error; | ||
reset: () => void; | ||
}) { | ||
useEffect(() => { | ||
// Log the error to an error reporting service | ||
console.error(error); | ||
}, [error]); | ||
|
||
return ( | ||
<div> | ||
<h2>Something went wrong!</h2> | ||
<button | ||
onClick={ | ||
// Attempt to recover by trying to re-render the segment | ||
() => reset() | ||
} | ||
> | ||
Try again | ||
</button> | ||
</div> | ||
); | ||
} |
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,6 +1,18 @@ | ||
"use client"; | ||
import { Loading } from "@/components/Loading"; | ||
import Profile from "@/components/Registry/Profile"; | ||
import { getProfileDataQuery } from "@/utils/query"; | ||
import { graphqlEndpoint } from "@/utils/utils"; | ||
import { request } from "graphql-request"; | ||
import { Suspense } from "react"; | ||
|
||
export default function ProfileHome() { | ||
return <Profile />; | ||
export default async function ProfileHome() { | ||
|
||
const data: any = await request(graphqlEndpoint, getProfileDataQuery); | ||
const { profiles } = data; | ||
|
||
return ( | ||
<Suspense fallback={<Loading />}> | ||
<Profile data={profiles} /> | ||
</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
Oops, something went wrong.