Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions app/(protected)/client/page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
"use client";
'use client';

import { UserInfo } from "@/components/user-info";
import { useCurrentUser } from "@/hooks/use-current-user";
import { UserInfo } from '@/components/user-info';
import { useCurrentUser } from '@/hooks/use-current-user';

const ClientPage = () => {
const user = useCurrentUser();

return (
<UserInfo
label="📱 Client component"
user={user}
/>
);
}

export default ClientPage;
return <UserInfo label="📱 Client component" user={user} />;
};

export default ClientPage;
17 changes: 6 additions & 11 deletions app/(protected)/server/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { currentUser } from "@/lib/auth";
import { UserInfo } from "@/components/user-info";
import { currentUser } from '@/lib/auth';
import { UserInfo } from '@/components/user-info';

const ServerPage = async () => {
const user = await currentUser();

return (
<UserInfo
label="💻 Server component"
user={user}
/>
);
}

export default ServerPage;
return <UserInfo label="💻 Server component" user={user} />;
};

export default ServerPage;
78 changes: 31 additions & 47 deletions app/(protected)/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
"use client";
'use client';

import * as z from "zod";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useTransition, useState } from "react";
import { useSession } from "next-auth/react";
import * as z from 'zod';
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { useTransition, useState } from 'react';
import { useSession } from 'next-auth/react';

import { Switch } from "@/components/ui/switch";
import { Switch } from '@/components/ui/switch';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import { SettingsSchema } from "@/schemas";
import {
Card,
CardHeader,
CardContent,
} from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { settings } from "@/actions/settings";
} from '@/components/ui/select';
import { SettingsSchema } from '@/schemas';
import { Card, CardHeader, CardContent } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { settings } from '@/actions/settings';
import {
Form,
FormField,
Expand All @@ -30,12 +26,12 @@ import {
FormLabel,
FormDescription,
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { useCurrentUser } from "@/hooks/use-current-user";
import { FormError } from "@/components/form-error";
import { FormSuccess } from "@/components/form-success";
import { UserRole } from "@prisma/client";
} from '@/components/ui/form';
import { Input } from '@/components/ui/input';
import { useCurrentUser } from '@/hooks/use-current-user';
import { FormError } from '@/components/form-error';
import { FormSuccess } from '@/components/form-success';
import { UserRole } from '@prisma/client';

const SettingsPage = () => {
const user = useCurrentUser();
Expand All @@ -54,7 +50,7 @@ const SettingsPage = () => {
email: user?.email || undefined,
role: user?.role || undefined,
isTwoFactorEnabled: user?.isTwoFactorEnabled || undefined,
}
},
});

const onSubmit = (values: z.infer<typeof SettingsSchema>) => {
Expand All @@ -70,23 +66,18 @@ const SettingsPage = () => {
setSuccess(data.success);
}
})
.catch(() => setError("Something went wrong!"));
.catch(() => setError('Something went wrong!'));
});
}
};

return (
return (
<Card className="w-[600px]">
<CardHeader>
<p className="text-2xl font-semibold text-center">
⚙️ Settings
</p>
<p className="text-2xl font-semibold text-center">⚙️ Settings</p>
</CardHeader>
<CardContent>
<Form {...form}>
<form
className="space-y-6"
onSubmit={form.handleSubmit(onSubmit)}
>
<form className="space-y-6" onSubmit={form.handleSubmit(onSubmit)}>
<div className="space-y-4">
<FormField
control={form.control}
Expand Down Expand Up @@ -180,12 +171,8 @@ const SettingsPage = () => {
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value={UserRole.ADMIN}>
Admin
</SelectItem>
<SelectItem value={UserRole.USER}>
User
</SelectItem>
<SelectItem value={UserRole.ADMIN}>Admin</SelectItem>
<SelectItem value={UserRole.USER}>User</SelectItem>
</SelectContent>
</Select>
<FormMessage />
Expand Down Expand Up @@ -218,17 +205,14 @@ const SettingsPage = () => {
</div>
<FormError message={error} />
<FormSuccess message={success} />
<Button
disabled={isPending}
type="submit"
>
<Button disabled={isPending} type="submit">
Save
</Button>
</form>
</Form>
</CardContent>
</Card>
);
}
export default SettingsPage;
);
};

export default SettingsPage;
8 changes: 3 additions & 5 deletions app/auth/error/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { ErrorCard } from "@/components/auth/error-card";
import { ErrorCard } from '@/components/auth/error-card';

const AuthErrorPage = () => {
return (
<ErrorCard />
);
return <ErrorCard />;
};

export default AuthErrorPage;
16 changes: 6 additions & 10 deletions app/auth/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const AuthLayout = ({
children
}: {
children: React.ReactNode
}) => {
return (
const AuthLayout = ({ children }: { children: React.ReactNode }) => {
return (
<div className="h-full flex items-center justify-center bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-sky-400 to-blue-800">
{children}
</div>
);
}
export default AuthLayout;
);
};

export default AuthLayout;
12 changes: 5 additions & 7 deletions app/auth/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { LoginForm } from "@/components/auth/login-form";
import { LoginForm } from '@/components/auth/login-form';

const LoginPage = () => {
return (
<LoginForm />
);
}

export default LoginPage;
return <LoginForm />;
};

export default LoginPage;
12 changes: 5 additions & 7 deletions app/auth/new-password/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { NewPasswordForm } from "@/components/auth/new-password-form";
import { NewPasswordForm } from '@/components/auth/new-password-form';

const NewPasswordPage = () => {
return (
<NewPasswordForm />
);
}

export default NewPasswordPage;
return <NewPasswordForm />;
};

export default NewPasswordPage;
12 changes: 5 additions & 7 deletions app/auth/new-verification/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { NewVerificationForm } from "@/components/auth/new-verification-form";
import { NewVerificationForm } from '@/components/auth/new-verification-form';

const NewVerificationPage = () => {
return (
<NewVerificationForm />
);
}

export default NewVerificationPage;
return <NewVerificationForm />;
};

export default NewVerificationPage;
12 changes: 5 additions & 7 deletions app/auth/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { RegisterForm } from "@/components/auth/register-form";
import { RegisterForm } from '@/components/auth/register-form';

const RegisterPage = () => {
return (
<RegisterForm />
);
}

export default RegisterPage;
return <RegisterForm />;
};

export default RegisterPage;
38 changes: 19 additions & 19 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,76 @@ body,
:root {
height: 100%;
}

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;

--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;

--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;

--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;

--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;

--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;

--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;

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

--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;

--radius: 0.5rem;
}

.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;

--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;

--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;

--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;

--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;

--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;

--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;

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

--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
}
Loading