mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Fix PR feedback
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
parent
4b528451ba
commit
78fa5374a5
@ -1,4 +1,4 @@
|
||||
import React, { memo, useCallback, useMemo, useState } from 'react';
|
||||
import React, { memo, useMemo, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { get } from 'lodash';
|
||||
import { Flex, Text } from '@buffetjs/core';
|
||||
@ -34,7 +34,7 @@ const SubActionRow = ({
|
||||
} = usePermissionsDataManager();
|
||||
const [rowToOpen, setRowToOpen] = useState(null);
|
||||
|
||||
const handleClickToggleSubLevel = useCallback(name => {
|
||||
const handleClickToggleSubLevel = name => {
|
||||
setRowToOpen(prev => {
|
||||
if (prev === name) {
|
||||
return null;
|
||||
@ -42,7 +42,7 @@ const SubActionRow = ({
|
||||
|
||||
return name;
|
||||
});
|
||||
}, []);
|
||||
};
|
||||
|
||||
const displayedRecursiveChildren = useMemo(() => {
|
||||
if (!rowToOpen) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import generateHeadersFromActions from '../generateHeadersFromActions';
|
||||
|
||||
describe('ADMIN | COMPONENTS | Permissions | CollapsePropertyMatrix | utils', () => {
|
||||
it('should set isActionRelatedToCurrentProperty key to false if the applyToProperties is not an array', () => {
|
||||
it('should set isActionRelatedToCurrentProperty key to false when the applyToProperties is not an array', () => {
|
||||
const data = [{ label: 'test' }, { label: 'test1' }];
|
||||
const expected = [
|
||||
{ label: 'test', isActionRelatedToCurrentProperty: false, actionId: undefined },
|
||||
@ -11,7 +11,7 @@ describe('ADMIN | COMPONENTS | Permissions | CollapsePropertyMatrix | utils', ()
|
||||
expect(generateHeadersFromActions(data, 'test')).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should set isActionRelatedToCurrentProperty key to false if the propertyName is not in the applyToProperties array', () => {
|
||||
it('should set isActionRelatedToCurrentProperty key to false when the propertyName is not in the applyToProperties array', () => {
|
||||
const data = [
|
||||
{ label: 'test', applyToProperties: ['foo'], actionId: 'test' },
|
||||
{ label: 'test1', applyToProperties: ['foo'], actionId: 'test' },
|
||||
@ -24,7 +24,7 @@ describe('ADMIN | COMPONENTS | Permissions | CollapsePropertyMatrix | utils', ()
|
||||
expect(generateHeadersFromActions(data, 'test')).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should set isActionRelatedToCurrentProperty key to false if the isDisplayed key is falsy', () => {
|
||||
it('should set isActionRelatedToCurrentProperty key to false when the isDisplayed key is falsy', () => {
|
||||
const data = [
|
||||
{ label: 'test', isDisplayed: false, actionId: 'test' },
|
||||
{ label: 'test1', isDisplayed: false, actionId: 'test' },
|
||||
@ -37,7 +37,7 @@ describe('ADMIN | COMPONENTS | Permissions | CollapsePropertyMatrix | utils', ()
|
||||
expect(generateHeadersFromActions(data, 'test')).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should set the isActionRelatedToCurrentProperty key to true if isDisplayed is truthy and the propertyName is in the applyToProperties array', () => {
|
||||
it('should set the isActionRelatedToCurrentProperty key to true when isDisplayed is truthy and the propertyName is in the applyToProperties array', () => {
|
||||
const data = [
|
||||
{ label: 'test', isDisplayed: true, applyToProperties: ['test'], actionId: 'test' },
|
||||
{ label: 'test1', isDisplayed: false, applyToProperties: ['test'], actionId: 'test' },
|
||||
|
@ -1,18 +1,15 @@
|
||||
import React, { memo, useCallback, useState } from 'react';
|
||||
import React, { memo, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ContentTypeCollapse from '../ContentTypeCollapse';
|
||||
|
||||
const ContentTypeCollapses = ({ actions, pathToData, subjects }) => {
|
||||
const [collapseToOpen, setCollapseToOpen] = useState(null);
|
||||
|
||||
const handleClickToggleCollapse = useCallback(
|
||||
collapseName => {
|
||||
const nextCollapseToOpen = collapseToOpen === collapseName ? null : collapseName;
|
||||
const handleClickToggleCollapse = collapseName => {
|
||||
const nextCollapseToOpen = collapseToOpen === collapseName ? null : collapseName;
|
||||
|
||||
setCollapseToOpen(nextCollapseToOpen);
|
||||
},
|
||||
[collapseToOpen]
|
||||
);
|
||||
setCollapseToOpen(nextCollapseToOpen);
|
||||
};
|
||||
|
||||
return subjects.map(({ uid, label, properties }, index) => {
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user