Skip to content

added an extra sign-in link in the results page for for unsigned users #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions packages/app/.env.example

This file was deleted.

6 changes: 4 additions & 2 deletions packages/app/src/app/result/page.tsx
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import {
getBestCPM,
getCurrentRaceResult,
getSnippetVote,
getUserResultsForSnippet
getUserResultsForSnippet,
} from "./loaders";

// Components
@@ -27,6 +27,7 @@ import { ReplayCode } from "./replay-timestamps";
import { ResultChart } from "./result-chart";
import { TopTable } from "./topten";
import { Voting } from "./voting";
import SignInLink from "./sign-in-link";

type ResultPageProps = {
searchParams: {
@@ -259,6 +260,7 @@ async function UnauthenticatedPage({ snippetId }: UnauthenticatedPageProps) {
title="Your Race Results"
description="You did great! View your race results below"
/>
<SignInLink />
</div>

<div className="flex flex-col px-8 rounded-xl">
@@ -320,4 +322,4 @@ async function UnauthenticatedPage({ snippetId }: UnauthenticatedPageProps) {
</div>
</main>
);
}
}
23 changes: 23 additions & 0 deletions packages/app/src/app/result/sign-in-link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use client";

import { signIn } from "next-auth/react";

const SignInLink = () => {
return (
<p className="m-auto text text-sm ">
<span
onClick={() =>
signIn("github", {
callbackUrl: `${location.origin}`,
})
}
className="text-primary underline cursor-pointer"
>
Sign in
</span>{" "}
<span className="text-muted-foreground">to save your next race !</span>
</p>
);
};

export default SignInLink;