Skip to content

Commit

Permalink
Update : Resarch Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandrikatammana2002 committed Feb 29, 2024
1 parent 4550cf4 commit a1870d2
Show file tree
Hide file tree
Showing 24 changed files with 1,482 additions and 34 deletions.
27 changes: 26 additions & 1 deletion client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@ import PapersSemesters from "./components/resources/papers/PapersSemesters";
import Subjects from "./components/resources/notes/Subjects";
import FacultyLayout from "./layouts/FacultyLayout";
import FacultyNotesTable from "./components/faculty/notes/FacultyNotesTable";
import FacultyProjectsTable from "./components/faculty/papers/FacultyProjectsTable";

import FacultyProjectsTable from "./components/faculty/projects/FacultyProjectsTable";
import FacultyAssignments from "./components/faculty/assignments/FacultyAssignments";
import FacultyProblems from "./components/faculty/assignments/problems/FacultyProblems";
import StudentsSubmissions from "./components/faculty/assignments/problems/submissions/StudentsSubmissions";
import SolutionEditor from "./components/faculty/assignments/problems/submissions/SolutionEditor";
import { Toaster } from "react-hot-toast";
import { useSelector } from "react-redux";
import FacultyPapersTable from "./components/faculty/papers/FacultyPapersTable";
import FacultyResearchTable from "./components/faculty/research/FacultyResearchTable";
import StudentPaperTable from "./components/student/papers/StudentPaperTable";
import StudentResearchTable from "./components/student/research/StudentResearchTable";
import PaperTable from "./components/admin/papers/PaperTable";
import ResearchTable from "./components/admin/research/ResearchTable";

function App() {
const role = useSelector((state) => state.auth.role);
Expand Down Expand Up @@ -88,6 +95,17 @@ function App() {
<Route path="faculty" element={<Faculty />} />
<Route path="projects" element={<ProjectsTable />} />
<Route path="notes" element={<NotesTable />} />
<Route path="papers" element={<PaperTable/>}/>
<Route path="research" element={<ResearchTable/>}/>

<Route
path="assignments"
element={<StudentsSubmissions />}
/>
<Route
path="assignments/:assignmentId"
element={<SolutionEditor />}
/>
</Route>
)}

Expand All @@ -96,6 +114,11 @@ function App() {
<Route path="/student" element={<StudentLayout />}>
<Route path="projects" element={<StudentProjectsTable />} />
<Route path="notes" element={<StudentNotesTable />} />
<Route path="papers" element={<StudentPaperTable />} />
<Route path="research" element={<StudentResearchTable />} />
<Route path="assignments" element={<Problems />} />
<Route path=":assignmentId/:problemId" element={<Editor />} />

</Route>
)}

Expand All @@ -104,6 +127,8 @@ function App() {
<Route path="/faculty" element={<FacultyLayout />}>
<Route path="notes" element={<FacultyNotesTable />} />
<Route path="projects" element={<FacultyProjectsTable />} />
<Route path="papers" element={<FacultyPapersTable />} />
<Route path="research" element={<FacultyResearchTable/>} />
<Route
path="assignments"
element={<FacultyAssignments />}
Expand Down
150 changes: 150 additions & 0 deletions client/src/components/admin/papers/PaperColumns.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import ArrowUpDown from "@/components/icons/ArrowUpDown";
//import GitHub from "@/components/icons/GitHub";
import LiveLink from "@/components/icons/LiveLink";
import MoreVertical from "@/components/icons/MoreVertical";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";

export const PaperColumns = [
{
id: "select",
header: ({ table }) => (
<Checkbox
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
className="translate-y-[2px]"
/>
),
cell: ({ row }) => (
<Checkbox
checked={row.getIsSelected()}
onCheckedChange={(value) => row.toggleSelected(!!value)}
aria-label="Select row"
className="translate-y-[2px]"
/>
),
enableSorting: false,
enableHiding: false,
},
{
accessorKey: "uploader",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
Uploader
<ArrowUpDown />
</Button>
),
},
{
accessorKey: "title",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
Title
<ArrowUpDown />
</Button>
),
},
{
accessorKey: "fileUrl",
header: () => "Notes",
cell: ({ row }) => (
<a href={row.original.fileUrl} target="_blank" rel="noopener noreferrer">
<LiveLink />
</a>
),
},
{
accessorKey: "viewCount",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
View Count
<ArrowUpDown />
</Button>
),
},
{
accessorKey: "tags",
header: "Tags",
cell: ({ row }) => row.original.tags.join(", "),
},
{
accessorKey: "status",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
Status
<ArrowUpDown />
</Button>
),
cell: ({ row }) => (
<span
className={`capitalize ${row.original.status === "approved" ? "text-green-500" : "text-yellow-500"}`}
>
{row.original.status}
</span>
),
},
{
id: "actions",
cell: ({ row }) => {
const project = row.original;

const toggleStatus = () => {
// Toggle the status
// const newStatus =
project.status === "approved" ? "pending" : "approved";

// You would normally call an API or update the status in your data source here
// For example: updateProjectStatus(project.id, newStatus);
};

return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="w-8 h-8 p-0">
<span className="sr-only">Open menu</span>
<MoreVertical />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>

<DropdownMenuItem>Edit</DropdownMenuItem>
<DropdownMenuItem>Delete</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={toggleStatus}>
{project.status === "approved" ? "Make Pending" : "Approve"}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
},
},
];
18 changes: 18 additions & 0 deletions client/src/components/admin/papers/PaperTable.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import DataTable from "@/components/ui/data-table";
import { adminNotesData } from "@/data/notes";
import { PaperColumns } from "./PaperColumns";

const PaperTable = () => {
return (
<div className="flex flex-col space-y-8">
<div>
<h2 className="text-2xl font-bold tracking-tight">Papers</h2>
<p className="text-muted-foreground">Here&apos;s the list of papers!</p>
</div>

<DataTable data={adminNotesData} columns={PaperColumns} />
</div>
);
};

export default PaperTable;
131 changes: 131 additions & 0 deletions client/src/components/admin/research/ResearchColumns.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import ArrowUpDown from "@/components/icons/ArrowUpDown";
//import GitHub from "@/components/icons/GitHub";
import LiveLink from "@/components/icons/LiveLink";
import MoreVertical from "@/components/icons/MoreVertical";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";

export const ResearchColumns = [
{
id: "select",
header: ({ table }) => (
<Checkbox
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
className="translate-y-[2px]"
/>
),
cell: ({ row }) => (
<Checkbox
checked={row.getIsSelected()}
onCheckedChange={(value) => row.toggleSelected(!!value)}
aria-label="Select row"
className="translate-y-[2px]"
/>
),
enableSorting: false,
enableHiding: false,
},
{
accessorKey: "uploader",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
Uploader
<ArrowUpDown />
</Button>
),
},
{
accessorKey: "title",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
Title
<ArrowUpDown />
</Button>
),
},
{
accessorKey: "fileUrl",
header: () => "Notes",
cell: ({ row }) => (
<a href={row.original.fileUrl} target="_blank" rel="noopener noreferrer">
<LiveLink />
</a>
),
},
{
accessorKey: "viewCount",
header: ({ column }) => (
<Button
variant="ghost"
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-0 hover:bg-transparent"
>
View Count
<ArrowUpDown />
</Button>
),
},
{
accessorKey: "tags",
header: "Tags",
cell: ({ row }) => row.original.tags.join(", "),
},

{
id: "actions",
cell: ({ row }) => {
const project = row.original;

const toggleStatus = () => {
// Toggle the status
// const newStatus =
project.status === "approved" ? "pending" : "approved";

// You would normally call an API or update the status in your data source here
// For example: updateProjectStatus(project.id, newStatus);
};

return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="w-8 h-8 p-0">
<span className="sr-only">Open menu</span>
<MoreVertical />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>

<DropdownMenuItem>Edit</DropdownMenuItem>
<DropdownMenuItem>Delete</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={toggleStatus}>
{project.status === "approved" ? "Make Pending" : "Approve"}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
},
},
];
20 changes: 20 additions & 0 deletions client/src/components/admin/research/ResearchTable.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import DataTable from "@/components/ui/data-table";

import { researchData } from "@/data/researchPaper";

import { ResearchColumns } from "./ResearchColumns";

const ResearchTable = () => {
return (
<div className="flex flex-col space-y-8">
<div>
<h2 className="text-2xl font-bold tracking-tight">Research Papers</h2>
<p className="text-muted-foreground">Here&apos;s the list of papers!</p>
</div>

<DataTable data={researchData} columns={ResearchColumns} />
</div>
);
};

export default ResearchTable;
Loading

0 comments on commit a1870d2

Please sign in to comment.