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

Feature github actions #119

Merged
merged 6 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ checks:
config:
threshold: 4
similar-code:
enabled: true
enabled: false
config:
threshold: #language-specific defaults. overrides affect all languages.
identical-code:
enabled: true
enabled: false
config:
threshold: #language-specific defaults. overrides affect all languages.
plugins:
rubocop:
enabled: true
eslint:
enabled: true
enabled: false
channel: eslint-8
exclude_patterns:
- "config/"
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/dev-pulse-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Devpulse CI

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
test-and-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: npm install --legacy-peer-deps

- name: Run tests
run: npm test

- name: Build
run: npm run build
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@types/react-dom": "^18.0.6",
"@types/react-table": "^7.7.12",
"@types/redux-state-sync": "^3.1.5",
"@types/uglify-js": "^3.17.5",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"autoprefixer": "^10.4.7",
"babel-loader": "^8.2.5",
Expand Down Expand Up @@ -107,7 +108,6 @@
"popper.js": "^1.16.1",
"react-datepicker": "^4.8.0",
"react-hook-form": "^7.45.4",
"react-hooks-useform": "^0.1.86",
"react-hot-toast": "^2.4.1",
"react-i18next": "^11.18.6",
"react-icons": "^4.6.0",
Expand Down
59 changes: 27 additions & 32 deletions src/components/GoogleForm/SaveForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import axios from '../../redux/actions/axiosconfig';
import { showSuccessToast, showErrorToast } from './../../utils/toast';
import { useFormik } from 'formik';
import * as Yup from 'yup';
import SelectField from "../ReusableComponents/Select"

const validationSchema = Yup.object().shape({
link: Yup.string().required('Please enter a Google Form link'),
Expand Down Expand Up @@ -160,11 +161,10 @@ function SaveFormDetails() {
<div className='mt-1'>
<input
autoComplete='title'
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 ${
formik.touched.title && formik.errors.title
? 'border-red-500'
: ''
}`}
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 ${formik.touched.title && formik.errors.title
? 'border-red-500'
: ''
}`}
id='title'
name='title'
onChange={formik.handleChange}
Expand All @@ -190,27 +190,24 @@ function SaveFormDetails() {
<label className='sr-only' htmlFor='jobpost'>
Job Post
</label>

<select
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 pl-20 focus:border-indigo-500 focus:ring-indigo-500 ${
formik.touched.jobpost && formik.errors.jobpost
? 'border-red-500'
: ''
}`}
<SelectField
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 pl-20 focus:border-indigo-500 focus:ring-indigo-500 ${formik.touched.jobpost && formik.errors.jobpost
? 'border-red-500'
: ''
}`}
id='jobpost'
name='jobpost'
onChange={formik.handleChange}
onBlur={formik.handleBlur}
value={formik.values.jobpost}>
{jobposts.length === 0 && (
<option disabled>Select Job Post</option>
)}
{jobposts.map((jobpost) => (
<option key={jobpost.id} value={jobpost.id}>
{jobpost.title}
</option>
))}
</select>
value={formik.values.jobpost}
options={
jobposts.map((jobpost) => (
<option key={jobpost.id} value={jobpost.id}>
{jobpost.title}
</option>
))
}
/>
</div>
{formik.touched.jobpost && formik.errors.jobpost && (
<div className='text-red-500'>{formik.errors.jobpost}</div>
Expand All @@ -228,11 +225,10 @@ function SaveFormDetails() {
<div className='mt-1'>
<input
autoComplete='link'
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 ${
formik.touched.link && formik.errors.link
? 'border-red-500'
: ''
}`}
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 ${formik.touched.link && formik.errors.link
? 'border-red-500'
: ''
}`}
id='link'
name='link'
onChange={formik.handleChange}
Expand All @@ -255,11 +251,10 @@ function SaveFormDetails() {

<div className='mt-1'>
<textarea
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 ${
formik.touched.description && formik.errors.description
? 'border-red-500'
: ''
}`}
className={`block w-full text-primary rounded-md border-gray-300 py-3 px-4 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 ${formik.touched.description && formik.errors.description
? 'border-red-500'
: ''
}`}
defaultValue=''
id='description'
name='description'
Expand Down
24 changes: 12 additions & 12 deletions src/components/GoogleForm/UpdateSavedForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { useParams, Link } from 'react-router-dom';
import axios from '../../redux/actions/axiosconfig';
import { showSuccessToast, showErrorToast } from './../../utils/toast';
import SelectField from '../ReusableComponents/Select';

const UpdateSavedForm = () => {
const [formData, setFormData] = useState({
Expand Down Expand Up @@ -177,18 +178,17 @@ const UpdateSavedForm = () => {
</label>
<div className='relative mt-1 rounded-md shadow-sm'>
<div className='absolute inset-y-0 left-0 flex items-center'>
<select
id='jobpost'
name='jobpost'
value={selectedJobPost}
onChange={handleJobPostChange}
className='block w-full text-primary rounded-md border-gray-300 py-3 px-4 pl-20 focus:border-indigo-500 focus:ring-indigo-500'>
{jobposts.map((jobpost) => (
<option key={jobpost.id} value={jobpost.id}>
{jobpost.title}
</option>
))}
</select>
<SelectField
id="jobpost"
name='jobpost'
value={selectedJobPost}
onChange={handleJobPostChange}
className='block w-full text-primary rounded-md border-gray-300 py-3 px-4 pl-20 focus:border-indigo-500 focus:ring-indigo-500'
options={jobposts.map((jobpost)=> ({
value: jobpost.id,
label: jobpost.title
}))}
/>
</div>
</div>
</div>
Expand Down
21 changes: 8 additions & 13 deletions src/components/GradingBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { connect } from 'react-redux';
import { toast } from 'react-toastify';
import { getAllAssessment } from '../redux/actions/getAssessments';
import { useAppDispatch } from "../hooks/hooks";
import SelectField from './ReusableComponents/Select';

interface Grade {
attribute: string;
Expand Down Expand Up @@ -256,25 +257,19 @@ function GradingBox(props: any) {
</div>
<div className="input mt-4 mb-4 h-9 ">
<div className="grouped-input flex items-center h-full w-full rounded-md">
<select
name=""
<SelectField
className=" dark:text-white dark:bg-dark-tertiary border border-primary rounded outline-none px-5 font-sans text-sm py-2 w-full pt-4"
defaultValue=""
value={assessmentM}
onChange={(e) => {
setAssessmentM(e.target.value)
changeAssess(0, e.target.value)
}}
>
<option disabled hidden value="">{"---Choose Assessment---"}</option>
{
allAssessments?.data &&
(allAssessments?.data.map((element) => {
return (
<option value={element.id}>{element.title}</option>)
})
)}
</select>
options={[{ value: "--- Choose assessment---", label: "Choose assessment" },
allAssessments?.data.map((element) => ({
value: element.id, label: element.label
})
)]}
/>
{assessmentM &&
<div className='h-full w-[10%] pl-2 py-1 items-center'>
<input
Expand Down
21 changes: 21 additions & 0 deletions src/components/ReusableComponents/DataList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';

interface DatalistProps {
id: string;
options: { value: string; label?: string }[];
style?: React.CSSProperties;
}

const Datalist: React.FC<DatalistProps> = ({ id, options }) => {
return (
<datalist id={id}>
{options.map((option, index) => (
<option key={index} value={option.value}>
{option.label || option.value}
</option>
))}
</datalist>
);
};

export default Datalist;
46 changes: 46 additions & 0 deletions src/components/ReusableComponents/Select.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';

interface SelectFieldProps {
id?: string;
name?: string;
value?: string | number;
options: { value: string | number; label: string }[];
onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
ref?: React.Ref<HTMLSelectElement>;
className?: string;
defaultValue?: string | number;
onBlur?: (e: React.FocusEvent<HTMLSelectElement>) => void;
}

const SelectField: React.FC<SelectFieldProps> = ({
id,
name,
value,
options,
onChange,
ref,
className = "",
defaultValue,
onBlur
}) => {
return (
<select
id={id}
name={name}
ref={ref}
defaultValue={defaultValue}
value={value}
onChange={onChange}
className={`dark:bg-dark-tertiary dark:text-white shadow appearance-none py-2 px-3 rounded w-full leading-tight focus:outline-none focus:shadow-outline ${className}`}
onBlur={(e: React.FocusEvent<HTMLSelectElement>) => onBlur?.(e)}
>
{options.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
);
};

export default SelectField;
Loading
Loading