Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix: issue #138 #141

Merged
merged 5 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions src/components/DateInput/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const DateInput = (props) => {
dateFormat="MM/dd/yyyy"
placeholderText={props.placeholder}
selected={props.value}
disabled={props.disabled}
onChange={props.onChange}
onBlur={props.onBlur}
onCalendarClose={props.onBlur}
Expand All @@ -28,6 +29,7 @@ const DateInput = (props) => {
DateInput.propTypes = {
value: PT.string,
onChange: PT.func.isRequired,
disabled: PT.bool,
placeholder: PT.string,
onBlur: PT.func,
onFocus: PT.func,
Expand Down
4 changes: 4 additions & 0 deletions src/components/FormField/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const FormField = ({ field }) => {
<TextInput
maxLength={field.maxLength}
placeholder={field.placeholder}
disabled={field.disabled}
value={input.value ?? ""}
type="text"
className={meta.error && meta.touched ? "error" : ""}
Expand All @@ -52,6 +53,7 @@ const FormField = ({ field }) => {
value={input?.value ?? ""}
isRequired={field.isRequired}
type="number"
disabled={field.disabled}
minValue={field.minValue}
onChange={input.onChange}
onBlur={input.onBlur}
Expand All @@ -64,6 +66,7 @@ const FormField = ({ field }) => {
<MarkdownEditor
placeholder={field.placeholder}
value={input?.value ?? ""}
errorMessage={field.errorMessage}
disabled={field.disabled}
onChange={input.onChange}
onBlur={input.onBlur}
Expand All @@ -86,6 +89,7 @@ const FormField = ({ field }) => {
placeholder={field.placeholder}
value={input?.value ?? ""}
onChange={input.onChange}
disabled={field.disabled}
onBlur={input.onBlur}
onFocus={input.onFocus}
className={meta.error && meta.touched ? "error" : ""}
Expand Down
36 changes: 19 additions & 17 deletions src/components/MarkdownEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import cn from "classnames";
import TuiEditor from "../TuiEditor";
import MarkdownEditorViewer from "../MarkdownEditorViewer";
import styles from "./styles.module.scss";
import { DISABLED_DESCRIPTION_MESSAGE } from "constants";

const MarkdownEditor = (props) => {
const editorElement = useRef(null);
Expand All @@ -21,7 +20,9 @@ const MarkdownEditor = (props) => {
return (
<div styleName="editor-viewer">
<MarkdownEditorViewer {...props} />
<div styleName="message">{DISABLED_DESCRIPTION_MESSAGE}</div>
{props.errorMessage && (
<div styleName="message">{props.errorMessage}</div>
)}
</div>
);
}
Expand All @@ -34,21 +35,21 @@ const MarkdownEditor = (props) => {
onChange={onChange}
initialValue={props.value}
toolbarItems={[
'heading',
'bold',
'italic',
'strike',
'code',
'divider',
'quote',
'codeblock',
'hr',
'divider',
'ul',
'ol',
'divider',
'image',
'link',
"heading",
"bold",
"italic",
"strike",
"code",
"divider",
"quote",
"codeblock",
"hr",
"divider",
"ul",
"ol",
"divider",
"image",
"link",
]}
plugins={[]}
/>
Expand All @@ -59,6 +60,7 @@ const MarkdownEditor = (props) => {
MarkdownEditor.propTypes = {
value: PropTypes.string,
disabled: PropTypes.bool,
errorMessage: PropTypes.string,
className: PropTypes.string,
onChange: PropTypes.func,
onFocus: PropTypes.func,
Expand Down
7 changes: 6 additions & 1 deletion src/components/MarkdownEditor/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

.editor-viewer {
> div:first-child {
border: 1px solid #aaaaab;
// border: 1px solid #aaaaab;
border-radius: 4px;
overflow: hidden;
box-sizing: border-box;
padding: 16px 25px 0px 25px;
height: 280px;
overflow-y: auto;
border: 0;
background: #fafafb;
box-shadow: none;
color: #6b6b6b;
-webkit-text-fill-color: #808080;
}
.message {
@include font-roboto;
Expand Down
14 changes: 10 additions & 4 deletions src/components/ReactSelect/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ const ReactSelect = (props) => {
control: (provided, state) => ({
...provided,
minHeight: "40px",
border: "1px solid #aaaaab",
border: state.isDisabled ? "none" : "1px solid #aaaaab",
borderColor: state.isFocused ? "#55a5ff" : "#aaaaab",
boxShadow: state.isFocused ? "0 0 2px 1px #cee6ff" : provided.boxShadow,
boxShadow: state.isDisabled
? "none"
: state.isFocused
? "0 0 2px 1px #cee6ff"
: provided.boxShadow,
backgroundColor: state.isDisabled ? "#fafafb" : provided.backgroundColor,
color: state.isDisabled ? "#6b6b6b" : provided.color,
}),
menu: (provided) => ({
...provided,
Expand Down Expand Up @@ -53,10 +59,10 @@ const ReactSelect = (props) => {
textAlign: "left",
fontWeight: "400",
}),
multiValue: (provided) => ({
multiValue: (provided, state) => ({
...provided,
margin: "3px 3px",
color: "#AAAAAA",
color: state.isDisabled ? "#808080" : "#AAAAAA",
fontFamily: "Roboto",
fontSize: "14px",
lineHeight: "22px",
Expand Down
3 changes: 3 additions & 0 deletions src/components/TextInput/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function TextInput(props) {
styleName={cn("TextInput", props.className, { readonly: props.readonly })}
maxLength={props.maxLength}
min={props.minValue}
disabled={props.disabled}
onChange={(event) => {
if (props.type === "number") {
if (event.target.value >= props.minValue) {
Expand Down Expand Up @@ -47,6 +48,7 @@ TextInput.defaultProps = {
maxLength: Number.MAX_VALUE,
placeholder: "",
minValue: 0,
disabled: false,
step: null,
};

Expand All @@ -58,6 +60,7 @@ TextInput.propTypes = {
onFocus: PT.func,
placeholder: PT.string,
value: PT.string.isRequired,
disabled: PT.bool,
type: PT.string.isRequired,
readonly: PT.bool,
minValue: PT.number,
Expand Down
5 changes: 5 additions & 0 deletions src/routes/JobForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ const JobForm = ({ teamId, jobId }) => {
configuration={getEditJobConfig(
options,
job.isApplicationPageActive,
isEdit
? job.status === "assigned" ||
job.status === "closed" ||
job.status === "cancelled"
: false,
onSubmit
)}
initialValue={job}
Expand Down
14 changes: 13 additions & 1 deletion src/routes/JobForm/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { PERMISSIONS } from "constants/permissions";
import { hasPermission } from "utils/permissions";
import { DISABLED_DESCRIPTION_MESSAGE } from "constants";
import {
RATE_TYPE_OPTIONS,
STATUS_OPTIONS,
Expand All @@ -28,11 +29,13 @@ const EDIT_JOB_ROWS = [
* return edit job configuration
* @param {any} skillOptions skill options
* @param {boolean} isMarkdownEditorDisabled is markedownEditor disabled
* @param {onlyEnableStatus} only can select status field
* @param {func} onSubmit submit callback
*/
export const getEditJobConfig = (
skillOptions,
isMarkdownEditorDisabled,
onlyEnableStatus,
onSubmit
) => {
return {
Expand All @@ -44,13 +47,15 @@ export const getEditJobConfig = (
validationMessage: "Please, enter Job Name",
name: "title",
maxLength: 128,
disabled: onlyEnableStatus,
placeholder: "Job Name",
},
{
label: "Job Description",
type: FORM_FIELD_TYPE.MARKDOWNEDITOR,
name: "description",
disabled: isMarkdownEditorDisabled,
disabled: isMarkdownEditorDisabled || onlyEnableStatus,
errorMessage: isMarkdownEditorDisabled && DISABLED_DESCRIPTION_MESSAGE,
placeholder: "Job Description",
},
{
Expand All @@ -61,19 +66,22 @@ export const getEditJobConfig = (
name: "numPositions",
minValue: 1,
placeholder: "Number Of Opening",
disabled: onlyEnableStatus,
step: 1,
},
{
label: "Job Skills",
type: FORM_FIELD_TYPE.SELECT,
isMulti: true,
name: "skills",
disabled: onlyEnableStatus,
selectOptions: skillOptions,
},
{
label: "Start Date",
type: FORM_FIELD_TYPE.DATE,
name: "startDate",
disabled: onlyEnableStatus,
placeholder: "Start Date",
},
{
Expand All @@ -82,24 +90,28 @@ export const getEditJobConfig = (
name: "duration",
minValue: 1,
placeholder: "Duration",
disabled: onlyEnableStatus,
step: 1,
},
{
label: "Resource Type",
type: FORM_FIELD_TYPE.SELECT,
name: "resourceType",
disabled: onlyEnableStatus,
selectOptions: RESOURCE_TYPE_OPTIONS,
},
{
label: "Resource Rate Frequency",
type: FORM_FIELD_TYPE.SELECT,
name: "rateType",
disabled: onlyEnableStatus,
selectOptions: RATE_TYPE_OPTIONS,
},
{
label: "Workload",
type: FORM_FIELD_TYPE.SELECT,
name: "workload",
disabled: onlyEnableStatus,
selectOptions: WORKLOAD_OPTIONS,
},
{
Expand Down