Fix review issues

This commit is contained in:
bulby97 2021-09-03 16:03:47 +02:00
parent 0509d4c97f
commit 2e24f87b4c
16 changed files with 38 additions and 26 deletions

View File

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import { useQuery } from '@strapi/helper-plugin'; import { useQuery } from '@strapi/helper-plugin';

View File

@ -1,6 +1,6 @@
import { Box, Row, TableLabel } from '@strapi/parts'; import { Box, Row, TableLabel } from '@strapi/parts';
import { MultiSelectNested } from '@strapi/parts/Select'; import { MultiSelectNested } from '@strapi/parts/Select';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';

View File

@ -1,5 +1,5 @@
/* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/click-events-have-key-events */
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
const UpperFirst = ({ content }) => upperFirst(content); const UpperFirst = ({ content }) => upperFirst(content);

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Checkbox, BaseCheckbox } from '@strapi/parts'; import { Checkbox, BaseCheckbox } from '@strapi/parts';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
const EventRow = ({ disabledEvents, name, events, inputValue, handleChange, handleChangeAll }) => { const EventRow = ({ disabledEvents, name, events, inputValue, handleChange, handleChangeAll }) => {
const enabledCheckboxes = events.filter(event => { const enabledCheckboxes = events.filter(event => {

View File

@ -1,8 +1,8 @@
import { Stack, FieldLabel, P, TableLabel } from '@strapi/parts'; import { FieldLabel, P, Stack, TableLabel } from '@strapi/parts';
import { useFormikContext } from 'formik'; import { useFormikContext } from 'formik';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import { FormattedMessage, useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import styled from 'styled-components'; import styled from 'styled-components';
import EventRow from './EventRow'; import EventRow from './EventRow';
import formatValue from './utils/formatValue'; import formatValue from './utils/formatValue';
@ -111,15 +111,16 @@ const EventInput = ({ isDraftAndPublish }) => {
{headersName.map(header => { {headersName.map(header => {
if (header === 'app.utils.publish' || header === 'app.utils.unpublish') { if (header === 'app.utils.publish' || header === 'app.utils.unpublish') {
return ( return (
<FormattedMessage id="Settings.webhooks.event.publish-tooltip" key={header}> <td
{msg => ( key={header}
<td title={msg}> title={formatMessage({
<TableLabel textColor="neutral600"> id: 'Settings.webhooks.event.publish-tooltip',
{formatMessage({ id: header })} defaultMessage:
</TableLabel> 'This event only exists for contents with Draft/Publish system enabled',
})}
>
<TableLabel textColor="neutral600">{formatMessage({ id: header })}</TableLabel>
</td> </td>
)}
</FormattedMessage>
); );
} }

View File

@ -49,7 +49,11 @@ const HeadersInput = () => {
name={`headers.${i}.key`} name={`headers.${i}.key`}
aria-label={`row ${i + 1} key`} aria-label={`row ${i + 1} key`}
error={ error={
errors.headers?.[i]?.key && formatMessage({ id: errors.headers[i]?.key }) errors.headers?.[i]?.key &&
formatMessage({
id: errors.headers[i]?.key,
defaultMessage: errors.headers[i]?.key,
})
} }
/> />
</GridItem> </GridItem>
@ -62,7 +66,10 @@ const HeadersInput = () => {
name={`headers.${i}.value`} name={`headers.${i}.value`}
error={ error={
errors.headers?.[i]?.value && errors.headers?.[i]?.value &&
formatMessage({ id: errors.headers[i]?.value }) formatMessage({
id: errors.headers[i]?.value,
defaultMessage: errors.headers[i]?.value,
})
} }
/> />
</Box> </Box>

View File

@ -88,7 +88,10 @@ const WebhookForm = ({
} }
navigationAction={ navigationAction={
<Link startIcon={<BackIcon />} to="/settings/webhooks"> <Link startIcon={<BackIcon />} to="/settings/webhooks">
Go back {formatMessage({
id: 'app.components.go-back',
defaultMessage: 'Go back',
})}
</Link> </Link>
} }
as="h1" as="h1"

View File

@ -9,7 +9,7 @@ import {
ModalForm, ModalForm,
} from '@strapi/helper-plugin'; } from '@strapi/helper-plugin';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import { AttributeIcon, Button } from '@buffetjs/core'; import { AttributeIcon, Button } from '@buffetjs/core';
const PopupForm = ({ const PopupForm = ({

View File

@ -202,6 +202,7 @@
"Users.components.List.empty": "There is no users...", "Users.components.List.empty": "There is no users...",
"Users.components.List.empty.withFilters": "There is no users with the applied filters...", "Users.components.List.empty.withFilters": "There is no users with the applied filters...",
"Users.components.List.empty.withSearch": "There is no users corresponding to the search ({search})...", "Users.components.List.empty.withSearch": "There is no users corresponding to the search ({search})...",
"app.components.go-back": "Go back",
"app.components.ToggleCheckbox.on-label": "On", "app.components.ToggleCheckbox.on-label": "On",
"app.components.ToggleCheckbox.off-label": "Off", "app.components.ToggleCheckbox.off-label": "Off",
"app.components.BlockLink.code": "Code examples", "app.components.BlockLink.code": "Code examples",

View File

@ -2,7 +2,7 @@ import React, { useRef } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Select from 'react-select'; import Select from 'react-select';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import MenuList from './MenuList'; import MenuList from './MenuList';
import getTrad from '../../utils/getTrad'; import getTrad from '../../utils/getTrad';

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { components } from 'react-select'; import { components } from 'react-select';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import { useQuery } from '@strapi/helper-plugin'; import { useQuery } from '@strapi/helper-plugin';
import useDataManager from '../../hooks/useDataManager'; import useDataManager from '../../hooks/useDataManager';
import Ul from '../SelectMenuUl'; import Ul from '../SelectMenuUl';

View File

@ -1,5 +1,5 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
const UpperFirst = ({ content }) => upperFirst(content); const UpperFirst = ({ content }) => upperFirst(content);

View File

@ -1,4 +1,4 @@
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
const generateAllowedActions = permissionsNames => const generateAllowedActions = permissionsNames =>
permissionsNames.reduce((acc, current) => { permissionsNames.reduce((acc, current) => {

View File

@ -1,4 +1,4 @@
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
const generateResultsObject = array => const generateResultsObject = array =>
array.reduce((acc, current) => { array.reduce((acc, current) => {

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import Wrapper from './Wrapper'; import Wrapper from './Wrapper';
import RemoveButton from './RemoveButton'; import RemoveButton from './RemoveButton';

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { Flex, Padded, Text } from '@buffetjs/core'; import { Flex, Padded, Text } from '@buffetjs/core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { upperFirst } from 'lodash'; import upperFirst from 'lodash/upperFirst';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
const PrefixedIcon = ({ icon, name }) => { const PrefixedIcon = ({ icon, name }) => {