From 59507d9666b50c8b14edf522089a6d5c58466166 Mon Sep 17 00:00:00 2001 From: ruru <142723369+ruru-m07@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:14:26 +0530 Subject: [PATCH 1/3] ADD: Update Bio Co-Authored-By: ruru --- .vscode/settings.json | 3 +- actions/repo/create.ts | 2 +- actions/user/update-bio.ts | 17 ++ .../[repository]/components/Code.tsx | 10 +- .../upload/[branch]/[[...path]]/page.tsx | 12 ++ .../[repository]/upload/components/Upload.tsx | 151 +++++++++++++++ app/[username]/components/UserSide.tsx | 80 +++++++- app/chat/[user]/loading.tsx | 2 +- app/chat/layout.tsx | 2 +- app/chat/loading.tsx | 16 ++ app/favicon.ico | Bin 0 -> 4286 bytes app/globals.css | 56 ++++++ app/loading.tsx | 6 +- app/page.tsx | 173 +++++++++++++++++- components/Loader2.tsx | 47 +++-- components/Navbar.tsx | 3 +- components/nav/Side.tsx | 5 +- components/nav/leftside.tsx | 4 +- components/nav/navItems.tsx | 2 +- components/ui/button.tsx | 6 + context/userContext.tsx | 3 +- middleware.ts | 57 ------ package-lock.json | 36 ++++ package.json | 7 +- protectedRouter.tsx | 12 +- 25 files changed, 605 insertions(+), 107 deletions(-) create mode 100644 actions/user/update-bio.ts create mode 100644 app/[username]/[repository]/upload/[branch]/[[...path]]/page.tsx create mode 100644 app/[username]/[repository]/upload/components/Upload.tsx create mode 100644 app/chat/loading.tsx create mode 100644 app/favicon.ico delete mode 100644 middleware.ts 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/repo/create.ts b/actions/repo/create.ts index 32e54d0..8fd2ef5 100644 --- a/actions/repo/create.ts +++ b/actions/repo/create.ts @@ -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/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/[username]/[repository]/components/Code.tsx b/app/[username]/[repository]/components/Code.tsx index a4a8c4c..1bba392 100644 --- a/app/[username]/[repository]/components/Code.tsx +++ b/app/[username]/[repository]/components/Code.tsx @@ -119,7 +119,7 @@ export function Code({ repodata }: { repodata: Repository }) {
- + + +
diff --git a/app/[username]/[repository]/upload/[branch]/[[...path]]/page.tsx b/app/[username]/[repository]/upload/[branch]/[[...path]]/page.tsx new file mode 100644 index 0000000..d4b8f64 --- /dev/null +++ b/app/[username]/[repository]/upload/[branch]/[[...path]]/page.tsx @@ -0,0 +1,12 @@ +import Upload from "../../components/Upload"; + +export default function Page() { + + return ( +
+
+ +
+
+ ); +} diff --git a/app/[username]/[repository]/upload/components/Upload.tsx b/app/[username]/[repository]/upload/components/Upload.tsx new file mode 100644 index 0000000..52cfdc9 --- /dev/null +++ b/app/[username]/[repository]/upload/components/Upload.tsx @@ -0,0 +1,151 @@ +"use client"; + +import React, { useEffect, useState } from "react"; +import Dropzone from "react-dropzone"; +import { FileWithPath } from "file-selector"; +import { + FileCode2, + GitCommitHorizontal, + GitPullRequestArrow, +} from "lucide-react"; +import { Card } from "@/components/ui/card"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; +import { useAuth } from "@/context/userContext"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import { Button } from "@/components/ui/button"; +import { Label } from "@/components/ui/label"; +import { useParams } from "next/navigation"; +import Link from "next/link"; + +const Upload = () => { + const { user } = useAuth(); + const params = useParams<{ + username: string; + repository: string; + branch: string; + }>(); + console.log(params); + const [files, setFiles] = useState([]); + + const handlechange = async (acceptFiles: FileWithPath[]) => { + // Items to ignore + const ignoreList = [ + ".env", + "node_modules", + ".git", + ".next", + ".vercel", + "dist", + ]; + + // console.log(acceptFiles); + // Filter out files or folders listed in the ignoreList + + const filteredFiles = acceptFiles.filter((file) => { + const fileName = file.path && file.path.toLowerCase(); + return !ignoreList.some((item) => fileName?.includes(item.toLowerCase())); + }); + + setFiles((prevFiles) => [...prevFiles, ...filteredFiles]); + }; + + useEffect(() => { + console.log(files); + }, [files]); + + return ( +
+
+ {params.repository} {" "} / +
+
+ handlechange(acceptedFiles)}> + {({ getRootProps, getInputProps, isDragActive }) => ( +
+
+ + {isDragActive ? ( +
+
+ +

+ Drop to Upload file +

+
+
+ ) : ( +
+ + +

+ Drag files here to add them to your repository +

+

+ or + + choose your file + +

+
+ )} +
+
+ )} +
+
+ + +
+ + + + +
+
+ +

Commit changes

+ +