Skip to content

Commit

Permalink
fix linting issues (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattinannt authored Feb 7, 2024
1 parent 2266808 commit 9a172d7
Show file tree
Hide file tree
Showing 83 changed files with 1,597 additions and 1,891 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
extends: ["next", "prettier"],
rules: {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
},
settings: {
next: {
rootDir: true,
},
},
overrides: [
{
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
},
],
};
31 changes: 0 additions & 31 deletions .eslintrc.json

This file was deleted.

21 changes: 21 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
bracketSpacing: true,
bracketSameLine: true,
singleQuote: false,
jsxSingleQuote: false,
trailingComma: "es5",
semi: true,
printWidth: 110,
arrowParens: "always",
importOrder: [
// Mocks must be at the top as they contain vi.mock calls
"(.*)/__mocks__/(.*)",
"server-only",
"<THIRD_PARTY_MODULES>",
"^~/(.*)$",
"^[./]",
],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
plugins: ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
};
4 changes: 2 additions & 2 deletions app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface AuthLayoutProps {
children: React.ReactNode
children: React.ReactNode;
}

export default function AuthLayout({ children }: AuthLayoutProps) {
return <div className="min-h-screen">{children}</div>
return <div className="min-h-screen">{children}</div>;
}
38 changes: 13 additions & 25 deletions app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import { Metadata } from "next"
import Link from "next/link"
import { ChevronLeft } from "lucide-react"

import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
import { Logo } from "@/components/ui/logo"
import { UserAuthForm } from "@/components/user-auth-form"
import { buttonVariants } from "@/components/ui/button";
import { Logo } from "@/components/ui/logo";
import { UserAuthForm } from "@/components/user-auth-form";
import { cn } from "@/lib/utils";
import { ChevronLeft } from "lucide-react";
import { Metadata } from "next";
import Link from "next/link";

export const metadata: Metadata = {
title: "Login",
description: "Login to your account",
}
};

export default function LoginPage() {
return (
<div className="container flex h-screen w-screen flex-col items-center justify-center">
<Link
href="/"
className={cn(
buttonVariants({ variant: "ghost" }),
"absolute left-4 top-4 md:left-8 md:top-8"
)}
>
className={cn(buttonVariants({ variant: "ghost" }), "absolute left-4 top-4 md:left-8 md:top-8")}>
<>
<ChevronLeft className="mr-2 h-4 w-4" />
Back
Expand All @@ -30,23 +25,16 @@ export default function LoginPage() {
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
<div className="flex flex-col space-y-2 text-center">
<Logo />
<h1 className="text-2xl font-semibold tracking-tight">
Welcome back
</h1>
<p className="text-sm text-muted-foreground">
Use Github to sign in to your account
</p>
<h1 className="text-2xl font-semibold tracking-tight">Welcome back</h1>
<p className="text-sm text-muted-foreground">Use Github to sign in to your account</p>
</div>
<UserAuthForm />
<p className="px-8 text-center text-sm text-muted-foreground">
<Link
href="/register"
className="hover:text-brand underline underline-offset-4"
>
<Link href="/register" className="hover:text-brand underline underline-offset-4">
Don&apos;t have an account? Sign Up
</Link>
</p>
</div>
</div>
)
);
}
39 changes: 12 additions & 27 deletions app/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,44 @@
import Link from "next/link"

import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
import { Logo } from "@/components/ui/logo"
import { UserAuthForm } from "@/components/user-auth-form"
import { buttonVariants } from "@/components/ui/button";
import { Logo } from "@/components/ui/logo";
import { UserAuthForm } from "@/components/user-auth-form";
import { cn } from "@/lib/utils";
import Link from "next/link";

export const metadata = {
title: "Create an account",
description: "Create an account to get started.",
}
};

export default function RegisterPage() {
return (
<div className="container grid h-screen w-screen flex-col items-center justify-center lg:max-w-none lg:grid-cols-2 lg:px-0">
<Link
href="/login"
className={cn(
buttonVariants({ variant: "ghost" }),
"absolute right-4 top-4 md:right-8 md:top-8"
)}
>
className={cn(buttonVariants({ variant: "ghost" }), "absolute right-4 top-4 md:right-8 md:top-8")}>
Login
</Link>
<div className="hidden h-full bg-muted lg:block" />
<div className="lg:p-8">
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
<div className="flex flex-col space-y-2 text-center">
<Logo />
<h1 className="text-2xl font-semibold tracking-tight">
Create an account
</h1>
<p className="text-sm text-muted-foreground">
Use Github to create your account
</p>
<h1 className="text-2xl font-semibold tracking-tight">Create an account</h1>
<p className="text-sm text-muted-foreground">Use Github to create your account</p>
</div>
<UserAuthForm />
<p className="px-8 text-center text-sm text-muted-foreground">
By clicking continue, you agree to our{" "}
<Link
href="/terms"
className="hover:text-brand underline underline-offset-4"
>
<Link href="/terms" className="hover:text-brand underline underline-offset-4">
Terms of Service
</Link>{" "}
and{" "}
<Link
href="/privacy"
className="hover:text-brand underline underline-offset-4"
>
<Link href="/privacy" className="hover:text-brand underline underline-offset-4">
Privacy Policy
</Link>
.
</p>
</div>
</div>
</div>
)
);
}
11 changes: 5 additions & 6 deletions app/(dashboard)/client-page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
"use client"
"use client";

import { Button } from "@/components/ui/button"
import { Button } from "@/components/ui/button";

export default function ConnectGitHubAppButton() {
const handleRedirect = () => {
window.location.href =
"https://github.com/apps/ossgg-test/installations/new"
}
window.location.href = "https://github.com/apps/ossgg-test/installations/new";
};

return (
<Button onClick={handleRedirect} className="w-full">
Connect Repo
</Button>
)
);
}
11 changes: 4 additions & 7 deletions app/(dashboard)/contribute/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { DashboardHeader } from "@/components/header"
import { DashboardShell } from "@/components/shell"
import { DashboardHeader } from "@/components/header";
import { DashboardShell } from "@/components/shell";

export default function DashboardSettingsLoading() {
return (
<DashboardShell>
<DashboardHeader
heading="Contribute to oss.gg"
text="Help us make this more fun and engaging."
/>
<DashboardHeader heading="Contribute to oss.gg" text="Help us make this more fun and engaging." />
</DashboardShell>
)
);
}
24 changes: 10 additions & 14 deletions app/(dashboard)/contribute/page.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import { redirect } from "next/navigation"

import { authOptions } from "@/lib/auth"
import { getCurrentUser } from "@/lib/session"
import { DashboardHeader } from "@/components/header"
import { DashboardShell } from "@/components/shell"
import { DashboardHeader } from "@/components/header";
import { DashboardShell } from "@/components/shell";
import { authOptions } from "@/lib/auth";
import { getCurrentUser } from "@/lib/session";
import { redirect } from "next/navigation";

export const metadata = {
title: "Contribute to oss.gg",
description: "Help us make this more fun and engaging.",
}
};

export default async function SettingsPage() {
const user = await getCurrentUser()
const user = await getCurrentUser();

if (!user) {
redirect(authOptions?.pages?.signIn || "/login")
redirect(authOptions?.pages?.signIn || "/login");
}
return (
<DashboardShell>
<DashboardHeader
heading="Contribute to oss.gg"
text="Help us make this more fun and engaging."
/>
<DashboardHeader heading="Contribute to oss.gg" text="Help us make this more fun and engaging." />
<div className="grid gap-10"></div>
</DashboardShell>
)
);
}
44 changes: 19 additions & 25 deletions app/(dashboard)/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
import Link from "next/link"
import { redirect } from "next/navigation"

import { authOptions } from "@/lib/auth"
import { getCurrentUser } from "@/lib/session"
import { DashboardHeader } from "@/components/header"
import { DashboardShell } from "@/components/shell"
import { DashboardHeader } from "@/components/header";
import { DashboardShell } from "@/components/shell";
import { authOptions } from "@/lib/auth";
import { getCurrentUser } from "@/lib/session";
import Link from "next/link";
import { redirect } from "next/navigation";

export const metadata = {
title: "oss.gg",
description: "Gamify open source contributions. Less work, more fun!",
}
};

const cards = [
{
href: "/enroll",
title: "Find projects",
description:
"Enroll to play. Ship code or complete non-code tasks to gather points and level up.",
description: "Enroll to play. Ship code or complete non-code tasks to gather points and level up.",
},
{
href: "/issues",
title: "Explore open issues",
description:
"Already enrolled? Explore open issues or non-code tasks specific to each OS project.",
description: "Already enrolled? Explore open issues or non-code tasks specific to each OS project.",
},
{
href: "/settings",
title: "Settings",
description:
"Add your address to receive merch and change notification settings.",
description: "Add your address to receive merch and change notification settings.",
},
{
href: "/",
Expand All @@ -45,35 +41,33 @@ const cards = [
{
href: "/",
title: "What is oss.gg?",
description:
"Find out why we’re building this - and how you can become a part of it!",
description: "Find out why we’re building this - and how you can become a part of it!",
},
]
];

export default async function DashboardPage() {
const user = await getCurrentUser()
const user = await getCurrentUser();

if (!user) {
redirect(authOptions?.pages?.signIn || "/login")
redirect(authOptions?.pages?.signIn || "/login");
}

return (
<DashboardShell>
<DashboardHeader heading="Shall we play a game?"></DashboardHeader>
<div className="gap-4 grid md:grid-cols-2">
<div className="grid gap-4 md:grid-cols-2">
{cards.map((card) => (
<Link
href={card.href}
key={card.href}
className="bg-slate-50 rounded-md p-6 flex space-x-3 items-center hover:bg-slate-100 hover:scale-102 border border-transparent hover:border-slate-200 transition-all hover:cursor-pointer ease-in-out duration-150"
>
className="flex items-center space-x-3 rounded-md border border-transparent bg-slate-50 p-6 transition-all duration-150 ease-in-out hover:scale-102 hover:cursor-pointer hover:border-slate-200 hover:bg-slate-100">
<div>
<p className="font-medium mt-12 text-xl">{card.title}</p>
<p className="text-xs mt-0.5">opened by {card.description}</p>
<p className="mt-12 text-xl font-medium">{card.title}</p>
<p className="mt-0.5 text-xs">opened by {card.description}</p>
</div>
</Link>
))}
</div>
</DashboardShell>
)
);
}
Loading

0 comments on commit 9a172d7

Please sign in to comment.