Skip to content

Commit

Permalink
🐍 Add prettier config (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
nezouse authored Feb 20, 2024
1 parent 0572831 commit acc041e
Show file tree
Hide file tree
Showing 33 changed files with 3,395 additions and 1,333 deletions.
38 changes: 19 additions & 19 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 0 0% 3.9%;

--card: 0 0% 100%;
--card-foreground: 0 0% 3.9%;

--popover: 0 0% 100%;
--popover-foreground: 0 0% 3.9%;

--primary: 0 0% 9%;
--primary-foreground: 0 0% 98%;

--secondary: 0 0% 96.1%;
--secondary-foreground: 0 0% 9%;

--muted: 0 0% 96.1%;
--muted-foreground: 0 0% 45.1%;

--accent: 0 0% 96.1%;
--accent-foreground: 0 0% 9%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;

--border: 0 0% 89.8%;
--input: 0 0% 89.8%;
--ring: 0 0% 3.9%;

--radius: 0.5rem;
}

.dark {
--background: 0 0% 3.9%;
--foreground: 0 0% 98%;

--card: 0 0% 3.9%;
--card-foreground: 0 0% 98%;

--popover: 0 0% 3.9%;
--popover-foreground: 0 0% 98%;

--primary: 0 0% 98%;
--primary-foreground: 0 0% 9%;

--secondary: 0 0% 14.9%;
--secondary-foreground: 0 0% 98%;

--muted: 0 0% 14.9%;
--muted-foreground: 0 0% 63.9%;

--accent: 0 0% 14.9%;
--accent-foreground: 0 0% 98%;

--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;

--border: 0 0% 14.9%;
--input: 0 0% 14.9%;
--ring: 0 0% 83.1%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
}
2 changes: 1 addition & 1 deletion app/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default function Icon() {
),
{
...size,
}
},
);
}
14 changes: 8 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import type { Metadata } from "next";
import { Inter as FontSans } from "next/font/google";
import Link from "next/link";

import "./globals.css";

import { cn } from "@/lib/cn";
import { Button } from "@/components/ui/button";
import Link from "next/link";
import { AccountButton } from "@/components/ui/accountButton";
import { Button } from "@/components/ui/button";

const fontSans = FontSans({
subsets: ["latin"],
Expand All @@ -26,14 +28,14 @@ export default function RootLayout({
<body
className={cn(
"min-h-screen bg-background font-sans antialiased",
fontSans.variable
fontSans.variable,
)}
>
<main className="flex flex-col min-h-screen items-center gap-12 px-16 py-12">
<div className="w-full justify-between items-center flex">
<main className="flex min-h-screen flex-col items-center gap-12 px-16 py-12">
<div className="flex w-full items-center justify-between">
<Button
variant="link"
className="text-3xl font-mono font-bold"
className="font-mono text-3xl font-bold"
asChild
>
<Link href="/">POPGDP</Link>
Expand Down
2 changes: 1 addition & 1 deletion app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function NotFound() {
return (
<div className="my-[25vh] flex flex-col items-center">
<p className="text-7xl font-bold">404</p>
<h2 className="text-xl mt-2">Not Found</h2>
<h2 className="mt-2 text-xl">Not Found</h2>
</div>
);
}
9 changes: 5 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import Link from "next/link";
import { db } from "@/drizzle/db";
import { format } from "date-fns";

import { Button } from "@/components/ui/button";
import {
Card,
Expand All @@ -6,15 +10,12 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { db } from "@/drizzle/db";
import { format } from "date-fns";
import Link from "next/link";

export default async function Home() {
const waves = await db.query.waves.findMany();

return (
<div className="flex flex-col gap-4 max-w-xl w-full">
<div className="flex w-full max-w-xl flex-col gap-4">
<div className="text-2xl">Current waves</div>
<ol className="flex flex-col gap-8">
{waves.map((wave) => (
Expand Down
2 changes: 1 addition & 1 deletion app/waves/[waveId]/applications/[applicationId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { notFound } from "next/navigation";
import { db } from "@/drizzle/db";
import { applications } from "@/drizzle/schema";
import { eq } from "drizzle-orm";
import { notFound } from "next/navigation";

export default async function Application({
params,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
"use server";

import { auth } from "@/lib/auth";
import { createApplicationSchema } from "./createApplicationSchema";
import { db } from "@/drizzle/db";
import { applications } from "@/drizzle/schema";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { db } from "@/drizzle/db";
import { applications } from "@/drizzle/schema";

import { auth } from "@/lib/auth";

import { createApplicationSchema } from "./createApplicationSchema";

export async function createApplicationAction(
data: createApplicationSchema,
waveId: number
waveId: number,
) {
const session = await auth();

Expand Down
10 changes: 6 additions & 4 deletions app/waves/[waveId]/applications/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"use client";

import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";

import { Button } from "@/components/ui/button";
import {
Form,
Expand All @@ -10,10 +13,9 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { createApplicationSchema } from "./createApplicationSchema";

import { createApplicationAction } from "./createApplicationAction";
import { createApplicationSchema } from "./createApplicationSchema";

export default function CreateApplication({
params,
Expand All @@ -30,7 +32,7 @@ export default function CreateApplication({
return (
<Form {...form}>
<form
className="flex flex-col gap-4 w-full max-w-lg"
className="flex w-full max-w-lg flex-col gap-4"
onSubmit={form.handleSubmit(async (data) => {
await createApplicationAction(data, Number(params.waveId));
})}
Expand Down
15 changes: 8 additions & 7 deletions app/waves/[waveId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import Link from "next/link";
import { notFound } from "next/navigation";
import { db } from "@/drizzle/db";
import { applications, waves } from "@/drizzle/schema";
import { format } from "date-fns";
import { eq } from "drizzle-orm";

import { Button } from "@/components/ui/button";
import {
Table,
Expand All @@ -7,12 +14,6 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
import { db } from "@/drizzle/db";
import { applications, waves } from "@/drizzle/schema";
import { format } from "date-fns";
import { eq } from "drizzle-orm";
import Link from "next/link";
import { notFound } from "next/navigation";

export default async function Wave({ params }: { params: { waveId: string } }) {
const [wave, projects] = await Promise.all([
Expand All @@ -31,7 +32,7 @@ export default async function Wave({ params }: { params: { waveId: string } }) {

return (
<div className="w-full">
<div className="flex justify-between items-center">
<div className="flex items-center justify-between">
<div>
<div>Wave {wave.id}</div>
<div>Wave name: {wave.name}</div>
Expand Down
5 changes: 3 additions & 2 deletions app/waves/create/createWaveAction.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use server";

import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { db } from "@/drizzle/db";
import { waves } from "@/drizzle/schema";

import { createWaveSchema } from "./createWaveSchema";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";

export async function createWaveAction(data: createWaveSchema) {
const [{ id }] = await db
Expand Down
20 changes: 11 additions & 9 deletions app/waves/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"use client";

import { Input } from "@/components/ui/input";
import { createWaveAction } from "./createWaveAction";
import { createWaveSchema } from "./createWaveSchema";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { addDays, format } from "date-fns";
import { CalendarIcon } from "lucide-react";
import { useForm } from "react-hook-form";

import { Button } from "@/components/ui/button";
import { Calendar } from "@/components/ui/calendar";
import {
Form,
FormControl,
Expand All @@ -13,15 +15,15 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { Button } from "@/components/ui/button";
import { CalendarIcon } from "lucide-react";
import { addDays, format } from "date-fns";
import { Calendar } from "@/components/ui/calendar";

import { createWaveAction } from "./createWaveAction";
import { createWaveSchema } from "./createWaveSchema";

export default function CreateWave() {
const form = useForm<createWaveSchema>({
Expand All @@ -38,7 +40,7 @@ export default function CreateWave() {
return (
<Form {...form}>
<form
className="flex flex-col gap-4 w-full max-w-lg"
className="flex w-full max-w-lg flex-col gap-4"
onSubmit={form.handleSubmit(async (data) => {
await createWaveAction(data);
})}
Expand Down
3 changes: 2 additions & 1 deletion components/ui/accountButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { signIn, signOut, auth } from "@/lib/auth";
import { auth, signIn, signOut } from "@/lib/auth";

import { SubmitButton } from "./submitButton";

export const AccountButton = async () => {
Expand Down
4 changes: 2 additions & 2 deletions components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const buttonVariants = cva(
variant: "default",
size: "default",
},
}
},
);

export interface ButtonProps
Expand All @@ -49,7 +49,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
{...props}
/>
);
}
},
);
Button.displayName = "Button";

Expand Down
4 changes: 2 additions & 2 deletions components/ui/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function Calendar({
nav: "space-x-1 flex items-center",
nav_button: cn(
buttonVariants({ variant: "outline" }),
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
),
nav_button_previous: "absolute left-1",
nav_button_next: "absolute right-1",
Expand All @@ -39,7 +39,7 @@ function Calendar({
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
day: cn(
buttonVariants({ variant: "ghost" }),
"h-9 w-9 p-0 font-normal aria-selected:opacity-100"
"h-9 w-9 p-0 font-normal aria-selected:opacity-100",
),
day_range_end: "day-range-end",
day_selected:
Expand Down
4 changes: 2 additions & 2 deletions components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Card = React.forwardRef<
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className
className,
)}
{...props}
/>
Expand All @@ -37,7 +37,7 @@ const CardTitle = React.forwardRef<
ref={ref}
className={cn(
"text-xl font-semibold leading-none tracking-tight",
className
className,
)}
{...props}
/>
Expand Down
Loading

0 comments on commit acc041e

Please sign in to comment.