Skip to content

Commit

Permalink
fix: run eslint --fix removing all prettier error from web/ folder (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rssilva authored Oct 29, 2024
1 parent 5827e07 commit 13494b6
Show file tree
Hide file tree
Showing 9 changed files with 588 additions and 529 deletions.
28 changes: 14 additions & 14 deletions frontend/web/components/FeatureRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,20 @@ class TheComponent extends Component {
const changeRequestsEnabled = Utils.changeRequestsEnabled(
environment && environment.minimum_change_request_approvals,
)
const onChange = ()=> {
if(disableControls) {
return;
}
if (
projectFlag?.multivariate_options?.length ||
Utils.changeRequestsEnabled(
environment.minimum_change_request_approvals,
)
) {
this.editFeature(projectFlag, environmentFlags[id])
return
}
this.confirmToggle()
const onChange = () => {
if (disableControls) {
return
}
if (
projectFlag?.multivariate_options?.length ||
Utils.changeRequestsEnabled(
environment.minimum_change_request_approvals,
)
) {
this.editFeature(projectFlag, environmentFlags[id])
return
}
this.confirmToggle()
}
const isCompact = getViewMode() === 'compact'
if (this.props.condensed) {
Expand Down
51 changes: 34 additions & 17 deletions frontend/web/components/PasswordRequirements.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import React, { useEffect } from 'react'
import PropTypes from 'prop-types'
import { close, checkmark } from 'ionicons/icons'
import { IonIcon } from '@ionic/react'

const PasswordRequirements = ({ password, onRequirementsMet}) => {
const PasswordRequirements = ({ password, onRequirementsMet }) => {
const requirements = [
{ label: 'At least 8 characters', test: password.length >= 8 },
{ label: 'Contains a number', test: /\d/.test(password) },
{ label: 'Contains a special character', test: /[!@#$%^&*(),.?":{}|<>[\]\\\/_+=-]/.test(password) },
{
label: 'Contains a special character',
test: /[!@#$%^&*(),.?":{}|<>[\]\\\/_+=-]/.test(password),
},
{ label: 'Contains an uppercase letter', test: /[A-Z]/.test(password) },
{ label: 'Contains a lowercase letter', test: /[a-z]/.test(password) },
];
]

const allRequirementsMet = requirements.every(req => req.test);
const allRequirementsMet = requirements.every((req) => req.test)

useEffect(() => {
onRequirementsMet(allRequirementsMet);
}, [allRequirementsMet, onRequirementsMet]);
onRequirementsMet(allRequirementsMet)
}, [allRequirementsMet, onRequirementsMet])

return (
<div>
<ul className="password-requirements" style={{ listStyleType: 'none', padding: 0 }}>
<ul
className='password-requirements'
style={{ listStyleType: 'none', padding: 0 }}
>
{requirements.map((req, index) => (
<p key={index} style={{ color: req.test ? 'green' : 'red', fontSize: '12px', margin: '4px 0' }}>
<IonIcon style={{ marginRight: '4px', verticalAlign: 'middle'}} icon={req.test ? checkmark : close} />{req.label}
<p
key={index}
style={{
color: req.test ? 'green' : 'red',
fontSize: '12px',
margin: '4px 0',
}}
>
<IonIcon
style={{ marginRight: '4px', verticalAlign: 'middle' }}
icon={req.test ? checkmark : close}
/>
{req.label}
</p>
))}
</ul>
</div>
);
};
)
}

PasswordRequirements.propTypes = {
password: PropTypes.string.isRequired,
onRequirementsMet: PropTypes.func.isRequired,
};
password: PropTypes.string.isRequired,
onRequirementsMet: PropTypes.func.isRequired,
}

export default PasswordRequirements;
export default PasswordRequirements
Loading

0 comments on commit 13494b6

Please sign in to comment.