Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
bdougie committed Apr 3, 2024
1 parent ef273d2 commit 481ea08
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ console.log(
╚██████╔╝██║ ███████╗██║ ╚████║ ███████║██║ ██║╚██████╔╝╚██████╗███████╗██████╔╝
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝╚══════╝╚═════╝%c v${getAppVersion()}`,
"color:#f6d82b",
"color:green;font-weight:bold"
"color:green;font-weight:bold",
);

const App = (): JSX.Element => {
Expand Down
26 changes: 19 additions & 7 deletions src/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,27 @@ const Hero = () => {
<div>
<h1 className="font-Lexend text-4xl md:text-5xl text-center text-lightSlate leading-tight tracking-tight">
{`Find `}

<span className="bg-gradient-to-r from-gradFirst via-gradMiddle to-gradLast bg-clip-text text-transparent">
Open-Source Repositories
</span>

<br />
to contribute today
</h1>
</div>

<Combobox as="div" value={comboBoxSelection} onChange={setComboBoxSelection}>
<Combobox
as="div"
value={comboBoxSelection}
onChange={setComboBoxSelection}
>
<div className="mt-11 px-4 py-2.5 bg-white shadow-2xl rounded-2xl md:min-w-[26.375rem] flex justify-between">
<div className="flex items-center gap-x-2.5">
<img alt="search icon" src={searchNormal} />
<img
alt="search icon"
src={searchNormal}
/>

<Combobox.Button ref={comboButtonRef}>
<Combobox.Input
Expand All @@ -78,13 +87,12 @@ const Hero = () => {
placeholder="Search repositories"
type="text"
value={searchTerm}
onChange={(e) => setValueDebounced(e.target.value)}
onChange={e => setValueDebounced(e.target.value)}
onFocus={() => setFocus(true)}
onBlur={() =>
setTimeout(() => {
setFocus(false);
}, 200)
}
}, 200)}
onKeyUp={(event: React.KeyboardEvent) => {
if (event.key === "Enter") {
window.open(comboBoxSelection, "_blank", "noreferrer");
Expand All @@ -94,7 +102,11 @@ const Hero = () => {
</Combobox.Button>
</div>

<img alt="command k" className="pt-1.5" src={cmdKIcon} />
<img
alt="command k"
className="pt-1.5"
src={cmdKIcon}
/>
</div>

<div className="mt-2.5">
Expand All @@ -105,7 +117,7 @@ const Hero = () => {
<p className="text-gray-500 text-sm font-semibold">Repository</p>
</div>

{fetchedData.map((data) => (
{fetchedData.map(data => (
<Combobox.Option
key={data.full_name}
as="a"
Expand Down
3 changes: 0 additions & 3 deletions src/components/HotRepoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import Skeleton from "react-loading-skeleton";
import { getAvatarLink } from "../lib/github";
import humanizeNumber from "../lib/humanizeNumber";

import StackedAvatar from "./StackedAvatar";
import useRepo from "../hooks/useRepo";
// import useContributions from "../hooks/useContributions";

const bugReportLink = "https://github.com/open-sauced/hot/issues/new?assignees=&title=fix:";

Expand All @@ -17,7 +15,6 @@ export declare interface HotRepoCardProps {

const HotRepoCard = ({ repoName }: HotRepoCardProps): JSX.Element => {
const { repo, isLoading, isError } = useRepo(repoName);
// const { data: contributions } = useContributions(repoName);

if (isError) {
return (
Expand Down
16 changes: 0 additions & 16 deletions src/components/PrimaryNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ const bugReportLink =
const PrimaryNav = (): JSX.Element => {
const { signIn, signOut, userAndTokens } = useSupabaseAuth();
const currentUser = supabase.auth.session();
const [isFormOpen, setIsFormOpen] = useState(false);
const [openAdminBar, setOpenAdminBar] = useState(false);

useKey("`", () => setOpenAdminBar(!openAdminBar));

const handleFormOpen = (state: boolean) => setIsFormOpen(state);

useEffect(() => {
const fetchAuthSession = async () => {
if (currentUser?.access_token) {
Expand Down Expand Up @@ -112,19 +109,6 @@ const PrimaryNav = (): JSX.Element => {
)}
</Menu.Item>

<Menu.Item>
{({ active }) => (
<button
className={`${
active ? "bg-gray-100 text-gray-700" : "text-gray-900"
} group flex w-full items-center rounded-md px-5 py-1.5 text-sm`}
onClick={() => handleFormOpen(true)}
>
Submit a repository
</button>
)}
</Menu.Item>

<Menu.Item>
{({ active }) => (
<button
Expand Down
15 changes: 4 additions & 11 deletions src/components/RepoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
import { FaStar } from "react-icons/fa";
import humanizeNumber from "../lib/humanizeNumber";
import { getAvatarLink, getRepoLink } from "../lib/github";
// import StackedAvatar from "./StackedAvatar";
import useContributions from "../hooks/useContributions";

async function checkOwnerExists(owner: string) {
return await ownerExists(owner);
}

export declare interface RepoListProps {
data: DbRepo;
Expand All @@ -17,13 +11,14 @@ const RepoList = ({ data }: RepoListProps): JSX.Element => {
const {
repo_name,
star_count,
bucket,

// contributionsCount,
} = data;

// {repo_name} consists of `{owner}/{repo}`, so this link is actually `repos/{owner}/{repo}/contributions`
// const { data: contributions } = useContributions(repo_name);
/*
* {repo_name} consists of `{owner}/{repo}`, so this link is actually `repos/{owner}/{repo}/contributions`
* const { data: contributions } = useContributions(repo_name);
*/

const owner = repo_name.split("/")[0];

Expand All @@ -49,8 +44,6 @@ const RepoList = ({ data }: RepoListProps): JSX.Element => {

<p className="text-sm">{humanizeNumber(star_count)} today</p>
</div>

{/* <StackedAvatar contributors={contributions} /> */}
</div>
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/SecondaryNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const SecondaryNav = (): JSX.Element => {
<nav className="container">
<div className="flex space-y-3 flex-row flex-wrap text-sm sm:text-xl font-righteous text-accent font-bold justify-center items-baseline cursor-pointer">
{links.map(({ link, title }) => (
<Link key={link} to={link}>
<Link
key={link}
to={link}
>
<span
className={`${
activeLink === link ? "bg-cheesyYellow text-grey " : " "
Expand Down
1 change: 0 additions & 1 deletion src/e2e-tests/loggedOutUser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ test("logged out user should see sign in button", async ({ page }) => {
const login = page.locator("button", { hasText: "Sign in" });

await expect(login).toBeVisible();

});
8 changes: 4 additions & 4 deletions src/lib/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ const getRepoLink = (repoName: string | null) =>
const getRepoIssuesLink = (repoName: string | null) =>
`https://github.com/${repoName && `${repoName}/issues` || ""}`;

async function userStatusCode(owner: String) {
async function userStatusCode (owner: string) {
const apiUserUrl = `https://api.github.com/users/${owner}`;
const response = await fetch(apiUserUrl);
const {login} = await response.json();
const { login } = await response.json();

Check failure on line 16 in src/lib/github.ts

View workflow job for this annotation

GitHub Actions / Code standards

Unsafe assignment of an `any` value

if (apiUserUrl !== response.url) {
return [301, login];

Check failure on line 19 in src/lib/github.ts

View workflow job for this annotation

GitHub Actions / Code standards

Unsafe return of an `any[]` typed value
} else {
return [response.status,""];
}
return [response.status, ""];
}

export {
Expand Down
1 change: 1 addition & 0 deletions src/vite-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface DbRepo {
readonly starsCount?: number;
readonly submissionsCount?: number;
readonly stargazersCount?: number;
readonly star_count?: number;
}

interface DbRepoToUserVotes {
Expand Down

0 comments on commit 481ea08

Please sign in to comment.