feat: add sleep tracking features with leaderboard and user authentication
Some checks failed
Deploy / deploy (push) Failing after 50s
Some checks failed
Deploy / deploy (push) Failing after 50s
- Implemented a new HomePage component displaying the leaderboard. - Created Providers component for session management using next-auth. - Developed Header component for navigation and user authentication. - Added Leaderboard component to fetch and display sleep data. - Introduced SleepCard component for individual sleep entries. - Created SleepForm component for logging sleep data with manual input options. - Added SleepPhaseBar component to visualize sleep phases. - Implemented utility functions for formatting and calculating sleep data. - Set up authentication with Discord using next-auth and Prisma. - Configured middleware for protected routes. - Added TypeScript definitions for next-auth session. - Configured Tailwind CSS for styling. - Initialized TypeScript configuration for the project.
This commit is contained in:
25
src/lib/auth.ts
Normal file
25
src/lib/auth.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { NextAuthOptions } from "next-auth";
|
||||
import DiscordProvider from "next-auth/providers/discord";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import { prisma } from "./prisma";
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
adapter: PrismaAdapter(prisma),
|
||||
providers: [
|
||||
DiscordProvider({
|
||||
clientId: process.env.DISCORD_CLIENT_ID!,
|
||||
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
|
||||
}),
|
||||
],
|
||||
callbacks: {
|
||||
session({ session, user }) {
|
||||
if (session.user) {
|
||||
session.user.id = user.id;
|
||||
}
|
||||
return session;
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
signIn: "/login",
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user