diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 35b5167..8b4fcfd 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community. Examples of behavior that contributes to a positive environment for our community include: -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall +- Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: -* The use of sexualized language or imagery, and sexual attention or advances of +- The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities diff --git a/.github/REQUEST_TEMPLATE.md b/.github/REQUEST_TEMPLATE.md deleted file mode 100644 index cef1849..0000000 --- a/.github/REQUEST_TEMPLATE.md +++ /dev/null @@ -1,25 +0,0 @@ -# Thanks for creating this pull request 🤗 - -Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. - -If this pull request closes an issue, please mention the issue number below. - -Closes # - -## 📑 Description - - - -You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - -- [ ] Not Completed -- [ x ] Completed - -## ✅ Checks - - - -- [ ] My pull request adheres to the code style of this project -- [ ] My code requires changes to the documentation -- [ ] I have updated the documentation as required -- [ ] All the tests have passed diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index fb8a9e5..cef1849 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,28 +1,25 @@ - - -## Description - - -## Motivation and Context - - - -## How has this been tested? - - - - -## Screenshots (if appropriate): - -## Types of changes - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - -## Checklist: - - -- [ ] My code follows the code style of this project. -- [ ] My change requires a change to the documentation. -- [ ] I have updated the documentation accordingly. +# Thanks for creating this pull request 🤗 + +Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. + +If this pull request closes an issue, please mention the issue number below. + +Closes # + +## 📑 Description + + + +You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax + +- [ ] Not Completed +- [ x ] Completed + +## ✅ Checks + + + +- [ ] My pull request adheres to the code style of this project +- [ ] My code requires changes to the documentation +- [ ] I have updated the documentation as required +- [ ] All the tests have passed diff --git a/.github/workflows/lint_chacks.yml b/.github/workflows/lint_chacks.yml index 66885b2..f63cbca 100644 --- a/.github/workflows/lint_chacks.yml +++ b/.github/workflows/lint_chacks.yml @@ -16,18 +16,18 @@ jobs: - name: Setup Node.js 🫡 uses: actions/setup-node@v2 with: - node-version: "20.9.0" + node-version: "20.9.0" # Use a specific Node.js version, adjust as needed - name: Install Dependencies ☘️ - run: | - npm install + run: npm i # Use npm i for faster and more consistent installs - - name: lint Chacks ✅ + - name: Tests and Linting ✅ run: | - npm run lint + npm run format # Run Prettier to format code + npm run lint # Run linting checks + # If any of the above steps fail, the workflow will stop - - name: production build ✨ - run: | - npm run build + - name: Production build ✨ + run: npm run build env: - GENERATIVE_API_KEY: ${{ secrets.GENERATIVE_API_KEY }} \ No newline at end of file + GENERATIVE_API_KEY: ${{ secrets.GENERATIVE_API_KEY }} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c4e51d7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +# Ignore artifacts: + +.next +.vercel +node_modules \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/.vscode/settings.json b/.vscode/settings.json index a58c77c..f5b66ae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,5 +36,6 @@ "glassit.step": 500, // "bitoAI.codeCompletion.enableCommentToCode": true, // "bitoAI.codeCompletion.enableAutoCompletion": true, - "cmake.options.statusBarVisibility": "hidden" + "cmake.options.statusBarVisibility": "hidden", + "editor.cursorBlinking": "smooth" } \ No newline at end of file diff --git a/actions/admin.ts b/actions/admin.ts index bf05b08..72c78dc 100644 --- a/actions/admin.ts +++ b/actions/admin.ts @@ -10,5 +10,5 @@ export const admin = async () => { return { success: "Allowed Server Action!" }; } - return { error: "Forbidden Server Action!" } + return { error: "Forbidden Server Action!" }; }; diff --git a/actions/login.ts b/actions/login.ts index 1791ec3..792d1a5 100644 --- a/actions/login.ts +++ b/actions/login.ts @@ -18,7 +18,7 @@ import { getTwoFactorConfirmationByUserId } from "@/data/two-factor-confirmation export const login = async ( values: z.infer, - callbackUrl?: string | null + callbackUrl?: string | null, ) => { const validatedFields = LoginSchema.safeParse(values); @@ -36,12 +36,12 @@ export const login = async ( if (!existingUser.emailVerified) { const verificationToken = await generateVerificationToken( - existingUser.email + existingUser.email, ); await sendVerificationEmail( verificationToken.email, - verificationToken.token + verificationToken.token, ); return { success: "Confirmation email sent!" }; @@ -70,7 +70,7 @@ export const login = async ( }); const existingConfirmation = await getTwoFactorConfirmationByUserId( - existingUser.id + existingUser.id, ); if (existingConfirmation) { diff --git a/actions/new-password.ts b/actions/new-password.ts index b032d4e..06d4d76 100644 --- a/actions/new-password.ts +++ b/actions/new-password.ts @@ -9,7 +9,7 @@ import { getUserByEmail } from "@/data/user"; import { db } from "@/lib/db"; export const newPassword = async ( - values: z.infer , + values: z.infer, token?: string | null, ) => { if (!token) { @@ -39,7 +39,7 @@ export const newPassword = async ( const existingUser = await getUserByEmail(existingToken.email); if (!existingUser) { - return { error: "Email does not exist!" } + return { error: "Email does not exist!" }; } const hashedPassword = await bcrypt.hash(password, 10); @@ -50,7 +50,7 @@ export const newPassword = async ( }); await db.passwordResetToken.delete({ - where: { id: existingToken.id } + where: { id: existingToken.id }, }); return { success: "Password updated!" }; diff --git a/actions/repo/branchCount.ts b/actions/repo/branchCount.ts index 2a9fe6b..74eba53 100644 --- a/actions/repo/branchCount.ts +++ b/actions/repo/branchCount.ts @@ -13,6 +13,6 @@ export const fetchrepo = async (username: string, repository: string) => { author: username, }, }); - console.log(repo) + console.log(repo); return { repo: repo }; }; diff --git a/actions/repo/create.ts b/actions/repo/create.ts index 88ca92d..8fd2ef5 100644 --- a/actions/repo/create.ts +++ b/actions/repo/create.ts @@ -8,7 +8,7 @@ import { User } from "@prisma/client"; export const create = async ( values: z.infer, - user: User + user: User, ) => { const validatedFields = RepoSchema.safeParse(values); @@ -28,7 +28,7 @@ export const create = async ( }, }); - console.log(existingRepo); + // console.log(existingRepo); if (existingRepo) { return { error: "Repository already exist with this name!" }; diff --git a/actions/repo/fetch.ts b/actions/repo/fetch.ts index 7fafae5..e2e9fbd 100644 --- a/actions/repo/fetch.ts +++ b/actions/repo/fetch.ts @@ -6,7 +6,7 @@ import { User } from "@prisma/client"; export const fetchRepo = async ( username: string, repository: string, - user?: User | null + user?: User | null, ) => { if (!username || !repository) { return { error: "Invalid user or repository!" }; diff --git a/actions/reset.ts b/actions/reset.ts index 79e6a53..370ed92 100644 --- a/actions/reset.ts +++ b/actions/reset.ts @@ -29,4 +29,4 @@ export const reset = async (values: z.infer) => { ); return { success: "Reset email sent!" }; -} \ No newline at end of file +}; diff --git a/actions/settings.ts b/actions/settings.ts index a092724..e4804d2 100644 --- a/actions/settings.ts +++ b/actions/settings.ts @@ -11,19 +11,17 @@ import { currentUser } from "@/lib/auth"; import { generateVerificationToken } from "@/lib/tokens"; import { sendVerificationEmail } from "@/lib/mail"; -export const settings = async ( - values: z.infer -) => { +export const settings = async (values: z.infer) => { const user = await currentUser(); if (!user || !user.id) { - return { error: "Unauthorized" } + return { error: "Unauthorized" }; } const dbUser = await getUserById(user.id); if (!dbUser) { - return { error: "Unauthorized" } + return { error: "Unauthorized" }; } if (user.isOAuth) { @@ -37,12 +35,10 @@ export const settings = async ( const existingUser = await getUserByEmail(values.email); if (existingUser && existingUser.id !== user.id) { - return { error: "Email already in use!" } + return { error: "Email already in use!" }; } - const verificationToken = await generateVerificationToken( - values.email - ); + const verificationToken = await generateVerificationToken(values.email); await sendVerificationEmail( verificationToken.email, verificationToken.token, @@ -61,10 +57,7 @@ export const settings = async ( return { error: "Incorrect password!" }; } - const hashedPassword = await bcrypt.hash( - values.newPassword, - 10, - ); + const hashedPassword = await bcrypt.hash(values.newPassword, 10); values.password = hashedPassword; values.newPassword = undefined; } @@ -73,7 +66,7 @@ export const settings = async ( where: { id: dbUser.id }, data: { ...values, - } + }, }); update({ @@ -82,8 +75,8 @@ export const settings = async ( email: updatedUser.email, isTwoFactorEnabled: updatedUser.isTwoFactorEnabled, role: updatedUser.role, - } + }, }); - return { success: "Settings Updated!" } -} \ No newline at end of file + return { success: "Settings Updated!" }; +}; diff --git a/actions/user/update-bio.ts b/actions/user/update-bio.ts new file mode 100644 index 0000000..ff1b143 --- /dev/null +++ b/actions/user/update-bio.ts @@ -0,0 +1,17 @@ +"use server"; + +import { db } from "@/lib/db"; + +export const updateBio = async (username: string, bio: string) => { + if (!username) { + return { error: "Invalid user!" }; + } + await db.user.update({ + where: { username: username }, + data: { + bio: bio, + }, + }); + + return { success: "Profile update Successfully! 🎉" }; +}; diff --git a/app/(auth)/error/page.tsx b/app/(auth)/error/page.tsx index 75baf36..22eb590 100644 --- a/app/(auth)/error/page.tsx +++ b/app/(auth)/error/page.tsx @@ -1,9 +1,7 @@ import { ErrorCard } from "@/components/auth/error-card"; const AuthErrorPage = () => { - return ( - - ); + return ; }; - + export default AuthErrorPage; diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsx index f62a60c..3d45083 100644 --- a/app/(auth)/layout.tsx +++ b/app/(auth)/layout.tsx @@ -1,13 +1,7 @@ -const AuthLayout = ({ - children -}: { - children: React.ReactNode -}) => { - return ( -
- {children} -
- ); -} - -export default AuthLayout; \ No newline at end of file +const AuthLayout = ({ children }: { children: React.ReactNode }) => { + return ( +
{children}
+ ); +}; + +export default AuthLayout; diff --git a/app/(auth)/new-password/page.tsx b/app/(auth)/new-password/page.tsx index 24561de..c304b9f 100644 --- a/app/(auth)/new-password/page.tsx +++ b/app/(auth)/new-password/page.tsx @@ -1,9 +1,7 @@ import { NewPasswordForm } from "@/components/auth/new-password-form"; const NewPasswordPage = () => { - return ( - - ); -} - -export default NewPasswordPage; \ No newline at end of file + return ; +}; + +export default NewPasswordPage; diff --git a/app/(auth)/new-verification/page.tsx b/app/(auth)/new-verification/page.tsx index 1fb40a7..3b44bc7 100644 --- a/app/(auth)/new-verification/page.tsx +++ b/app/(auth)/new-verification/page.tsx @@ -1,9 +1,7 @@ import { NewVerificationForm } from "@/components/auth/new-verification-form"; const NewVerificationPage = () => { - return ( - - ); -} - -export default NewVerificationPage; \ No newline at end of file + return ; +}; + +export default NewVerificationPage; diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index 61744b3..8871c46 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -1,15 +1,13 @@ import { RegisterForm } from "@/components/auth/register-form"; -import type { Metadata } from 'next' - +import type { Metadata } from "next"; + export const metadata: Metadata = { - title: 'Cocola - Register', - description: 'Cocola • Register your account. ✨', - keywords: ['register', 'cocola', 'Cocola - Register'], -} + title: "Cocola - Register", + description: "Cocola • Register your account. ✨", + keywords: ["register", "cocola", "Cocola - Register"], +}; const RegisterPage = () => { - return ( - - ); -} - -export default RegisterPage; \ No newline at end of file + return ; +}; + +export default RegisterPage; diff --git a/app/(auth)/reset/page.tsx b/app/(auth)/reset/page.tsx index 46bcacd..700540a 100644 --- a/app/(auth)/reset/page.tsx +++ b/app/(auth)/reset/page.tsx @@ -1,9 +1,7 @@ import { ResetForm } from "@/components/auth/reset-form"; const ResetPage = () => { - return ( - - ); -} - -export default ResetPage; \ No newline at end of file + return ; +}; + +export default ResetPage; diff --git a/app/(protected)/_components/navbar.tsx b/app/(protected)/_components/navbar.tsx index cefd523..417d5ce 100644 --- a/app/(protected)/_components/navbar.tsx +++ b/app/(protected)/_components/navbar.tsx @@ -12,37 +12,26 @@ export const Navbar = () => { return (