From b838ab81faf46c63f7284c83c43da38eb494aaec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Thu, 28 Dec 2023 15:21:54 +0100 Subject: [PATCH] TASK: Fix linting issues --- .../DimensionSwitcher/DimensionSelector.js | 1 - .../DimensionSelectorOption.js | 3 ++- .../PrimaryToolbar/DimensionSwitcher/index.js | 26 +++++++++---------- .../DimensionSwitcher/style.module.css | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js index 22a1e8b72c..70666ee17f 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelector.js @@ -45,7 +45,6 @@ export default class DimensionSelector extends PureComponent { const presetOptions = mapValues( presets, (presetConfiguration, presetName) => { - return { label: presetConfiguration?.label, value: presetName, diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js index d9be035428..75f73cb87c 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/DimensionSelectorOption.js @@ -13,6 +13,7 @@ export default class DimensionSelectorOption extends PureComponent { existing: PropTypes.bool }) }; + render() { const {option} = this.props; const className = mergeClassNames({ @@ -25,7 +26,7 @@ export default class DimensionSelectorOption extends PureComponent { ); } diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js index 07f7142fec..7574d9dc37 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/index.js @@ -157,7 +157,6 @@ export default class DimensionSwitcher extends PureComponent { } } - handleApplyPresets = () => { this.props.selectPreset(this.state.transientPresets); this.setState({isOpen: false, transientPresets: {}}); @@ -171,13 +170,13 @@ export default class DimensionSwitcher extends PureComponent { this.setState({isOpen: false}); } - createDirectDimensionsLink = (dimensionName, presetConfigurationValues ) => { + createDirectDimensionsLink = (dimensionName, presetConfigurationValues) => { const {documentNode} = this.props; const nodeContextPath = documentNode.properties._path + ';' + dimensionName + '=' + presetConfigurationValues.join(',') const uri = new URL(window.location.href); uri.searchParams.set('node', nodeContextPath); - //console.log(uri.toString()); + // console.log(uri.toString()); return uri.toString(); } @@ -280,37 +279,36 @@ export default class DimensionSwitcher extends PureComponent { return null; } + getDocumentDimensions(dimensionName) { const {getNodeByContextPath, documentNode, allowedPresets, contentDimensions} = this.props; const currentDocumentNode = getNodeByContextPath(documentNode.contextPath) - if(!currentDocumentNode.dimensions){ + if (!currentDocumentNode.dimensions) { return allowedPresets[dimensionName] } - let variants = [...currentDocumentNode?.otherNodeVariants]; + const variants = [...currentDocumentNode?.otherNodeVariants]; variants.push(currentDocumentNode.dimensions) - for(let dimensionKey of Object.keys(contentDimensions)){ - if(dimensionKey == dimensionName) { + for (const dimensionKey of Object.keys(contentDimensions)) { + if (dimensionKey === dimensionName) { break; } Object.entries(variants).forEach(entry => { const [key, value] = entry; - if(value[dimensionKey] != this.state.transientPresets[dimensionKey]){ - delete variants[key] + if (value[dimensionKey] !== this.state.transientPresets[dimensionKey]) { + delete variants[key] } }); } - let dimensions = [] + const dimensions = [] Object.values(variants).forEach(entry => { - dimensions.push(entry[dimensionName]); }); return dimensions; } - presetsForDimension(dimensionName) { const {contentDimensions, allowedPresets, i18nRegistry} = this.props; const dimensionConfiguration = $get(dimensionName, contentDimensions); @@ -320,8 +318,8 @@ export default class DimensionSwitcher extends PureComponent { return Object.assign({}, presetConfiguration, { label: i18nRegistry.translate(presetConfiguration.label), disallowed: !(allowedPresets[dimensionName] && allowedPresets[dimensionName].includes(presetName)), - existing: documentDimensions.some(dimension=> presetConfiguration.values.includes(dimension)), - uri: this.createDirectDimensionsLink( dimensionName, presetConfiguration.values) + existing: documentDimensions.some(dimension => presetConfiguration.values.includes(dimension)), + uri: this.createDirectDimensionsLink(dimensionName, presetConfiguration.values) }); }); } diff --git a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css index 34e42e18f1..093051a444 100644 --- a/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css +++ b/packages/neos-ui/src/Containers/PrimaryToolbar/DimensionSwitcher/style.module.css @@ -61,7 +61,7 @@ } .nonExistent { - opacity: 0.5; + opacity: .5; } .disallowed { text-decoration: line-through;