-
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.
- Loading branch information
1 parent
93d7c26
commit 99c60ea
Showing
11 changed files
with
185 additions
and
38 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 +1,5 @@ | ||
{ | ||
"url": "https://ton-wasm-cyber-hackathon.netlify.app/", | ||
"name": "Cyber", | ||
"iconUrl": "https://ton-wasm-cyber-hackathon.netlify.app/logo.png" | ||
"iconUrl": "https://ton-wasm-cyber-hackathon.netlify.app/logo-black.png" | ||
} |
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
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
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
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,10 @@ | ||
.wrapper { | ||
display: grid; | ||
gap: 20px 20px; | ||
|
||
> div { | ||
display: flex; | ||
flex-direction: row-reverse; | ||
justify-content: space-between; | ||
} | ||
} |
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,55 @@ | ||
import Display from "@/components/common/containerGradient/Display/Display"; | ||
import DisplayTitle from "@/components/common/containerGradient/DisplayTitle/DisplayTitle"; | ||
import { useQueryClientPussy } from "@/queryClientPussy"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import React from "react"; | ||
import styles from "./Posts.module.scss"; | ||
|
||
function Posts({ publicKey }) { | ||
const client = useQueryClientPussy(); | ||
|
||
const { data, isLoading, error } = useQuery({ | ||
queryKey: ["posts", publicKey], | ||
refetchInterval: 10 * 1000, | ||
queryFn: async () => { | ||
return client!.queryContractSmart( | ||
"pussy15s8v0pa5g60uhvmjpfj73p6nem6t597e8qnkgpsuck5tje3se7ps3ll7kl", | ||
{ | ||
get_posts: { | ||
pubkey: publicKey, | ||
}, | ||
} | ||
); | ||
}, | ||
}); | ||
|
||
console.log(error); | ||
|
||
return ( | ||
<Display title={<DisplayTitle title="Your posts" />}> | ||
{isLoading && <div>Loading...</div>} | ||
|
||
{!data && !isLoading && <div>No data</div>} | ||
|
||
<div className={styles.wrapper}> | ||
{data?.map((post: any) => ( | ||
<div key={post.timestamp}> | ||
<div> | ||
{Intl.DateTimeFormat("en-US", { | ||
year: "numeric", | ||
month: "long", | ||
day: "2-digit", | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
}).format(post.timestamp * 1000)} | ||
</div> | ||
|
||
<p>{post.post}</p> | ||
</div> | ||
))} | ||
</div> | ||
</Display> | ||
); | ||
} | ||
|
||
export default Posts; |
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 React, { useContext } from "react"; | ||
import { CyberClient } from "@cybercongress/cyber-js"; | ||
import { Option } from "src/types"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
// import { RPC_URL } from 'src/constants/config'; | ||
|
||
const RPC_URL = "https://rpc.space-pussy.cybernode.ai"; | ||
|
||
const QueryClientContext = React.createContext<Option<CyberClient>>(undefined); | ||
|
||
export function useQueryClientPussy() { | ||
return useContext(QueryClientContext); | ||
} | ||
|
||
function QueryClientProvider({ children }: { children: React.ReactNode }) { | ||
const { data, error, isFetching } = useQuery({ | ||
queryKey: ["cyberClient", "connect"], | ||
queryFn: async () => { | ||
return CyberClient.connect(RPC_URL); | ||
}, | ||
}); | ||
|
||
if (isFetching) { | ||
// return null; | ||
} | ||
|
||
if (error) { | ||
console.error("Error queryClient connect: ", error.message); | ||
} | ||
|
||
console.log(data); | ||
|
||
return ( | ||
<QueryClientContext.Provider value={data}> | ||
{children} | ||
</QueryClientContext.Provider> | ||
); | ||
} | ||
|
||
export default QueryClientProvider; |