From 7c71748deadeab131482372bc04145326f304465 Mon Sep 17 00:00:00 2001 From: pranavdaa Date: Fri, 29 Aug 2025 16:14:00 -0400 Subject: [PATCH 1/4] Change geo Login flow --- apps/template-vite-react/src/routes/index.tsx | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/apps/template-vite-react/src/routes/index.tsx b/apps/template-vite-react/src/routes/index.tsx index b8ae9d1b..99301aab 100644 --- a/apps/template-vite-react/src/routes/index.tsx +++ b/apps/template-vite-react/src/routes/index.tsx @@ -1,5 +1,5 @@ import { Button } from '@/components/ui/button'; -import { useHypergraphApp } from '@graphprotocol/hypergraph-react'; +import { useHypergraphApp, useHypergraphAuth } from '@graphprotocol/hypergraph-react'; import { Link, createFileRoute } from '@tanstack/react-router'; export const Route = createFileRoute('/')({ @@ -8,6 +8,7 @@ export const Route = createFileRoute('/')({ function Index() { const { redirectToConnect } = useHypergraphApp(); + const { authenticated } = useHypergraphAuth(); const handleSignIn = () => { redirectToConnect({ @@ -20,6 +21,17 @@ function Index() { }); }; + const handleGoToGeoConnect = () => { + redirectToConnect({ + storage: localStorage, + connectUrl: 'https://connect.geobrowser.io/', + successUrl: `${window.location.origin}/authenticate-success`, + redirectFn: (url: URL) => { + window.location.href = url.toString(); + }, + }); + }; + return (
@@ -61,7 +73,7 @@ function Index() {
- {/* Section 2: Sign in with Geo Connect */} + {/* Section 2: Conditional content based on authentication */}
@@ -79,13 +91,27 @@ function Index() { />
-

Manage Your Data

-

- Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. -

- + {authenticated ? ( + <> +

Go to Geo Connect

+

+ Go to Geo Connect to manage your private data and publish it to the public Knowledge Graph. +

+ + + ) : ( + <> +

Manage Your Data

+

+ Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. +

+ + + )}
From ba7b189c0f6fbfeb6ab4641a5c1201333b3c993e Mon Sep 17 00:00:00 2001 From: pranavdaa Date: Fri, 29 Aug 2025 16:33:11 -0400 Subject: [PATCH 2/4] LogIN changes made to NextJs template as well --- apps/template-nextjs/app/page.tsx | 58 +++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/apps/template-nextjs/app/page.tsx b/apps/template-nextjs/app/page.tsx index f274e546..3978a4b4 100644 --- a/apps/template-nextjs/app/page.tsx +++ b/apps/template-nextjs/app/page.tsx @@ -1,10 +1,38 @@ +'use client'; + import Image from 'next/image'; import Link from 'next/link'; -import { LoginButton } from '@/Components/Login/LoginButton'; +import { useHypergraphApp, useHypergraphAuth } from '@graphprotocol/hypergraph-react'; + 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(); + }, + }); + }; + + const handleGoToGeoConnect = () => { + redirectToConnect({ + storage: localStorage, + connectUrl: 'https://connect.geobrowser.io/', + successUrl: `${window.location.origin}/authenticate-success`, + redirectFn: (url: URL) => { + window.location.href = url.toString(); + }, + }); + }; + return (
@@ -46,7 +74,7 @@ export default function HomePage() {
- {/* Section 2: Sign in with Geo Connect */} + {/* Section 2: Conditional content based on authentication */}
@@ -64,11 +92,27 @@ export default function HomePage() { />
-

Manage Your Data

-

- Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. -

- + {authenticated ? ( + <> +

Go to Geo Connect

+

+ Go to Geo Connect to manage your private data and publish it to the public Knowledge Graph. +

+ + + ) : ( + <> +

Manage Your Data

+

+ Sign in with Geo Connect to manage your private data and publish it to the public Knowledge Graph. +

+ + + )}
From 939ac49af96808ebbb3a0e528f12e9780d83d7c9 Mon Sep 17 00:00:00 2001 From: Nik Graf Date: Mon, 1 Sep 2025 14:15:07 +0200 Subject: [PATCH 3/4] remove duplicated code --- apps/template-nextjs/app/page.tsx | 19 +++++-------------- apps/template-vite-react/src/routes/index.tsx | 18 +++++------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/apps/template-nextjs/app/page.tsx b/apps/template-nextjs/app/page.tsx index 3978a4b4..0490ee16 100644 --- a/apps/template-nextjs/app/page.tsx +++ b/apps/template-nextjs/app/page.tsx @@ -1,10 +1,9 @@ 'use client'; +import { useHypergraphApp, useHypergraphAuth } from '@graphprotocol/hypergraph-react'; import Image from 'next/image'; import Link from 'next/link'; -import { useHypergraphApp, useHypergraphAuth } from '@graphprotocol/hypergraph-react'; - import { Button } from '@/Components/ui/button'; export default function HomePage() { @@ -22,17 +21,6 @@ export default function HomePage() { }); }; - const handleGoToGeoConnect = () => { - redirectToConnect({ - storage: localStorage, - connectUrl: 'https://connect.geobrowser.io/', - successUrl: `${window.location.origin}/authenticate-success`, - redirectFn: (url: URL) => { - window.location.href = url.toString(); - }, - }); - }; - return (
@@ -53,6 +41,7 @@ export default function HomePage() { fill="none" stroke="currentColor" viewBox="0 0 24 24" + aria-hidden="true" >