diff --git a/.changeset/lazy-birds-wait.md b/.changeset/lazy-birds-wait.md new file mode 100644 index 00000000..48fd9890 --- /dev/null +++ b/.changeset/lazy-birds-wait.md @@ -0,0 +1,6 @@ +--- +"create-hypergraph": patch +--- + +improve geo connect box based on authentication state in all templates + \ No newline at end of file diff --git a/apps/template-nextjs/app/page.tsx b/apps/template-nextjs/app/page.tsx index f274e546..0490ee16 100644 --- a/apps/template-nextjs/app/page.tsx +++ b/apps/template-nextjs/app/page.tsx @@ -1,10 +1,26 @@ +'use client'; + +import { useHypergraphApp, useHypergraphAuth } from '@graphprotocol/hypergraph-react'; import Image from 'next/image'; import Link from 'next/link'; -import { LoginButton } from '@/Components/Login/LoginButton'; import { Button } from '@/Components/ui/button'; export default function HomePage() { + const { redirectToConnect } = useHypergraphApp(); + const { authenticated } = useHypergraphAuth(); + + const handleSignIn = () => { + redirectToConnect({ + storage: localStorage, + connectUrl: 'https://connect.geobrowser.io/', + successUrl: `${window.location.origin}/authenticate-success`, + redirectFn: (url: URL) => { + window.location.href = url.toString(); + }, + }); + }; + return (
- Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. -
-+ Go to Geo Connect to manage your private data and publish it to the public Knowledge Graph. +
+ + > + ) : ( + <> ++ Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. +
+ + > + )}- Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. -
- + {authenticated ? ( + <> ++ Go to Geo Connect to manage your private data and publish it to the public Knowledge Graph. +
+ + > + ) : ( + <> ++ Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. +
+ + > + )}