Skip to content

Commit

Permalink
DOKY-163 fix lint errors (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gooz92 authored Jun 16, 2024
1 parent 9e8e5e1 commit 69cb8c1
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 40 deletions.
5 changes: 3 additions & 2 deletions server/doky-front/src/components/formComponents/FormInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const FormInput = ({label, id, type, value = '', onChange = noop, errors}) => {
<div className="row ">
<label className="col-sm-2 col-form-label" htmlFor={id}>{label}:</label>
<div className="input-group has-validation">
<input className={inputClassesList} id={id} type={type} value={value} onChange={handleOnChange}
aria-describedby={'validation' + id + 'Feedback'}/>
<input
className={inputClassesList} id={id} type={type} value={value} onChange={handleOnChange}
aria-describedby={'validation' + id + 'Feedback'}/>
{hasErrors ?
<div id={'validation' + id + 'Feedback'} className="invalid-feedback">
{errors.map((message) => (<div key={message}>{message}</div>))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const HorizontalFormInput = ({label, id, type, value = '', disabled = false, onC
<div>
<label className="form-label" htmlFor={id}>{label}:</label>
<div className="has-validation">
<input className={inputClassesList} id={id} type={type} value={value} disabled={disabled}
onChange={handleOnChange}
aria-describedby={'validation' + id + 'Feedback'}/>
<input
className={inputClassesList} id={id} type={type} value={value} disabled={disabled}
onChange={handleOnChange}
aria-describedby={'validation' + id + 'Feedback'} />
{hasErrors ?
<div id={'validation' + id + 'Feedback'} className="invalid-feedback">
{errors.map((message) => (<div key={message}>{message}</div>))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const getClampedRowsCount = (str, min, max) => {
};

const HorizontalFormText = ({
label,
id,
minRows = 3,
maxRows = 10,
value = '',
onChange = noop
}) => {
label,
id,
minRows = 3,
maxRows = 10,
value = '',
onChange = noop
}) => {

const handleOnChange = useCallback(event => {
event.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const CreateDocumentForm = ({onCreated}) => {
<>
{globalError ? <AlertError message={globalError}/> : null}
<form onSubmit={handleSubmit} className="mt-3">
<HorizontalFormInput id="name" label="Name" type="text" value={data.name} onChange={name.setValue}
errors={name.errors}/>
<HorizontalFormText id="description" label="Description" value={data.description}
onChange={description.setValue}/>
<HorizontalFormInput
id="name" label="Name" type="text" value={data.name} onChange={name.setValue}
errors={name.errors}/>
<HorizontalFormText
id="description" label="Description" value={data.description}
onChange={description.setValue}/>
<div className="d-flex justify-content-between py-2">
<input type="submit" value="Create" className="btn btn-primary mb-3 float-right"/>
</div>
Expand Down
35 changes: 18 additions & 17 deletions server/doky-front/src/pages/Documents/Documents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,26 @@ const Documents = () => {
<div className="table-responsive">
<table className="table table-striped table-hover">
<thead>
<tr>
<th scope="col">Actions</th>
<th scope="col">Name</th>
<th scope="col">Modified Date</th>
</tr>
<tr>
<th scope="col">Actions</th>
<th scope="col">Name</th>
<th scope="col">Modified Date</th>
</tr>
</thead>
<tbody>
{!isLoading ? data.map?.((document) => (
<tr key={document.id}>
<td>
<button type="button" className="btn btn-outline-primary"
onClick={getGoToEditDocumentHandler(document.id)}>
<i className="bi bi-file-earmark-plus me-1"></i><span>Edit</span>
</button>
</td>
<td>{document.name}</td>
<td>{document.modifiedDate}</td>
</tr>
)) : 'Loading'}
{!isLoading ? data.map?.((document) => (
<tr key={document.id}>
<td>
<button
type="button" className="btn btn-outline-primary"
onClick={getGoToEditDocumentHandler(document.id)}>
<i className="bi bi-file-earmark-plus me-1"></i><span>Edit</span>
</button>
</td>
<td>{document.name}</td>
<td>{document.modifiedDate}</td>
</tr>
)) : 'Loading'}
</tbody>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const EditDocumentForm = ({document}) => {
{globalError ? <AlertError message={globalError}/> : null}
<form onSubmit={handleSubmit} className="mt-3">
<HorizontalFormInput id="name" label="Name" type="text" value={data.name} onChange={name.setValue}
errors={name.errors}/>
errors={name.errors}/>
<HorizontalFormText id="description" label="Description" value={data.description}
onChange={description.setValue}/>
onChange={description.setValue}/>
<div className="mt-4">
<div>File:</div>
<div>{document.fileName}</div>
Expand Down
4 changes: 2 additions & 2 deletions server/doky-front/src/pages/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const Login = () => {
<form onSubmit={handleSubmit} className="col-3">
<img className="mb-3 mt-3 img-fluid" src="/logo-color-bg.svg"/>
<FormInput id="uid" label="Email" type="text" value={data.uid} onChange={uid.setValue}
errors={uid.errors}/>
errors={uid.errors}/>
<FormInput id="password" label="Password" type="password" value={data.password} onChange={password.setValue}
errors={password.errors}/>
errors={password.errors}/>
<div className="mt-3 row">
<input type="submit" value="Login" className="btn btn-primary mb-3"/>
<Link to="/register" className="m-3">Register</Link>
Expand Down
4 changes: 2 additions & 2 deletions server/doky-front/src/pages/Register/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const Register = () => {
<form onSubmit={handleSubmit} className="col-3">
<img className="mb-3 mt-3 img-fluid" src="/logo-color-bg.svg"/>
<FormInput id="uid" label="Email" type="text" value={data.uid} onChange={uid.setValue}
errors={uid.errors}/>
errors={uid.errors}/>
<FormInput id="password" label="Password" type="password" value={data.password} onChange={password.setValue}
errors={password.errors}/>
errors={password.errors}/>
<div className="mt-3 row">
<input type="submit" value="Register" className="btn btn-primary mb-3"/>
<Link to="/login">Login</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const EditUserProfileForm = ({user}) => {
{globalError ? <AlertError message={globalError}/> : null}
<form onSubmit={handleSubmit} className="mt-3">
<HorizontalFormInput id="uid" label="Email" type="text" value={data.uid} disabled={true}
onChange={uid.setValue}/>
onChange={uid.setValue}/>
<HorizontalFormInput id="name" label="Name" type="text" value={data.name} onChange={name.setValue}/>
<div className="d-flex justify-content-between py-2">
<input type="submit" value="Save" disabled={isLoading} className="btn btn-primary mb-3 float-right"/>
Expand Down

0 comments on commit 69cb8c1

Please sign in to comment.