-
Notifications
You must be signed in to change notification settings - Fork 18
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
a532028
commit abda4ca
Showing
7 changed files
with
145 additions
and
2 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
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,23 @@ | ||
import { Container } from 'react-bootstrap' | ||
import NavBar from '../../../components/NavBar/NavBar' | ||
import Link from 'next/link' | ||
import { getHeadMetadata } from '../../../utils/SSRUtils' | ||
|
||
export default async function Page() { | ||
return ( | ||
<> | ||
<Container> | ||
<h2> | ||
<NavBar /> | ||
Linkvertise task failed | ||
</h2> | ||
<hr /> | ||
<p> | ||
Unfortunately something went wrong. You can try again <Link href="/linkvertise">here</Link>. | ||
</p> | ||
</Container> | ||
</> | ||
) | ||
} | ||
|
||
export const metadata = getHeadMetadata('Linkvertise', 'Linkvertise task failed') |
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,23 @@ | ||
import { Container } from 'react-bootstrap' | ||
import { initAPI } from '../../api/ApiHelper' | ||
import LowSupply from '../../components/LowSupply/LowSupply' | ||
import NavBar from '../../components/NavBar/NavBar' | ||
import { getHeadMetadata } from '../../utils/SSRUtils' | ||
import Linkvertise from '../../components/Linkvertise/Linkvertise' | ||
|
||
export default async function Page() { | ||
return ( | ||
<> | ||
<Container> | ||
<h2> | ||
<NavBar /> | ||
Linkvertise | ||
</h2> | ||
<Linkvertise /> | ||
<hr /> | ||
</Container> | ||
</> | ||
) | ||
} | ||
|
||
export const metadata = getHeadMetadata('Linkvertise', 'Linkvertise task successful') |
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 { Container } from 'react-bootstrap' | ||
import NavBar from '../../../components/NavBar/NavBar' | ||
import { getHeadMetadata } from '../../../utils/SSRUtils' | ||
|
||
export default async function Page() { | ||
return ( | ||
<> | ||
<Container> | ||
<h2> | ||
<NavBar /> | ||
Linkvertise task successful | ||
</h2> | ||
<hr /> | ||
<p>You successfully completed the Linkvertise task. You can close this page now.</p> | ||
</Container> | ||
</> | ||
) | ||
} | ||
|
||
export const metadata = getHeadMetadata('Linkvertise', 'Linkvertise task successful') |
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,45 @@ | ||
'use client' | ||
import { useState } from 'react' | ||
import api from '../../api/ApiHelper' | ||
import { getLoadingElement } from '../../utils/LoadingUtils' | ||
import { useWasAlreadyLoggedIn } from '../../utils/Hooks' | ||
import GoogleSignIn from '../GoogleSignIn/GoogleSignIn' | ||
import { useRouter } from 'next/navigation' | ||
|
||
export default function LowSupply() { | ||
let [isLoggedIn, setIsLoggedIn] = useState(false) | ||
let wasAlreadyLoggedIn = useWasAlreadyLoggedIn() | ||
let [isRedirecting, setIsRedirecting] = useState(false) | ||
let router = useRouter() | ||
|
||
function onLogin() { | ||
let googleId = sessionStorage.getItem('googleId') | ||
if (googleId) { | ||
setIsLoggedIn(true) | ||
loadRedirectLink() | ||
} | ||
} | ||
|
||
function loadRedirectLink() { | ||
setIsRedirecting(true) | ||
api.getLinkvertiseLink() | ||
.then(link => { | ||
router.push(link) | ||
}) | ||
.finally(() => { | ||
setIsRedirecting(false) | ||
}) | ||
} | ||
|
||
function onLoginFail() { | ||
setIsLoggedIn(false) | ||
} | ||
|
||
return ( | ||
<> | ||
{!isLoggedIn && !wasAlreadyLoggedIn && <p>To use Linkvertise, please login with Google: </p>} | ||
{isRedirecting && getLoadingElement(<span>Redirecting...</span>)} | ||
<GoogleSignIn onAfterLogin={onLogin} onLoginFail={onLoginFail} /> | ||
</> | ||
) | ||
} |
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