Merge branch 'main' into fix/clean-test-warnings

This commit is contained in:
Simone 2022-10-19 14:35:49 +02:00 committed by GitHub
commit 22636e4819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 19 deletions

View File

@ -227,7 +227,19 @@ class StrapiApp {
}
if (this.customConfigurations?.theme) {
merge(this.configurations.themes.light, this.customConfigurations.theme);
const darkTheme = this.customConfigurations.theme.dark;
const lightTheme = this.customConfigurations.theme.light;
if (!darkTheme && !lightTheme) {
console.warn(
`[deprecated] In future versions, Strapi will stop supporting this theme customization syntax. The theme configuration accepts a light and a dark key to customize each theme separately. See https://docs.strapi.io/developer-docs/latest/development/admin-customization.html#theme-extension.`
);
merge(this.configurations.themes.light, this.customConfigurations.theme);
}
if (lightTheme) merge(this.configurations.themes.light, lightTheme);
if (darkTheme) merge(this.configurations.themes.dark, darkTheme);
}
if (this.customConfigurations?.notifications?.releases !== undefined) {

View File

@ -201,7 +201,7 @@ const DraggableCard = ({
id: getTrad('components.DraggableCard.move.field'),
defaultMessage: 'Move {item}',
},
{ item: name }
{ item: labelField }
)}
onClick={(e) => e.stopPropagation()}
ref={refs.dragRef}
@ -223,7 +223,7 @@ const DraggableCard = ({
id: getTrad('components.DraggableCard.edit.field'),
defaultMessage: 'Edit {item}',
},
{ item: name }
{ item: labelField }
)}
type="button"
>
@ -237,7 +237,7 @@ const DraggableCard = ({
id: getTrad('components.DraggableCard.delete.field'),
defaultMessage: 'Delete {item}',
},
{ item: name }
{ item: labelField }
)}
type="button"
>

View File

@ -16,7 +16,7 @@ const FlexGap = styled(Flex)`
const Settings = ({ modifiedData, onChange, sortOptions }) => {
const { formatMessage } = useIntl();
const { settings } = modifiedData;
const { settings, metadatas } = modifiedData;
return (
<>
@ -122,7 +122,7 @@ const Settings = ({ modifiedData, onChange, sortOptions }) => {
>
{sortOptions.map((sortBy) => (
<Option key={sortBy} value={sortBy}>
{sortBy}
{metadatas[sortBy].list.label || sortBy}
</Option>
))}
</Select>

View File

@ -104,7 +104,7 @@ const SortDisplayedFields = ({
>
{listRemainingFields.map((field) => (
<MenuItem key={field} onClick={() => handleAddField(field)}>
{field}
{metadatas[field].list.label || field}
</MenuItem>
))}
</SimpleMenu>

View File

@ -1650,7 +1650,7 @@ exports[`ADMIN | CM | LV | Configure the view renders and matches the snapshot 1
<span
class="c24 c78"
>
hey
id
</span>
</div>
<div
@ -3517,7 +3517,7 @@ exports[`ADMIN | CM | LV | Configure the view should add field 1`] = `
<span
class="c24 c78"
>
hey
id
</span>
</div>
<div
@ -3680,7 +3680,7 @@ exports[`ADMIN | CM | LV | Configure the view should add field 1`] = `
spacing="3"
>
<span
aria-label="Move cover"
aria-label="Move Cover"
class="c75 c76 c77"
draggable="true"
type="button"
@ -3725,14 +3725,14 @@ exports[`ADMIN | CM | LV | Configure the view should add field 1`] = `
<span
class="c24 c78"
>
michka
Cover
</span>
</div>
<div
class="c79 c66"
>
<button
aria-label="Edit cover"
aria-label="Edit Cover"
class="c76"
type="button"
>
@ -3752,7 +3752,7 @@ exports[`ADMIN | CM | LV | Configure the view should add field 1`] = `
</svg>
</button>
<button
aria-label="Delete cover"
aria-label="Delete Cover"
class="c76"
data-testid="delete-cover"
type="button"

View File

@ -60,13 +60,13 @@ const layout = {
},
cover: {
list: {
label: 'michka',
label: 'Cover',
sortable: false,
},
},
id: {
list: {
label: 'hey',
label: 'id',
sortable: true,
},
},
@ -153,9 +153,9 @@ describe('ADMIN | CM | LV | Configure the view', () => {
fireEvent.mouseDown(screen.getByTestId('add-field'));
await waitFor(() => expect(screen.getByText('cover')).toBeInTheDocument());
await waitFor(() => expect(screen.getByText('Cover')).toBeInTheDocument());
fireEvent.mouseDown(screen.getByText('cover'));
fireEvent.mouseDown(screen.getByText('Cover'));
fireEvent.mouseDown(screen.getByTestId('add-field'));
expect(container).toMatchSnapshot();

View File

@ -1,14 +1,29 @@
import { createStore, applyMiddleware } from 'redux';
import { createStore, applyMiddleware, compose } from 'redux';
import createReducer from './createReducer';
const configureStore = (appMiddlewares, appReducers) => {
let composeEnhancers = compose;
const middlewares = [];
appMiddlewares.forEach((middleware) => {
middlewares.push(middleware());
});
return createStore(createReducer(appReducers), {}, applyMiddleware(...middlewares));
// If Redux Dev Tools are installed, enable them
if (
process.env.NODE_ENV !== 'production' &&
typeof window === 'object' &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
) {
composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({});
}
return createStore(
createReducer(appReducers),
{},
composeEnhancers(applyMiddleware(...middlewares))
);
};
export default configureStore;