Skip to content

Commit

Permalink
FIX: Cyclic Import
Browse files Browse the repository at this point in the history
This is not clear for now atleast. Feel free to update with the changes. Will be resolving in hotly.
  • Loading branch information
SujithThirumalaisamy committed May 12, 2024
1 parent 6beb890 commit 741c6a1
Show file tree
Hide file tree
Showing 98 changed files with 190 additions and 243 deletions.
2 changes: 1 addition & 1 deletion apps/web/app/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Admin } from "@repo/ui/pages";
import { Admin } from "../../components/pages";
import { AppbarClient } from "../../components/AppbarClient";

export default async function AdminPage() {
Expand Down
Empty file removed apps/web/components.json
Empty file.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
"use client";
import { useState } from "react";
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./shad/ui/card";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./shad/ui/select";
import { Input } from "./shad/ui/input";
import { Button } from "./shad/ui/button";
import { useToast } from "./shad/ui/use-toast";
import { createProblem } from "../../../apps/web/components/utils";
import { useRouter } from "next/navigation";
import { Problem,ProblemType } from "@prisma/client";
import { createProblem, createProblemStatement } from "../../../apps/web/components/utils";
import ProblemStatementForm from "./code/admin/ProblemStatementForm";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@repo/ui/shad/ui";
import { Input } from "@repo/ui/shad/ui";
import { Button } from "@repo/ui/shad/ui";
import { useToast } from "@repo/ui/shad/ui";
import { ProblemType } from "@prisma/client";
import { createProblem, createProblemStatement } from "./utils";

interface Problem {
id: string;
Expand Down
10 changes: 5 additions & 5 deletions apps/web/components/AddProblemStatementForm.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"use client";
import { Input } from "@repo/ui/input";
import { Input } from "@repo/ui/shad/ui";
import { useState } from "react";
import { Problem, CodeLanguage } from "@prisma/client";
import { Button } from "@repo/ui/button";
import { Label } from "@repo/ui/label";
import { Checkbox } from "@repo/ui/checkbox";
import { Button } from "@repo/ui/shad/ui";
import { Label } from "@repo/ui/shad/ui";
import { Checkbox } from "@repo/ui/shad/ui";
import AddTestCase from "./AddTestCase";
import { useRecoilValue } from "recoil";
import { adminTestCasesState } from "@repo/store";
import { Card, CardContent } from "@repo/ui/card";
import { Card, CardContent } from "@repo/ui/shad/ui";
import { createProblemStatement } from "./utils";

export const AddProblemStatementForm = ({ problem, languages }: { problem: Problem; languages: CodeLanguage[] }) => {
Expand Down
8 changes: 4 additions & 4 deletions apps/web/components/AddTestCase.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import { Input } from "@repo/ui/input";
import { Button } from "@repo/ui/button";
import { Label } from "@repo/ui/label";
import { Input } from "@repo/ui/shad/ui";
import { Button } from "@repo/ui/shad/ui";
import { Label } from "@repo/ui/shad/ui";

import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@repo/ui/components";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@repo/ui/shad/ui";
import { useState } from "react";
import { useSetRecoilState } from "recoil";
import { adminTestCasesState } from "@repo/store";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import { useState } from "react";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Input } from "./shad/ui/input";
import { Button } from "./shad/ui/button";
import { useToast } from "./shad/ui/use-toast";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import { Input } from "@repo/ui/shad/ui";
import { Button } from "@repo/ui/shad/ui";
import { useToast } from "@repo/ui/shad/ui";
import { createTrack } from "../../../apps/web/components/utils";
import { Categories } from "@prisma/client";
import { Track } from "@prisma/client";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEffect, useState } from "react";
import { Sheet, SheetContent, SheetTrigger } from "./shad/ui/sheet";
import { Button } from "./shad/ui/button";
import { Input } from "./shad/ui/input";
import { Card, CardDescription, CardTitle } from "./shad/ui/card";
import { Sheet, SheetContent, SheetTrigger } from "@repo/ui/shad/ui";
import { Button } from "@repo/ui/shad/ui";
import { Input } from "@repo/ui/shad/ui";
import { Card, CardDescription, CardTitle } from "@repo/ui/shad/ui";
import { MCQQuestion, Problem } from "@prisma/client";
import { createMCQ, deleteMCQ, getAllMCQQuestion } from "web/components/utils";
import EditMCQ from "./mcq/EditMCQ";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useEffect, useState } from "react";
import { Button } from ".";
import { Button } from "@repo/ui/shad/ui";
import { useRouter } from "next/navigation";

export const AdminButton = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import { useEffect, useState } from "react";
import { getAllMCQs } from "../../../apps/web/components/utils";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import { Problem, MCQQuestion } from "@prisma/client";
import AdminAddMCQ from "./AdminAddMCQ";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from "next/link";
import { Button } from ".";
import { Button } from "@repo/ui/shad/ui";
import { ModeToggle } from "./ModeToggle";
import { signIn } from "next-auth/react";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/AppbarClient.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Appbar } from "@repo/ui/components";
import { Appbar } from "../components/Appbar";
import { Track, Problem } from "@prisma/client";

export const AppbarClient = ({ tracks }: { tracks: (Track & { problems: Problem[] })[] }) => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use client";

import { Button } from "./shad/ui/button";
import { Button } from "@repo/ui/shad/ui";
import { Problem, Track, CodeLanguage, ProblemStatement, TestCase } from "@prisma/client";
import { useEffect, useMemo, useState } from "react";
import { useEffect, useState } from "react";
import Link from "next/link";
import { ChevronLeftIcon, ChevronRightIcon, DownloadIcon } from "@radix-ui/react-icons";
import { ModeToggle } from "./ModeToggle";
import { PageToggle } from "./PageToggle";
import { useRouter } from "next/navigation";
import UserAccountDropDown from "./UserAccountDropDown";
import { Codebar } from "./code/Codebar";
import { Codebar } from "web/components/code/Codebar";

export const BlogAppbar = ({
problem,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
import { useRecoilState } from "recoil";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./shad/ui/select";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@repo/ui/shad/ui";
import { category } from "@repo/store";
import { Button } from "./shad/ui/button";
import { Button } from "@repo/ui/shad/ui";

interface Category {
category: string;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import hljs from "highlight.js";
import javascript from "highlight.js/lib/languages/javascript";
import styles from "../app/CodeBlock.module.css";
import styles from "./CodeBlock.module.css";
import "highlight.js/styles/github-dark.css";

export default function CodeBlock({ block }: { block: any }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import { useEffect, useState } from "react";
import { Input } from "./shad/ui/input";
import { Track,Categories,TrackCategory } from "@prisma/client";
import { Input } from "@repo/ui/shad/ui";
import { Categories } from "@prisma/client";
import CompleteTrackCard from "./CompleteTrackCard";
import { Button } from "./shad/ui/button";
import { Button } from "@repo/ui/shad/ui";

export interface CompleteTrack {
trackId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Prisma, ProblemType } from "@prisma/client";
import { useEffect, useState } from "react";
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "./shad/ui/sheet";
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "@repo/ui/shad/ui";
import EditProblem from "./EditProblem";
import { Button } from "./shad/ui/button";
import { Button } from "@repo/ui/shad/ui";
import { createTrack } from "../../../apps/web/components/utils";

interface CompleteProblemCard {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import { Prisma } from "@prisma/client";
import { useState } from "react";
import { Button } from "./shad/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Input } from "./shad/ui/input";
import { Button } from "@repo/ui/shad/ui";
import { Card, CardContent, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import { Input } from "@repo/ui/shad/ui";

const EditProblem = ({ problem }: { problem: Prisma.ProblemCreateManyInput }) => {
const [isEditing, setIsEditing] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import { useState } from "react";
import { Button } from "./shad/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Button } from "@repo/ui/shad/ui";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import { Track,Categories } from "@prisma/client";
import { Input } from "./shad/ui/input";
import { Input } from "@repo/ui/shad/ui";
import { updateTrack } from "../../../apps/web/components/utils";

interface TrackCardProps extends Track {
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions apps/web/components/LessonView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Blog } from "@repo/ui/Blog";
import { CodeProblemRenderer } from "@repo/ui/CodeProblemRenderer";
import { Blog } from "./Blog";
import { Problem, Track, ProblemStatement, CodeLanguage, TestCase } from "@prisma/client";
import MCQRenderer from "@repo/ui/MCQRenderer";
import RedirectToLoginCard from '@repo/ui/RedirectToLoginCard';
import MCQRenderer from "./mcq/MCQRenderer";
import RedirectToLoginCard from './RedirectToLoginCard';

import db from "@repo/db/client";
import { getServerSession } from "next-auth";
import { authOptions } from "../lib/auth";
import { CodeProblemRenderer } from "./code/CodeProblemRenderer";

const getSubmissions = async (problemStatementId: string) => {
const session = await getServerSession(authOptions);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";
import { Button } from "./shad/ui/button";
import { Button } from "@repo/ui/shad/ui";
import { TrackProblems, Track } from "@prisma/client";
import { Input } from "./shad/ui/input";
import { Sheet, SheetContent, SheetTrigger } from "./shad/ui/sheet";
import { Input } from "@repo/ui/shad/ui";
import { Sheet, SheetContent, SheetTrigger } from "@repo/ui/shad/ui";
import ProblemCard from "./ProblemCard";
import { useState } from "react";
import { createTrackProblems } from "../../../apps/web/components/utils";
import { Card, CardDescription, CardTitle } from "./shad/ui/card";
import { Card, CardDescription, CardTitle } from "@repo/ui/shad/ui";

interface LinkCardProps extends Track {
problems: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
"use client";
import { ScrollArea } from "./shad/ui/scroll-area";
import { ScrollArea } from "@repo/ui/shad/ui";
import { Track } from "@prisma/client";
import { Input } from "./shad/ui/input";
import { Input } from "@repo/ui/shad/ui";
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
import { useEffect, useState } from "react";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Button } from "./shad/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import LinkCard from "./LinkCard";

interface LinkProblemsProps extends Track {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { MoonIcon, SunIcon } from "@radix-ui/react-icons";
import { useTheme } from "next-themes";

import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./shad/ui/dropdown-menu";
import { Button } from "./shad/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@repo/ui/shad/ui";
import { Button } from "@repo/ui/shad/ui";

export function ModeToggle() {
const { setTheme } = useTheme();
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ArrowTopRightIcon } from "@radix-ui/react-icons";
import { useParams } from "next/navigation";
import { cn } from "../lib/utils";
import { Button } from "./shad/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./shad/ui/dropdown-menu";
import { cn } from "@repo/ui/utils";
import { Button } from "@repo/ui/shad/ui";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@repo/ui/shad/ui";
import { Track, Problem } from "@prisma/client";
import Link from "next/link";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";
import { useState } from "react";
import { Button } from "./shad/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Button } from "@repo/ui/shad/ui";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";
import { Problem, ProblemStatement } from "@prisma/client";
import { Input } from "./shad/ui/input";
import { Input } from "@repo/ui/shad/ui";
import { updateProblem } from "../../../apps/web/components/utils";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./shad/ui/select";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@repo/ui/shad/ui";
import { useRouter } from "next/navigation";

const ProblemCard = ({ problem }: { problem: Problem & { problemStatement: ProblemStatement | null } }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Problem, ProblemStatement } from "@prisma/client";
import { ScrollArea } from "./shad/ui/scroll-area";
import { ScrollArea } from "@repo/ui/shad/ui";
import ProblemCard from "./ProblemCard";
import AddProblemCard from "./AddProblemCard";

Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/ProblemSubmissionTable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import React from "react";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@repo/ui/table";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@repo/ui/shad/ui";
import { Clock4, CodeXml } from "lucide-react";
import { useRouter } from "next/navigation";
import { Submission } from "@prisma/client";
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/ProfileSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
import React from "react";
import UserImage from "@repo/ui/UserImage";
import UserImage from "./UserImage";
import { UserRound } from "lucide-react";
import ProfileOptions from "@repo/ui/profileOptions";
import ProfileOptions from "./profile/ProfileOptions";
import { useRecoilValue } from "recoil";
import { profileSidebar } from "@repo/store";
import { useSession } from "next-auth/react";
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import * as React from "react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";
import { SessionProvider } from "next-auth/react";
import { Toaster } from "@repo/ui/toaster";
import { } from "@repo/ui/shad/ui";

export const Providers = ({ children }: { children: React.ReactNode }) => {
return (
<SessionProvider>
<RecoilRoot>
{children}
<Toaster />
{/* < /> */}
</RecoilRoot>
</SessionProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/RedirectToLastSolved.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Loader } from "@repo/ui/components";
import { Loader } from "./Loader";
import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { getFirstProblemForTrack } from "./utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import { usePathname, useRouter } from "next/navigation";
import { Button } from "./shad/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Button } from "@repo/ui/shad/ui";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";

const RedirectToLoginCard = () => {
const router = useRouter();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"use client";

import { Cross2Icon, MagnifyingGlassIcon } from "@radix-ui/react-icons";
import { Button } from "./shad/ui/button";
import { Dialog, DialogClose, DialogContent } from "./shad/ui/dailog";
import { Button } from "@repo/ui/shad/ui";
import { Dialog, DialogClose, DialogContent } from "@repo/ui/shad/ui";
import { useEffect, useRef, useState } from "react";
import { Input } from "./shad/ui/input";
import { Input } from "@repo/ui/shad/ui";
import { Track, Problem } from "@prisma/client";
import { TrackList } from "./TrackList";
import Link from "next/link";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button } from "./shad/ui/button";
import { Card, CardDescription, CardHeader, CardTitle } from "./shad/ui/card";
import { Button } from "@repo/ui/shad/ui";
import { Card, CardDescription, CardHeader, CardTitle } from "@repo/ui/shad/ui";

import { ArrowRightIcon, ChevronRightIcon } from "@radix-ui/react-icons";
import { Track, Problem } from "@prisma/client";
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions packages/ui/src/Tracks.tsx → apps/web/components/Tracks.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";
import Link from "next/link";
import { TrackCard } from "@repo/ui/components";
import { TrackCard } from "./TrackCard";
import { category } from "@repo/store";
import { Track, Problem } from "@prisma/client";
import { useRecoilValue } from "recoil";
import { useEffect, useState } from "react";
import { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectItem } from "./shad/ui/select";
import { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectItem } from "@repo/ui/shad/ui";

interface Tracks extends Track {
problems: Problem[];
Expand Down
Loading

0 comments on commit 741c6a1

Please sign in to comment.