diff --git a/backend/test.py b/backend/test.py new file mode 100644 index 0000000..a2f0468 --- /dev/null +++ b/backend/test.py @@ -0,0 +1,38 @@ +import spacy + +# Load spaCy model +nlp = spacy.load("en_core_web_sm") + +# List of valid domains +valid_domains = [ + "web development", "data science", "data analytics", + "cybersecurity", "game development", "blockchain", "machine learning" +] + +# Function to find the best match +def find_best_match_spacy(user_input): + input_doc = nlp(user_input) + domain_docs = [nlp(domain) for domain in valid_domains] + + # Compute similarity scores + similarities = [input_doc.similarity(domain_doc) for domain_doc in domain_docs] + + # Get the top 3 matches + sorted_indices = sorted(range(len(similarities)), key=lambda i: similarities[i], reverse=True) + suggestions = [(valid_domains[i], similarities[i]) for i in sorted_indices[:3]] + return suggestions + +# Main script +user_input = input("Enter your domain of interest: ").strip().lower() +suggestions = find_best_match_spacy(user_input) + +print(f"Did you mean one of these?") +for i, (suggestion, score) in enumerate(suggestions, 1): + print(f"{i}. {suggestion} (Similarity: {score:.2f})") + +choice = input("Enter the number of your choice (or type 'none' to re-enter): ").strip().lower() +if choice.isdigit() and 1 <= int(choice) <= len(suggestions): + corrected_input = suggestions[int(choice) - 1][0] + print(f"You selected: {corrected_input}") +else: + print("Please re-enter your domain of interest.") diff --git a/frontend/app/globals.css b/frontend/app/globals.css index 4b28afe..2847583 100644 --- a/frontend/app/globals.css +++ b/frontend/app/globals.css @@ -39,6 +39,14 @@ body { --chart-4: 43 74% 66%; --chart-5: 27 87% 67%; --radius: 0.5rem; + --sidebar-background: 0 0% 98%; + --sidebar-foreground: 240 5.3% 26.1%; + --sidebar-primary: 240 5.9% 10%; + --sidebar-primary-foreground: 0 0% 98%; + --sidebar-accent: 240 4.8% 95.9%; + --sidebar-accent-foreground: 240 5.9% 10%; + --sidebar-border: 220 13% 91%; + --sidebar-ring: 217.2 91.2% 59.8%; } .dark { --background: 240 10% 3.9%; @@ -65,6 +73,14 @@ body { --chart-3: 30 80% 55%; --chart-4: 280 65% 60%; --chart-5: 340 75% 55%; + --sidebar-background: 240 5.9% 10%; + --sidebar-foreground: 240 4.8% 95.9%; + --sidebar-primary: 224.3 76.3% 48%; + --sidebar-primary-foreground: 0 0% 100%; + --sidebar-accent: 240 3.7% 15.9%; + --sidebar-accent-foreground: 240 4.8% 95.9%; + --sidebar-border: 240 3.7% 15.9%; + --sidebar-ring: 217.2 91.2% 59.8%; } } diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 486ce88..e25183e 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -1,5 +1,6 @@ +import { SidebarProvider } from '@/components/ui/sidebar' +import { AppSidebar } from '@/components/sidebar' import type { Metadata } from "next"; -import localFont from "next/font/local"; import "./globals.css"; export const metadata: Metadata = { @@ -15,7 +16,14 @@ export default function RootLayout({ return ( - {children} + +
+ +
+ {children} +
+
+
); diff --git a/frontend/app/onboarding_quiz/page.tsx b/frontend/app/onboarding_quiz/page.tsx index 8956e90..fed8423 100644 --- a/frontend/app/onboarding_quiz/page.tsx +++ b/frontend/app/onboarding_quiz/page.tsx @@ -19,7 +19,7 @@ type QuizData = { questions: Question[] } -export function TechnicalInterviewQuiz() { +export default function TechnicalInterviewQuiz() { const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0) const [answers, setAnswers] = useState>({}) const [quizCompleted, setQuizCompleted] = useState(false) @@ -152,7 +152,7 @@ export function TechnicalInterviewQuiz() { if (!quizStarted) { return ( - + Technical Interview Preparation Please fill in your details to start the quiz diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index d2acf79..6ed969c 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -1,12 +1,16 @@ -import Image from "next/image"; -import VideoConferencing from "./meet/page"; -import PeerMessaging from "./peer-messaging/page"; -import { TechnicalInterviewQuiz } from "./onboarding_quiz/page"; +import Link from 'next/link' export default function Home() { return ( -
- +
+

Welcome to the Interview Platform

+

Please select a feature from the sidebar to get started:

+
    +
  • Video Conferencing
  • +
  • Technical Interview Quiz
  • +
  • Peer Messaging
  • +
- ); + ) } + diff --git a/frontend/components/peer-messaging.tsx b/frontend/components/peer-messaging.tsx new file mode 100644 index 0000000..e4e83bd --- /dev/null +++ b/frontend/components/peer-messaging.tsx @@ -0,0 +1,9 @@ +export default function PeerMessaging() { + return ( +
+

Peer Messaging

+

Peer messaging component content goes here.

+
+ ) +} + diff --git a/frontend/components/sidebar.tsx b/frontend/components/sidebar.tsx new file mode 100644 index 0000000..59efec1 --- /dev/null +++ b/frontend/components/sidebar.tsx @@ -0,0 +1,57 @@ +"use client" + +import Link from 'next/link' +import { usePathname } from 'next/navigation' +import { Video, FileQuestion, MessageSquare } from 'lucide-react' + +import { + Sidebar, + SidebarContent, + SidebarGroup, + SidebarGroupContent, + SidebarGroupLabel, + SidebarHeader, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + SidebarRail, +} from '@/components/ui/sidebar' + +const menuItems = [ + { name: 'Video Conferencing', icon: Video, href: '/meet' }, + { name: 'Technical Interview Quiz', icon: FileQuestion, href: '/onboarding_quiz' }, + { name: 'Peer Messaging', icon: MessageSquare, href: '/peer-messaging' }, +] + +export function AppSidebar() { + const pathname = usePathname() + + return ( + + +

Interview Platform

+
+ + + Features + + + {menuItems.map((item) => ( + + + + + {item.name} + + + + ))} + + + + + +
+ ) +} + diff --git a/frontend/components/technical-interview-quiz.tsx b/frontend/components/technical-interview-quiz.tsx new file mode 100644 index 0000000..d0ba699 --- /dev/null +++ b/frontend/components/technical-interview-quiz.tsx @@ -0,0 +1,9 @@ +export default function TechnicalInterviewQuiz() { + return ( +
+

Technical Interview Quiz

+

Technical interview quiz component content goes here.

+
+ ) +} + diff --git a/frontend/components/ui/separator.tsx b/frontend/components/ui/separator.tsx new file mode 100644 index 0000000..12d81c4 --- /dev/null +++ b/frontend/components/ui/separator.tsx @@ -0,0 +1,31 @@ +"use client" + +import * as React from "react" +import * as SeparatorPrimitive from "@radix-ui/react-separator" + +import { cn } from "@/lib/utils" + +const Separator = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>( + ( + { className, orientation = "horizontal", decorative = true, ...props }, + ref + ) => ( + + ) +) +Separator.displayName = SeparatorPrimitive.Root.displayName + +export { Separator } diff --git a/frontend/components/ui/sheet.tsx b/frontend/components/ui/sheet.tsx new file mode 100644 index 0000000..272cb72 --- /dev/null +++ b/frontend/components/ui/sheet.tsx @@ -0,0 +1,140 @@ +"use client" + +import * as React from "react" +import * as SheetPrimitive from "@radix-ui/react-dialog" +import { cva, type VariantProps } from "class-variance-authority" +import { X } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Sheet = SheetPrimitive.Root + +const SheetTrigger = SheetPrimitive.Trigger + +const SheetClose = SheetPrimitive.Close + +const SheetPortal = SheetPrimitive.Portal + +const SheetOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName + +const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out", + { + variants: { + side: { + top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", + bottom: + "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", + left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + right: + "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + } +) + +interface SheetContentProps + extends React.ComponentPropsWithoutRef, + VariantProps {} + +const SheetContent = React.forwardRef< + React.ElementRef, + SheetContentProps +>(({ side = "right", className, children, ...props }, ref) => ( + + + + + + Close + + {children} + + +)) +SheetContent.displayName = SheetPrimitive.Content.displayName + +const SheetHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +SheetHeader.displayName = "SheetHeader" + +const SheetFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +SheetFooter.displayName = "SheetFooter" + +const SheetTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetTitle.displayName = SheetPrimitive.Title.displayName + +const SheetDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetDescription.displayName = SheetPrimitive.Description.displayName + +export { + Sheet, + SheetPortal, + SheetOverlay, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +} diff --git a/frontend/components/ui/sidebar.tsx b/frontend/components/ui/sidebar.tsx new file mode 100644 index 0000000..eeb2d7a --- /dev/null +++ b/frontend/components/ui/sidebar.tsx @@ -0,0 +1,763 @@ +"use client" + +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { VariantProps, cva } from "class-variance-authority" +import { PanelLeft } from "lucide-react" + +import { useIsMobile } from "@/hooks/use-mobile" +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Separator } from "@/components/ui/separator" +import { Sheet, SheetContent } from "@/components/ui/sheet" +import { Skeleton } from "@/components/ui/skeleton" +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip" + +const SIDEBAR_COOKIE_NAME = "sidebar:state" +const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 +const SIDEBAR_WIDTH = "16rem" +const SIDEBAR_WIDTH_MOBILE = "18rem" +const SIDEBAR_WIDTH_ICON = "3rem" +const SIDEBAR_KEYBOARD_SHORTCUT = "b" + +type SidebarContext = { + state: "expanded" | "collapsed" + open: boolean + setOpen: (open: boolean) => void + openMobile: boolean + setOpenMobile: (open: boolean) => void + isMobile: boolean + toggleSidebar: () => void +} + +const SidebarContext = React.createContext(null) + +function useSidebar() { + const context = React.useContext(SidebarContext) + if (!context) { + throw new Error("useSidebar must be used within a SidebarProvider.") + } + + return context +} + +const SidebarProvider = React.forwardRef< + HTMLDivElement, + React.ComponentProps<"div"> & { + defaultOpen?: boolean + open?: boolean + onOpenChange?: (open: boolean) => void + } +>( + ( + { + defaultOpen = true, + open: openProp, + onOpenChange: setOpenProp, + className, + style, + children, + ...props + }, + ref + ) => { + const isMobile = useIsMobile() + const [openMobile, setOpenMobile] = React.useState(false) + + // This is the internal state of the sidebar. + // We use openProp and setOpenProp for control from outside the component. + const [_open, _setOpen] = React.useState(defaultOpen) + const open = openProp ?? _open + const setOpen = React.useCallback( + (value: boolean | ((value: boolean) => boolean)) => { + const openState = typeof value === "function" ? value(open) : value + if (setOpenProp) { + setOpenProp(openState) + } else { + _setOpen(openState) + } + + // This sets the cookie to keep the sidebar state. + document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}` + }, + [setOpenProp, open] + ) + + // Helper to toggle the sidebar. + const toggleSidebar = React.useCallback(() => { + return isMobile + ? setOpenMobile((open) => !open) + : setOpen((open) => !open) + }, [isMobile, setOpen, setOpenMobile]) + + // Adds a keyboard shortcut to toggle the sidebar. + React.useEffect(() => { + const handleKeyDown = (event: KeyboardEvent) => { + if ( + event.key === SIDEBAR_KEYBOARD_SHORTCUT && + (event.metaKey || event.ctrlKey) + ) { + event.preventDefault() + toggleSidebar() + } + } + + window.addEventListener("keydown", handleKeyDown) + return () => window.removeEventListener("keydown", handleKeyDown) + }, [toggleSidebar]) + + // We add a state so that we can do data-state="expanded" or "collapsed". + // This makes it easier to style the sidebar with Tailwind classes. + const state = open ? "expanded" : "collapsed" + + const contextValue = React.useMemo( + () => ({ + state, + open, + setOpen, + isMobile, + openMobile, + setOpenMobile, + toggleSidebar, + }), + [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar] + ) + + return ( + + +
+ {children} +
+
+
+ ) + } +) +SidebarProvider.displayName = "SidebarProvider" + +const Sidebar = React.forwardRef< + HTMLDivElement, + React.ComponentProps<"div"> & { + side?: "left" | "right" + variant?: "sidebar" | "floating" | "inset" + collapsible?: "offcanvas" | "icon" | "none" + } +>( + ( + { + side = "left", + variant = "sidebar", + collapsible = "offcanvas", + className, + children, + ...props + }, + ref + ) => { + const { isMobile, state, openMobile, setOpenMobile } = useSidebar() + + if (collapsible === "none") { + return ( +
+ {children} +
+ ) + } + + if (isMobile) { + return ( + + +
{children}
+
+
+ ) + } + + return ( +
+ {/* This is what handles the sidebar gap on desktop */} +
+ +
+ ) + } +) +Sidebar.displayName = "Sidebar" + +const SidebarTrigger = React.forwardRef< + React.ElementRef, + React.ComponentProps +>(({ className, onClick, ...props }, ref) => { + const { toggleSidebar } = useSidebar() + + return ( + + ) +}) +SidebarTrigger.displayName = "SidebarTrigger" + +const SidebarRail = React.forwardRef< + HTMLButtonElement, + React.ComponentProps<"button"> +>(({ className, ...props }, ref) => { + const { toggleSidebar } = useSidebar() + + return ( +