From 426c35562edd5f600ee5785f0f4ccb808b30e258 Mon Sep 17 00:00:00 2001 From: Brian 'bdougie' Douglas Date: Mon, 1 Apr 2024 14:27:06 -0700 Subject: [PATCH] npm run format --- src/App.tsx | 17 ++++- src/components/HotRepoCard.tsx | 60 ++++++++++----- src/components/RecentRepoListWrap.tsx | 104 ++++++++++++++------------ src/components/RepoList.tsx | 2 - src/components/SecondaryNav.tsx | 1 - src/e2e-tests/loggedOutUser.spec.ts | 1 - 6 files changed, 109 insertions(+), 76 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 6f7a64c8..32874044 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -23,7 +23,7 @@ console.log( ╚██████╔╝██║ ███████╗██║ ╚████║ ███████║██║ ██║╚██████╔╝╚██████╗███████╗██████╔╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚══════╝╚═════╝%c v${getAppVersion()}`, "color:#f6d82b", - "color:green;font-weight:bold" + "color:green;font-weight:bold", ); const App = (): JSX.Element => { @@ -52,11 +52,20 @@ const App = (): JSX.Element => { - } path="/" /> + } + path="/" + /> - } path="recent" /> + } + path="recent" + /> - } path="*" /> + } + path="*" + /> diff --git a/src/components/HotRepoCard.tsx b/src/components/HotRepoCard.tsx index 8405b5bf..6aad86e5 100644 --- a/src/components/HotRepoCard.tsx +++ b/src/components/HotRepoCard.tsx @@ -1,6 +1,3 @@ -import { useEffect, useState } from "react"; -import { RiCheckboxCircleFill } from "react-icons/ri"; -import { FaArrowAltCircleUp } from "react-icons/fa"; import { AiOutlineStar } from "react-icons/ai"; import { BiGitPullRequest } from "react-icons/bi"; import { VscIssues } from "react-icons/vsc"; @@ -30,11 +27,11 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => {
Report a bug @@ -46,22 +43,30 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => { if (isLoading) { return (
- +
); } - const { id, full_name, name, description, issues, stars } = repo!; - const repo_id = parseInt(`${id}`); + const { full_name, name, description, issues, stars } = repo!; const owner = full_name.replace(`/${String(name)}`, "").trim(); return (
- Hot Repo Icon - - {owner} + Hot Repo Icon + + + {owner} +
@@ -75,25 +80,40 @@ const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => { {name} -

{description}

+

+ {description} +

- - - {humanizeNumber(issues)} + + + + {humanizeNumber(issues)} +
- - - {humanizeNumber(stars)} + + + + {humanizeNumber(stars)} +
- + 0
diff --git a/src/components/RecentRepoListWrap.tsx b/src/components/RecentRepoListWrap.tsx index 2b61ef31..1e2b721e 100644 --- a/src/components/RecentRepoListWrap.tsx +++ b/src/components/RecentRepoListWrap.tsx @@ -41,22 +41,22 @@ const RecentRepoListWrap = (): JSX.Element => { const [older, setOlder] = useState(null); useEffect(() => { - const lastSunday = new Date(); + const lastSunday = (new Date); lastSunday.setDate(lastSunday.getDate() - lastSunday.getDay()); lastSunday.setHours(0, 0, 0, 0); if (!isLoading) { - const thisWeekData = data.filter((repo) => repo.created_at && new Date(repo.created_at) > lastSunday); + const thisWeekData = data.filter(repo => repo.created_at && new Date(repo.created_at) > lastSunday); thisWeekData.sort((a, b) => (new Date(a.created_at!) > new Date(b.created_at!) ? 1 : -1)); setThisWeek(thisWeekData); const lastWeekData = data.filter( - (repo) => + repo => repo.created_at && new Date(repo.created_at) < lastSunday && - new Date(repo.created_at) > new Date(lastSunday.getTime() - 7 * 24 * 60 * 60 * 1000) + new Date(repo.created_at) > new Date(lastSunday.getTime() - 7 * 24 * 60 * 60 * 1000), ); lastWeekData.sort((a, b) => (new Date(a.created_at!) > new Date(b.created_at!) ? 1 : -1)); @@ -64,8 +64,8 @@ const RecentRepoListWrap = (): JSX.Element => { setLastWeek(lastWeekData); const olderData = data.filter( - (repo) => - repo.created_at && new Date(repo.created_at) < new Date(lastSunday.getTime() - 7 * 24 * 60 * 60 * 1000) + repo => + repo.created_at && new Date(repo.created_at) < new Date(lastSunday.getTime() - 7 * 24 * 60 * 60 * 1000), ); olderData.sort((a, b) => (new Date(a.created_at!) > new Date(b.created_at!) ? 1 : -1)); @@ -80,49 +80,57 @@ const RecentRepoListWrap = (): JSX.Element => { return ( <> - {isLoading ? ( -
-
- {Array.from(Array(25).keys()).map((item) => ( -
- -
- ))} + {isLoading + ? ( +
+
+ {Array.from(Array(25).keys()).map(item => ( +
+ +
+ ))} +
-
- ) : ( - <> - {thisWeek && thisWeek.length > 0 && ( - - )} - - {lastWeek && lastWeek.length > 0 && ( - - )} - - {older && older.length > 0 && ( - - )} - - )} + ) + : ( + <> + {thisWeek && thisWeek.length > 0 && ( + + )} + + {lastWeek && lastWeek.length > 0 && ( + + )} + + {older && older.length > 0 && ( + + )} + + )} ); }; diff --git a/src/components/RepoList.tsx b/src/components/RepoList.tsx index 95956872..f26b38f3 100644 --- a/src/components/RepoList.tsx +++ b/src/components/RepoList.tsx @@ -1,10 +1,8 @@ import { emojify } from "node-emoji"; -import { useEffect } from "react"; import { FaDotCircle, FaStar } from "react-icons/fa"; import humanizeNumber from "../lib/humanizeNumber"; import { getAvatarLink, getRepoLink } from "../lib/github"; import StackedAvatar from "./StackedAvatar"; -import useVotedRepos from "../hooks/useVotedRepos"; import useContributions from "../hooks/useContributions"; export declare interface RepoListProps { diff --git a/src/components/SecondaryNav.tsx b/src/components/SecondaryNav.tsx index b4291d8e..00b34bac 100644 --- a/src/components/SecondaryNav.tsx +++ b/src/components/SecondaryNav.tsx @@ -1,5 +1,4 @@ import { Link, useLocation } from "react-router-dom"; -import useSupabaseAuth from "../hooks/useSupabaseAuth"; import locationsHash from "../lib/locationsHash"; import { RepoOrderByEnum } from "./RepoListWrap"; diff --git a/src/e2e-tests/loggedOutUser.spec.ts b/src/e2e-tests/loggedOutUser.spec.ts index 036b4db5..859b5448 100644 --- a/src/e2e-tests/loggedOutUser.spec.ts +++ b/src/e2e-tests/loggedOutUser.spec.ts @@ -18,5 +18,4 @@ test("logged out user should see all categories", async ({ page }) => { await expect(popular).toHaveAttribute("href", "/popular"); await expect(popular).toBeVisible(); - });