From f8444fc1148dfef6e15a84bc241f82865640ed70 Mon Sep 17 00:00:00 2001 From: aslw1 Date: Mon, 8 Jan 2024 02:51:00 +0200 Subject: [PATCH 1/2] fixed the terms page as it wasn't viewing anything --- packages/app/src/app/terms/page.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/app/src/app/terms/page.tsx b/packages/app/src/app/terms/page.tsx index 282f176a..017adf17 100644 --- a/packages/app/src/app/terms/page.tsx +++ b/packages/app/src/app/terms/page.tsx @@ -4,10 +4,8 @@ const page = () => { <>
-

CodeRacer - Terms of Service

-

Effective Date: [Date]

- -

Welcome to CodeRacer! These Terms of Service ("Terms") constitute a legal agreement between you and CodeRacer. Please read these Terms carefully before using our platform, which is accessible at https://code-racer-eight.vercel.app/. By using CodeRacer, you agree to be bound by these Terms.

+

CodeRacer - Terms of Service

+

Welcome to CodeRacer! These Terms of Service Terms constitute a legal agreement between you and CodeRacer. Please read these Terms carefully before using our platform, which is accessible at https://code-racer-eight.vercel.app/. By using CodeRacer, you agree to be bound by these Terms.

1. User Accounts

@@ -45,7 +43,7 @@ const page = () => {

6. Limitation of Liability

- 6.1. Disclaimer: CodeRacer is provided "as is," and we make no warranties or representations about the accuracy or reliability of the platform. Your use of CodeRacer is at your own risk. + 6.1. Disclaimer: CodeRacer is provided as is, and we make no warranties or representations about the accuracy or reliability of the platform. Your use of CodeRacer is at your own risk.

7. Changes to Terms

@@ -58,6 +56,7 @@ const page = () => { 8.1. Questions: If you have any questions or concerns about these Terms, please contact us at contact@coderacer.com.

+ ); }; From 14b395db6eacbedf2d1873dcca80a664c2a5a85c Mon Sep 17 00:00:00 2001 From: aslw1 Date: Mon, 8 Jan 2024 03:04:44 +0200 Subject: [PATCH 2/2] refactored the leaderboard page --- .../_components/ContributorsList.tsx | 31 +++++++++++++++++++ .../src/app/contributors/_helpers/types.ts | 26 ++++++++++++++++ packages/app/src/app/contributors/page.tsx | 24 +++++--------- 3 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 packages/app/src/app/contributors/_components/ContributorsList.tsx diff --git a/packages/app/src/app/contributors/_components/ContributorsList.tsx b/packages/app/src/app/contributors/_components/ContributorsList.tsx new file mode 100644 index 00000000..0840060a --- /dev/null +++ b/packages/app/src/app/contributors/_components/ContributorsList.tsx @@ -0,0 +1,31 @@ +import Contributor from "./contributor" +import { GitHubContributor, contributors } from "../_helpers/types" +interface contributerListProps { + contributors: contributors; + sliceStartIndex: number; + sliceEndIndex: number; + contributorCommitActivities: any; +} +const Contributors = ({contributors,sliceStartIndex,sliceEndIndex,contributorCommitActivities}:contributerListProps) => { + return ( +
+
    + {contributors + .slice(sliceStartIndex, sliceEndIndex) + .map((contributor: GitHubContributor) => ( + e.login === contributor.login, + ) ?? { additions: 0, deletions: 0, login: contributor.login } + } + /> + ))} +
+
+ ) +} + +export default Contributors \ No newline at end of file diff --git a/packages/app/src/app/contributors/_helpers/types.ts b/packages/app/src/app/contributors/_helpers/types.ts index 8411988e..0d5e278b 100644 --- a/packages/app/src/app/contributors/_helpers/types.ts +++ b/packages/app/src/app/contributors/_helpers/types.ts @@ -58,6 +58,31 @@ interface GitHubContributorCommitActivity { }[]; } + +type contributors ={ + + login: string; + id: number; + node_id: string; + avatar_url: string; + gravatar_id: string; + url: string; + html_url: string; + followers_url: string; + following_url: string; + gists_url: string; + starred_url: string; + subscriptions_url: string; + organizations_url: string; + repos_url: string; + events_url: string; + received_events_url: string; + type: string; + site_admin: boolean; + contributions: number; + +}[] + // GitHub API Response schemas ------------------------------------------ export { @@ -67,4 +92,5 @@ export { type GitHubContributor, type GitHubCommit, type ContributorCodeChanges, + type contributors, }; diff --git a/packages/app/src/app/contributors/page.tsx b/packages/app/src/app/contributors/page.tsx index 1bc4002b..d048ae53 100644 --- a/packages/app/src/app/contributors/page.tsx +++ b/packages/app/src/app/contributors/page.tsx @@ -1,5 +1,4 @@ import { Heading } from "@/components/ui/heading"; -import Contributor from "./_components/contributor"; import AdditionsDeletions from "./_components/additions-deletions"; import ProportionBarChart from "./_components/proportion-bar-chart"; import Time from "@/components/ui/time"; @@ -13,6 +12,7 @@ import { getRepoWeeklyCodeChanges, } from "./_helpers/utils"; import { redirect } from "next/navigation"; +import ContributorsList from "./_components/ContributorsList"; const PER_PAGE_MAX = 12; // Limit to only 12 per page to avoid hitting rate limit @@ -107,22 +107,12 @@ export default async function ContributorsPage({ /> -
    - {contributors - .slice(sliceStartIndex, sliceEndIndex) - .map((contributor) => ( - e.login === contributor.login, - ) ?? { additions: 0, deletions: 0, login: contributor.login } - } - /> - ))} -
- +