Skip to content

Commit

Permalink
chore: fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
VictoryPashkova committed Jun 22, 2024
1 parent 0d01e0a commit 1855144
Show file tree
Hide file tree
Showing 43 changed files with 1,323 additions and 946 deletions.
12 changes: 5 additions & 7 deletions frontend/src/components/Footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { ReactComponent as Vk } from '../../assets/images/icons/vk.svg';
import classes from './index.module.css';

function Footer() {
const { t: tF, i18n } = useTranslation('translation', { keyPrefix: 'footer' });
const { t: tF, i18n } = useTranslation('translation', {
keyPrefix: 'footer',
});
const { language } = i18n;

return (
Expand Down Expand Up @@ -103,9 +105,7 @@ function Footer() {
</p>
</Col>
<Col lg={5} md={5}>
<div className="fw-bold mt-3 mb-2 text-white">
{tF('doc')}
</div>
<div className="fw-bold mt-3 mb-2 text-white">{tF('doc')}</div>
<Nav as="ul" className="flex-column align-items-start">
<li>
<Nav.Link
Expand Down Expand Up @@ -246,9 +246,7 @@ function Footer() {
</Dropdown> */}
</Col>
<Col lg={2} md={12}>
<div className="fw-bold mt-3 mb-2 text-white">
{tF('project')}
</div>
<div className="fw-bold mt-3 mb-2 text-white">{tF('project')}</div>
<Nav as="ul" className="flex-column align-items-start">
<li>
<Nav.Link
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/AvatarChangeForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { actions as modalActions } from '../../slices/modalSlice.js';
import Avatar from '../Avatar/index.jsx';

function AvatarChangeForm() {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const dispatch = useDispatch();
const username = useSelector((state) => state.user.userInfo.username);

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/ChangePasswordForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import PasswordVisibilityButton from './PasswordVisibilityButton.jsx';
import FormAlert from './FormAlert.jsx';

function ChangePasswordForm() {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t } = useTranslation();
const inputRef = useRef(null);
const userInfo = useSelector((state) => state.user.userInfo);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/ForgotPasswordForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import FormAlert from './FormAlert.jsx';

function ForgotPasswordForm() {
const { t } = useTranslation();
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t: tFP } = useTranslation('translation', { keyPrefix: 'forgotPass' });
const emailRef = useRef();
const location = window.location.origin;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/GithubSignInButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ if (process.env.NODE_ENV !== 'production') {
}

function GithubSignInButton() {
const { t: tFA } = useTranslation('translation', { keyPrefix: 'formActions' });
const { t: tFA } = useTranslation('translation', {
keyPrefix: 'formActions',
});

return (
<Button as="a" href={OAUTH_LINK.toString()} variant="outline-secondary">
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/GuestSignUpForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import { actions as userActions } from '../../slices/userSlice';
import { actions as modalActions } from '../../slices/modalSlice.js';

function GuestSignupForm() {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t: tSU } = useTranslation('translation', { keyPrefix: 'signUp' });
const { t } = useTranslation();
const emailRef = useRef();
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/components/Forms/PasswordVisibilityButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ function PasswordVisibilityButton({
onClick = () => null,
enabled = false,
}) {
const { t: tFA } = useTranslation('translation', { keyPrefix: 'formActions' });
const { t: tFA } = useTranslation('translation', {
keyPrefix: 'formActions',
});

return (
<Button onClick={onClick} variant={variant}>
{enabled ? (
<>
<EyeSlash />
<span className="visually-hidden">
{tFA('hidePassword')}
</span>
<span className="visually-hidden">{tFA('hidePassword')}</span>
</>
) : (
<>
<Eye />
<span className="visually-hidden">
{tFA('showPassword')}
</span>
<span className="visually-hidden">{tFA('showPassword')}</span>
</>
)}
</Button>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/ResetPasswordForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import FormAlert from './FormAlert.jsx';
import PasswordVisibilityButton from './PasswordVisibilityButton';

function ResetPasswordForm({ onSuccess = () => null }) {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t } = useTranslation();
const { hash } = useParams();
const passwordRef = useRef();
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/SignInForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import PasswordVisibilityButton from './PasswordVisibilityButton.jsx';
import FormAlert from './FormAlert.jsx';

function SignInForm({ onSuccess = () => null }) {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t: tSI } = useTranslation('translation', { keyPrefix: 'signIn' });
const { t } = useTranslation();
const emailRef = useRef();
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/SignUpForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import PasswordVisibilityButton from './PasswordVisibilityButton.jsx';
import FormAlert from './FormAlert.jsx';

function SignupForm({ onSuccess = () => null }) {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t: tSU } = useTranslation('translation', { keyPrefix: 'signUp' });
const { t } = useTranslation();
const emailRef = useRef();
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Forms/UpdateAccountForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { email, username } from '../../utils/validationSchemas';
import FormAlert from './FormAlert.jsx';

function UpdateAccountForm() {
const { t: tPS } = useTranslation('translation', { keyPrefix: 'profileSettings' });
const { t: tPS } = useTranslation('translation', {
keyPrefix: 'profileSettings',
});
const { t } = useTranslation();
const emailRef = useRef();
const usernameRef = useRef();
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Modals/AttemptDuplicateSnippet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ const generateGuestUserData = () => {
};

function AttemptDuplicateSnippet({ handleClose, isOpen }) {
const { t: tMADS } = useTranslation('translation', { keyPrefix: 'modals.attemptDuplicateSnippet' });
const { t: tMADS } = useTranslation('translation', {
keyPrefix: 'modals.attemptDuplicateSnippet',
});
const { t: tErr } = useTranslation('translation', { keyPrefix: 'errors' });
const auth = useAuth();
const dispatch = useDispatch();
Expand Down Expand Up @@ -83,9 +85,7 @@ function AttemptDuplicateSnippet({ handleClose, isOpen }) {
<Button onClick={handleCopy} variant="primary">
{tMADS('copyButton')}
</Button>
<p className="d-flex justify-content-center my-0">
{tMADS('or')}
</p>
<p className="d-flex justify-content-center my-0">{tMADS('or')}</p>
<Button onClick={handleSignin} variant="outline-primary">
{tMADS('signinButton')}
</Button>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Modals/ChangeAvatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { useRef, useState } from 'react';
import AvatarEditor from 'react-avatar-editor';

function ChangeAvatar({ handleClose, isOpen }) {
const { t: tMCA } = useTranslation('translation', { keyPrefix: 'modals.changeAvatar' });
const { t: tMCA } = useTranslation('translation', {
keyPrefix: 'modals.changeAvatar',
});
const [avatarState, setAvatarState] = useState({
scale: 1,
img: null,
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/components/Modals/DuplicateSnippetModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ function DuplicateSnippetModal({ handleClose, isOpen }) {
const navigate = useNavigate();
const duplicateSnippet = useDuplicateSnippet();
const { genViewSnippetLink } = useSnippets();
const { t: tMDS } = useTranslation('translation', { keyPrefix: 'modals.duplicateSnippet' });
const { t: tTDS } = useTranslation('translation', { keyPrefix: 'toasts.duplicateSnippet' });
const { t: tMDS } = useTranslation('translation', {
keyPrefix: 'modals.duplicateSnippet',
});
const { t: tTDS } = useTranslation('translation', {
keyPrefix: 'toasts.duplicateSnippet',
});
const { t } = useTranslation();
const username = useSelector((state) => state.user.userInfo.username);

Expand Down Expand Up @@ -96,9 +100,7 @@ function DuplicateSnippetModal({ handleClose, isOpen }) {
return (
<Modal centered onHide={handleClose} show={isOpen}>
<Modal.Header className="py-3" closeButton>
<Modal.Title className="display-7">
{tMDS('title')}
</Modal.Title>
<Modal.Title className="display-7">{tMDS('title')}</Modal.Title>
</Modal.Header>
<Modal.Body>
<div className="d-flex flex-column gap-4">
Expand All @@ -115,9 +117,7 @@ function DuplicateSnippetModal({ handleClose, isOpen }) {
>
<div className="d-flex flex-column gap-3">
<Form.Group controlId="email">
<Form.Label>
{tMDS('snippetName')}
</Form.Label>
<Form.Label>{tMDS('snippetName')}</Form.Label>
<Form.Control
ref={nameRef}
isInvalid={
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Modals/InDevelopment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import Modal from 'react-bootstrap/Modal';
import { Tools } from 'react-bootstrap-icons';

function InDevelopment({ handleClose, isOpen }) {
const { t: tMID } = useTranslation('translation', { keyPrefix: 'modals.inDevelopment' });
const { t: tMID } = useTranslation('translation', {
keyPrefix: 'modals.inDevelopment',
});

return (
<Modal centered onHide={handleClose} show={isOpen} size="sm">
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/Modals/NewSnippet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const generateGuestUserData = () => {
};

function NewSnippet({ handleClose, isOpen }) {
const { t: tMNS } = useTranslation('translation', { keyPrefix: 'modals.newSnippet' });
const { t: tMNS } = useTranslation('translation', {
keyPrefix: 'modals.newSnippet',
});
const { t: tErr } = useTranslation('translation', { keyPrefix: 'errors' });
const { t } = useTranslation();
const auth = useAuth();
Expand Down Expand Up @@ -186,9 +188,7 @@ function NewSnippet({ handleClose, isOpen }) {
return (
<Modal centered onHide={handleModalClose} show={isOpen}>
<Modal.Header className="py-3 pb-0" closeButton>
<Modal.Title className="display-6 fs-3">
{tMNS('title')}
</Modal.Title>
<Modal.Title className="display-6 fs-3">{tMNS('title')}</Modal.Title>
</Modal.Header>
<Modal.Body>
<div className="row">
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Modals/RemoveAccount.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import routes from '../../routes';
import FormAlert from '../Forms/FormAlert.jsx';

function RemoveAccount({ handleClose, isOpen }) {
const { t: tMRA } = useTranslation('translation', { keyPrefix: 'modals.removeAccount' });
const { t: tMRA } = useTranslation('translation', {
keyPrefix: 'modals.removeAccount',
});
const { t } = useTranslation();
const auth = useAuth();

Expand Down Expand Up @@ -59,8 +61,7 @@ function RemoveAccount({ handleClose, isOpen }) {
</FormAlert>
<PersonFillDash className="bi fs-1 align-self-center text-danger m-3" />
<p>
{tMRA('message')}{' '}
<b>{tMRA('messageBold')}</b>
{tMRA('message')} <b>{tMRA('messageBold')}</b>
</p>
<div className="d-flex justify-content-end">
<Button
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Modals/RemoveAvatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Button, Modal, FormGroup } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';

function RemoveAvatar({ handleClose, isOpen }) {
const { t: tMRA } = useTranslation('translation', { keyPrefix: 'modals.removeAvatar' });
const { t: tMRA } = useTranslation('translation', {
keyPrefix: 'modals.removeAvatar',
});

return (
<Modal centered onHide={handleClose} show={isOpen} size="m">
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/components/Modals/ShareSnippet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { useSnippets } from '../../hooks';
function ShareSnippet({ isOpen, handleClose }) {
const { name, slug, ownerUsername } = useSelector(({ modal }) => modal.item);
const snippetApi = useSnippets();
const { t: tMS } = useTranslation('translation', { keyPrefix: 'modals.share' });
const { t: tMS } = useTranslation('translation', {
keyPrefix: 'modals.share',
});

useEffect(() => {
const clipboard = new ClipboardJS('.button-copy');
Expand Down Expand Up @@ -52,9 +54,7 @@ function ShareSnippet({ isOpen, handleClose }) {
variant="nofill-body"
>
<Clipboard className="bi" />
<span className="visually-hidden">
{tMS('copyLinkButton')}
</span>
<span className="visually-hidden">{tMS('copyLinkButton')}</span>
</Button>
</div>
</Form.Group>
Expand All @@ -78,9 +78,7 @@ function ShareSnippet({ isOpen, handleClose }) {
variant="nofill-body"
>
<Clipboard className="bi" />
<span className="visually-hidden">
{tMS('copyEmbedButton')}
</span>
<span className="visually-hidden">{tMS('copyEmbedButton')}</span>
</Button>
</div>
</Form.Group>
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/components/Modals/SignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ import SignInForm from '../Forms/SignInForm';

function SignInModal({ handleClose, isOpen }) {
const dispatch = useDispatch();
const { t: tSIF } = useTranslation('translation', { keyPrefix: 'signIn.footer' });
const { t: tSIF } = useTranslation('translation', {
keyPrefix: 'signIn.footer',
});
const { t: tSI } = useTranslation('translation', { keyPrefix: 'signIn' });

return (
<Modal centered onHide={handleClose} show={isOpen}>
<Modal.Header className="py-3" closeButton>
<Modal.Title className="display-6">
{tSI('pageHeader')}
</Modal.Title>
<Modal.Title className="display-6">{tSI('pageHeader')}</Modal.Title>
</Modal.Header>
<Modal.Body>
<SignInForm onSuccess={handleClose} />
<div className="d-flex justify-content-center align-items-baseline mt-5">
<span className="text-body-secondary">
{tSIF('signUpHeader')}
</span>{' '}
<span className="text-body-secondary">{tSIF('signUpHeader')}</span>{' '}
<Button
onClick={() => dispatch(actions.openModal({ type: 'signingUp' }))}
variant="link"
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/components/Modals/SignUp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ import { useAuth } from '../../hooks';
function SignUpModal({ handleClose, isOpen }) {
const dispatch = useDispatch();
const { t: tSU } = useTranslation('translation', { keyPrefix: 'signUp' });
const { t: tSUF } = useTranslation('translation', { keyPrefix: 'signUp.footer' });
const { t: tPA } = useTranslation('translation', { keyPrefix: 'profileActions' });
const { t: tSUF } = useTranslation('translation', {
keyPrefix: 'signUp.footer',
});
const { t: tPA } = useTranslation('translation', {
keyPrefix: 'profileActions',
});
const auth = useAuth();

const guestUser = localStorage.getItem('guestUserData');

return (
<Modal centered onHide={handleClose} show={isOpen}>
<Modal.Header className="py-3" closeButton>
<Modal.Title className="display-6">
{tSU('pageHeader')}
</Modal.Title>
<Modal.Title className="display-6">{tSU('pageHeader')}</Modal.Title>
</Modal.Header>
<Modal.Body>
{auth.isLoggedIn && guestUser ? (
Expand All @@ -32,9 +34,7 @@ function SignUpModal({ handleClose, isOpen }) {
)}
{!guestUser && (
<div className="d-flex justify-content-center align-items-baseline mt-5">
<span className="text-body-secondary">
{tSUF('signInHeader')}
</span>{' '}
<span className="text-body-secondary">{tSUF('signInHeader')}</span>{' '}
<Button
onClick={() => dispatch(actions.openModal({ type: 'signingIn' }))}
variant="link"
Expand Down
Loading

0 comments on commit 1855144

Please sign in to comment.