Skip to content

Commit

Permalink
Readme update, code formatting and bug fixes (#16)
Browse files Browse the repository at this point in the history
* md preview

* added markdown preview to create question. Changed to md preview from blocknote in update question. Fixed update question.

* Fixed incorrect padding

* Fixed initial markdown

* added round enable functionality

* put up same fonts in edit and update page

* commented out navigation section on dashboard

* Added template for LeaderBoard

* Added template for LeaderBoard

* created boilerplate leadboard

* Added better syling for leaderboard

* fixed build errors and bug fixes

* fixed update page

* added readme

* readme bugfix

* readme bugfix
  • Loading branch information
abhitrueprogrammer authored Nov 14, 2024
1 parent f56085d commit e7a6002
Show file tree
Hide file tree
Showing 59 changed files with 974 additions and 796 deletions.
42 changes: 20 additions & 22 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
/** @type {import("eslint").Linter.Config} */
const config = {
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
"plugins": [
"@typescript-eslint"
],
"extends": [
plugins: ["@typescript-eslint"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked"
"plugin:@typescript-eslint/stylistic-type-checked",
],
"rules": {
rules: {
"@typescript-eslint/array-type": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{
"prefer": "type-imports",
"fixStyle": "inline-type-imports"
}
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/require-await": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": {
"attributes": false
}
}
]
}
}
module.exports = config;
checksVoidReturn: {
attributes: false,
},
},
],
},
};
module.exports = config;
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@
- Create, delete and update questions using intutive buttons.

- All our tables have sorting with pagination and caching.
<p align="center">

#### Login Page

<img width="1440" alt="image" src="/showcase_ss/login_page.png">

### Portal

#### Dashboard
<img width="1440" alt="image" src="/showcase_ss/dashboard_page.png">

#### Edit Question Page
<img width="1440" alt="image" src="/showcase_ss/edit_question_page.png">

#### Question Creation Page
<img width="1440" alt="image" src="/showcase_ss/question_creation_page.png">

#### Question Page
<img width="1440" alt="image" src="/showcase_ss/question_page.png">
<img width="1440" alt="image" src="/showcase_ss/testcase_question_page.png">

#### Users Page

<img width="1440" alt="image" src="/showcase_ss/users_page.png">

</p>

## 🏁 Get Started

Expand Down
2 changes: 1 addition & 1 deletion components.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"lib": "@/lib",
"hooks": "@/hooks"
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "next build",
"dev": "next dev",
"lint": "next lint",
"start": "next start"
"start": "next start",
"pretty": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json}\""
},
"dependencies": {
"@blocknote/core": "^0.15.10",
Expand Down
Binary file added showcase_ss/dashboard_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase_ss/edit_question_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase_ss/login_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase_ss/question_creation_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase_ss/question_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase_ss/testcase_question_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added showcase_ss/users_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions src/api/adminDashboard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { handleAPIError } from "@/lib/error";
import api from ".";
import { generateSampleLeaderboard as generateSampleLeaderBoard } from "./sampleData";
// import { generateSampleLeaderboard as generateSampleLeaderBoard } from "./sampleData";

export interface RoundParams {
round_id: number;
Expand Down Expand Up @@ -31,10 +31,9 @@ export async function GetLeaderBoard() {
.slice(0, 10); // Take the top 10

// return generateSampleLeaderBoard()
// .filter((user) => user.Score !== null)
// .filter((user) => user.Score !== null)
// .sort((a, b) => b.Score! - a.Score!)
// .slice(0, 10);

} catch (e) {
throw handleAPIError(e);
}
Expand Down
25 changes: 12 additions & 13 deletions src/api/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export interface UpdateQuestionParams {
input_format: string[];
points: number;
round: number;
constraints: string[] ;
constraints: string[];
output_format: string[];
sample_test_input: string[];
sample_test_output: string[];
sample_explanation: string[];
}

export interface QuestionResponse {
export interface QuestionResponse {
ID: string;
Description: string;
Title: string;
Expand All @@ -27,19 +27,18 @@ export interface QuestionResponse {
}

export interface CreateQuestionParams {
description: string,
title: string,
input_format: string[],
points: number,
round: number,
constraints: string[],
output_format: string[],
sample_test_input: string[],
sample_test_output: string[],
sample_explanation: string[],
description: string;
title: string;
input_format: string[];
points: number;
round: number;
constraints: string[];
output_format: string[];
sample_test_input: string[];
sample_test_output: string[];
sample_explanation: string[];
}


export interface DeleteQuestionResponse {
message: string;
}
2 changes: 1 addition & 1 deletion src/api/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export async function login(body: z.infer<typeof loginFormSchema>) {
} catch (e) {
throw handleAPIError(e);
}
}
}
39 changes: 16 additions & 23 deletions src/api/questions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@


import { handleAPIError } from "@/lib/error";
import api from ".";
import { generateSampleData } from "./sampleData";


// import { generateSampleData } from "./sampleData";

export interface UpdateQuestionParams {
id: string;
Expand All @@ -13,14 +9,14 @@ export interface UpdateQuestionParams {
input_format: string[];
points: number;
round: number;
constraints: string[] ;
constraints: string[];
output_format: string[];
sample_test_input: string[];
sample_test_output: string[];
sample_explanation: string[];
}

export interface QuestionResponse {
export interface QuestionResponse {
ID: string;
Description: string;
Title: string;
Expand All @@ -35,19 +31,18 @@ export interface QuestionResponse {
}

export interface CreateQuestionParams {
description: string,
title: string,
input_format: string[],
points: number,
round: number,
constraints: string[],
output_format: string[],
sample_test_input: string[],
sample_test_output: string[],
sample_explanation: string[],
description: string;
title: string;
input_format: string[];
points: number;
round: number;
constraints: string[];
output_format: string[];
sample_test_input: string[];
sample_test_output: string[];
sample_explanation: string[];
}


interface DeleteQuestionResponse {
message: string;
}
Expand All @@ -66,12 +61,11 @@ export async function GetAllQuestions() {
// POST REQUEST
export async function CreateQuestion(data: CreateQuestionParams) {
try {
console.log(data)
console.log(data);
const response = await api.post<QuestionResponse>("/question/create", data);
return response.data;
} catch (e) {

console.log(e)
console.log(e);
throw handleAPIError(e);
}
}
Expand All @@ -95,8 +89,7 @@ export async function GetQuestionById(id: string) {

// PATCH REQUEST
export async function UpdateQuestion(data: UpdateQuestionParams) {
try
{
try {
const response = await api.patch<QuestionResponse>("/question", data);
return response.data;
} catch (e) {
Expand Down
4 changes: 2 additions & 2 deletions src/api/sampleData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LeaderBoardUser } from "./adminDashboard";
import { type LeaderBoardUser } from "./adminDashboard";
import { type QuestionResponse } from "./questions";

const generateSampleData = (): QuestionResponse[] => {
Expand Down Expand Up @@ -34,7 +34,7 @@ const generateSampleLeaderboard = (): LeaderBoardUser[] => {
},
{
ID: "01922fc8-5e18-7c90-89ee-5f2f3e1012c8",
Name: "abc",
Name: "InRandomOrder",
Score: 100000,
},
{
Expand Down
Loading

0 comments on commit e7a6002

Please sign in to comment.