Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Admin Page frontend #67

Merged
merged 46 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
169a92e
feat: initiliase admin page
Majestic9169 Jun 2, 2024
296487d
feat: initialise admin-page
Majestic9169 Jun 4, 2024
80d6869
feat: add edit functionality to questionPapers
Majestic9169 Jun 4, 2024
f257382
feat: add approve/reject functionality
Majestic9169 Jun 4, 2024
2502fdb
feat: add dropdown menu for course_codes
Majestic9169 Jun 12, 2024
3e99bc1
feat: add dropdown input to course_names
Majestic9169 Jun 12, 2024
fb7e0cd
feat: add dropdown input for years
Majestic9169 Jun 12, 2024
f25ab6a
feat: add dropdown functionailty wherever required
Majestic9169 Jun 12, 2024
2aee86f
feat: style table a little decently,
Majestic9169 Jun 12, 2024
2020b61
fix: text alignment in course name column
Majestic9169 Jun 12, 2024
bdcc5c6
feat: update file naming convention to better reflect question paper …
Majestic9169 Jun 13, 2024
c752a85
feat: added ability to sort table
Majestic9169 Jun 13, 2024
f2ed571
fix: type in CS10003 and CS19003, change progamming to programming
Majestic9169 Jun 14, 2024
cfda5c8
feat: create getCodeFromCourse function used to validate and match in…
Majestic9169 Jun 14, 2024
319e80b
feat: add some styling to identify focused element
Majestic9169 Jun 14, 2024
04b445e
rename two components to make more sense
Majestic9169 Jun 14, 2024
6573b91
feat: add efficient approve/reject mechanism
Majestic9169 Jun 14, 2024
01f08a7
fix: simplify approve/reject to boolean
Majestic9169 Jun 17, 2024
fdd6600
feat: add a navbar and a space to display the current logged in user
Majestic9169 Jun 17, 2024
42ace0c
fix: remove trash color scheme and fix disbaled element styling
Majestic9169 Jun 17, 2024
2fb2586
fix: scoped the admin page css
harshkhandeparkar Jun 19, 2024
5914320
feat: a few styling changes
harshkhandeparkar Jun 19, 2024
a9ac6e1
feat: better table styling
harshkhandeparkar Jun 19, 2024
54190b6
feat: better select styling
harshkhandeparkar Jun 19, 2024
3e0de42
feat: better pdf link styling
harshkhandeparkar Jun 19, 2024
94d1321
feat: reduced select border size and opacity
harshkhandeparkar Jun 19, 2024
12583a6
feat: better pdf icon
harshkhandeparkar Jun 19, 2024
2d3bad5
feat: better disabled styling
harshkhandeparkar Jun 19, 2024
f57c7ad
feat: better buttons ig?
harshkhandeparkar Jun 19, 2024
108c3b0
fix: the misaligned svg was triggering my ocd
harshkhandeparkar Jun 19, 2024
4feb80e
feat: i would say this is a better button
harshkhandeparkar Jun 19, 2024
5d5fc97
fix: another ocd satisfied
harshkhandeparkar Jun 19, 2024
f0155e1
feat: rounded select list
harshkhandeparkar Jun 19, 2024
2b1e25a
feat: added way to unapprove
harshkhandeparkar Jun 19, 2024
c8fdb1b
fix: another ocd fixed
harshkhandeparkar Jun 19, 2024
7a90ade
feat: colored pdf link
harshkhandeparkar Jun 19, 2024
4ee3a3e
fix: removed unnecessary caption
harshkhandeparkar Jun 19, 2024
d089034
Merge remote-tracking branch 'origin/main' into tegan/admin-page
harshkhandeparkar Aug 8, 2024
a8cfffd
fix: added the missing function back
harshkhandeparkar Aug 8, 2024
96302a6
feat: mujhe yaad nahi oauth chal raha hai ki nahi maine kuch to kiya …
harshkhandeparkar Aug 24, 2024
cdb2735
Update Oauth to POST endpoint
rajivharlalka Aug 8, 2024
e6b8cd9
fix: use org admin token instead of user token
rajivharlalka Aug 9, 2024
47c2d78
fix: add env to env template
rajivharlalka Aug 9, 2024
02e3f89
sanitize url
shikharish Aug 24, 2024
41c72b1
fix: removed vercel analytics inject since it is blocked by ublock
harshkhandeparkar Aug 25, 2024
e5aa271
feat: redirect to github oauth url instead of /oauth
harshkhandeparkar Aug 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
"vite-plugin-solid": "^2.8.2"
},
"dependencies": {
"@solid-primitives/keyboard": "^1.2.8",
"@solidjs/router": "^0.13.2",
"@vercel/analytics": "^1.2.0",
"solid-icons": "^1.1.0",
"solid-js": "^1.8.11",
"solid-toast": "^0.5.0"
}
},
"packageManager": "[email protected]+sha512.9df9cf27c91715646c7d675d1c9c8e41f6fce88246f1318c1aa6a1ed1aeb3c4f032fcdf4ba63cc69c4fe6d634279176b5358727d8f2cc1e65b65f43ce2f8bfb0"
}
87 changes: 70 additions & 17 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions frontend/src/components/PDFLister.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { AiFillCloseCircle, AiFillWarning, AiOutlineFilePdf as PDFIcon } from "solid-icons/ai";
import { Component, createSignal } from "solid-js";
import { createStore } from "solid-js/store";
import { Exam, IAdminQuestionPaperResult, Semester, approvalStatus } from "../types/types";
import { IoCheckmarkCircle } from "solid-icons/io";
import { createShortcut } from "@solid-primitives/keyboard";

type props = {
questionPaper: IAdminQuestionPaperResult;
isEditMode: boolean;
}

export const ListElement: Component<props> = (props) => {
const [questionPaperDetails, setQuestionPaperDetails] = createStore<IAdminQuestionPaperResult>(props.questionPaper);

function approvalStatus(approvalStatus: approvalStatus) {
if (approvalStatus == null) {
return (<AiFillWarning/>);
} else if (approvalStatus) {
return (<IoCheckmarkCircle/>);
} else {
return (<AiFillCloseCircle/>);
}
};

function paperApprove(approvalStatus: approvalStatus){
if (approvalStatus == null) {setQuestionPaperDetails("approval", true)}
else {
setQuestionPaperDetails("approval", null)
}
};

function paperReject(approvalStatus: approvalStatus){
if (approvalStatus == null) {setQuestionPaperDetails("approval", false)}
else {
setQuestionPaperDetails("approval", null)
}
}

// createShortcut(
Majestic9169 marked this conversation as resolved.
Show resolved Hide resolved
// ["Alt", "V"],
// () => {
// paperApprove(questionPaperDetails.approval);
// },
// { preventDefault: true},
// )

return (
<tr>
<td><input type="number" value={questionPaperDetails.year} onInput={(e) => setQuestionPaperDetails("year", parseInt(e.target.value))} readonly={!props.isEditMode}/></td>
<td><input type="string" value={questionPaperDetails.course_code} onInput={(e) => setQuestionPaperDetails("course_code", e.target.value)} readonly={!props.isEditMode}/></td>
Majestic9169 marked this conversation as resolved.
Show resolved Hide resolved
<td><input type="string" value={questionPaperDetails.course_name} onInput={(e) => setQuestionPaperDetails("course_name", e.target.value)} readonly={!props.isEditMode}/></td>
<td><input type="string" value={questionPaperDetails.exam} onInput={(e) => setQuestionPaperDetails("exam", e.target.value)} readonly={!props.isEditMode}/></td>
<td><input type="string" value={questionPaperDetails.semester} onInput={(e) => setQuestionPaperDetails("semester", e.target.value)} readonly={!props.isEditMode}/></td>
harshkhandeparkar marked this conversation as resolved.
Show resolved Hide resolved
<td><PDFIcon/><a href={props.questionPaper.filelink} target="_blank">{questionPaperDetails.course_code}.pdf</a></td>
<td><button onClick={(e) => {e.preventDefault();if (props.isEditMode) {paperApprove(questionPaperDetails.approval)}}} onContextMenu={(e) => {e.preventDefault();if (props.isEditMode){paperReject(questionPaperDetails.approval)}}}>{approvalStatus(questionPaperDetails.approval)} </button></td>
</tr>
)
}
51 changes: 51 additions & 0 deletions frontend/src/components/PDFTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Component, createSignal, For } from "solid-js";
import { IAdminQuestionPaperResult } from "../types/types";
import { ListElement } from "./PDFLister";
import { IoPencil } from "solid-icons/io";
import { createShortcut } from "@solid-primitives/keyboard";
import { createStore } from "solid-js/store";

type props = {
QuestionPapers: IAdminQuestionPaperResult[];
}

export const PDFLister: Component<props> = (props) => {
const [reviewList, setReviewList] = createStore<IAdminQuestionPaperResult[]>(props.QuestionPapers);
const [isEditMode, setIsEditMode] = createSignal<boolean>(true)

function toggleEditMode(){
setIsEditMode(!isEditMode());
}

createShortcut(
harshkhandeparkar marked this conversation as resolved.
Show resolved Hide resolved
["Alt", "Z"],
() => {
toggleEditMode();
},
{ preventDefault: true},
);

return (
<div>
<span><button onclick={toggleEditMode}><IoPencil/></button> is editable = {isEditMode().toString()}</span>
<table>
<thead>
<tr>
<th>Year</th>
<th>Code</th>
<th>Course Name</th>
<th>Exam</th>
<th>Semester</th>
<th>File</th>
<th>Approval</th>
</tr>
</thead>

<For each={reviewList}>{(item) => (
<ListElement questionPaper={item} isEditMode={isEditMode()}/>
)}
</For>
</table>
</div>
)
}
Loading