Skip to content

Commit 8a0850e

Browse files
authored
Merge branch 'release/3.0.0' into feature/5453-tests-of-hook
2 parents e1bff23 + 0e21382 commit 8a0850e

24 files changed

Lines changed: 1281 additions & 430 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ All notable changes to this project will be documented in this file.
1414
- Removed propTypes.
1515
- Upgraded redux-toolkit and how api slices are generated.
1616
- Fixed redux-toolkit cache handling.
17-
- Added Taskfile
17+
- Added Taskfile.
1818
- Added update command.
1919
- Added (Client) online-check to public.
2020
- Updated developer documentation.
21-
- Removed admin/access-config.json fetch
21+
- Removed admin/access-config.json fetch.
2222
- Aligned with v. 2.5.2.
2323
- Removed themes.
2424
- Added command to migrate config.json files.
2525
- Fix data fetching bug + tests
2626
- Refactored screen layout commands.
27+
- Moved list components (search and checkboxes) around.
28+
- Replaced lodash functions with native ones.
2729

2830
### NB! Prior to 3.x the project was split into separate repositories
2931

assets/admin/app.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ body {
1919
height: 100vh;
2020
height: -webkit-fill-available;
2121
max-height: 100vh;
22-
// overflow-x: auto;
23-
// overflow-y: hidden; // TODO: Why was this added?
2422
}
2523

2624
// To make multicomponent look like bootstrap for now
@@ -143,3 +141,10 @@ body {
143141
right: 0;
144142
margin: 2em;
145143
}
144+
145+
.delete-search-button {
146+
border-top-left-radius: 0;
147+
border-bottom-left-radius: 0;
148+
border-color: var(--bs-border-color);
149+
background-color: var(--bs-tertiary-bg);
150+
}

assets/admin/components/playlist/playlist-campaign-manager.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useEffect, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import { useNavigate, useLocation } from "react-router-dom";
4-
import set from "lodash.set";
54
import dayjs from "dayjs";
65
import { useDispatch } from "react-redux";
76
import idFromUrl from "../util/helpers/id-from-url";
@@ -281,7 +280,7 @@ function PlaylistCampaignManager({
281280
*/
282281
const handleInput = ({ target }) => {
283282
const localFormStateObject = { ...formStateObject };
284-
set(localFormStateObject, target.id, target.value);
283+
localFormStateObject[target.id] = target.value;
285284
setFormStateObject(localFormStateObject);
286285
};
287286

assets/admin/components/screen/screen-manager.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useEffect, useState } from "react";
22
import { useTranslation } from "react-i18next";
3-
import set from "lodash.set";
43
import { useNavigate } from "react-router-dom";
54
import {
65
usePostV2ScreensMutation,
@@ -96,7 +95,7 @@ function ScreenManager({
9695
const handleInput = ({ target }) => {
9796
let localFormStateObject = { ...formStateObject };
9897
localFormStateObject = JSON.parse(JSON.stringify(localFormStateObject));
99-
set(localFormStateObject, target.id, target.value);
98+
localFormStateObject[target.id] = target.value;
10099
setFormStateObject(localFormStateObject);
101100
};
102101

assets/admin/components/slide/content/contacts/contact-form.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import set from "lodash.set";
21
import { Col, Row } from "react-bootstrap";
32
import { useTranslation } from "react-i18next";
43
import FileSelector from "../file-selector";
@@ -28,7 +27,7 @@ function ContactForm({
2827
*/
2928
const onInput = ({ target }) => {
3029
const localContact = { ...contact };
31-
set(localContact, target.name, target.value);
30+
localContact[target.name] = target.value;
3231
onChange(localContact);
3332
};
3433

assets/admin/components/slide/content/feed-selector.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import { Spinner } from "react-bootstrap";
44
import { useDispatch } from "react-redux";
5-
import set from "lodash.set";
65
import {
76
enhancedApi,
87
useGetV2FeedSourcesQuery,
@@ -100,12 +99,12 @@ function FeedSelector({
10099
const configuration = { ...value.configuration };
101100

102101
if (target !== null) {
103-
set(configuration, target.id, target.value);
102+
configuration[target.id] = target.value;
104103
}
105104

106105
if (targets !== null) {
107106
targets.forEach(({ id, value: targetValue }) => {
108-
set(configuration, id, targetValue);
107+
configuration[id] = targetValue;
109108
});
110109
}
111110

assets/admin/components/slide/slide-manager.jsx

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { useEffect, useState, useContext } from "react";
22
import { useTranslation } from "react-i18next";
3-
import get from "lodash.get";
4-
import set from "lodash.set";
53
import { ulid } from "ulid";
64
import { useDispatch } from "react-redux";
75
import dayjs from "dayjs";
@@ -155,7 +153,7 @@ function SlideManager({
155153
*/
156154
const handleInput = ({ target }) => {
157155
const localFormStateObject = { ...formStateObject };
158-
set(localFormStateObject, target.id, target.value);
156+
localFormStateObject[target.id] = target.value;
159157
setFormStateObject(localFormStateObject);
160158
};
161159

@@ -208,7 +206,7 @@ function SlideManager({
208206
const value =
209207
target.type === "number" ? target.valueAsNumber : target.value;
210208
const localFormStateObject = { ...formStateObject };
211-
set(localFormStateObject.content, target.id, value);
209+
localFormStateObject.content[target.id] = value;
212210
setFormStateObject(localFormStateObject);
213211
};
214212

@@ -353,12 +351,12 @@ function SlideManager({
353351
// It is an already added temp file.
354352
if (entry.tempId) {
355353
newField.push(entry.tempId);
356-
set(localMediaData, entry.tempId, entry);
354+
localMediaData[entry.tempId] = entry;
357355
}
358356
// It is a new temp file.
359357
else {
360358
if (!Array.isArray(localFormStateObject.content[fieldId])) {
361-
set(localFormStateObject.content, fieldId, []);
359+
localFormStateObject.content[fieldId] = [];
362360
}
363361

364362
// Create a tempId for the media.
@@ -369,7 +367,7 @@ function SlideManager({
369367

370368
const newEntry = { ...entry };
371369
newEntry.tempId = tempId;
372-
set(localMediaData, tempId, newEntry);
370+
localMediaData[tempId] = newEntry;
373371
}
374372
}
375373
// Previously selected file.
@@ -383,18 +381,16 @@ function SlideManager({
383381
if (
384382
!Object.prototype.hasOwnProperty.call(localMediaData, entry["@id"])
385383
) {
386-
set(localMediaData, entry["@id"], entry);
384+
localMediaData[entry["@id"]] = entry;
387385

388386
localFormStateObject.media.push(entry["@id"]);
389387
}
390388
}
391389
});
392390
}
393391

394-
set(localFormStateObject.content, fieldId, newField);
395-
set(localFormStateObject, "media", [
396-
...new Set([...localFormStateObject.media]),
397-
]);
392+
localFormStateObject.content[fieldId] = newField;
393+
localFormStateObject.media = [...new Set([...localFormStateObject.media])];
398394

399395
setFormStateObject(localFormStateObject);
400396
setMediaData(localMediaData);
@@ -406,7 +402,7 @@ function SlideManager({
406402

407403
// Setup submittingMedia list.
408404
mediaFields.forEach((fieldName) => {
409-
const fieldData = get(formStateObject.content, fieldName);
405+
const fieldData = formStateObject.content[fieldName];
410406

411407
if (fieldData) {
412408
if (Array.isArray(fieldData)) {
@@ -548,33 +544,25 @@ function SlideManager({
548544

549545
/** Submitted media is successful. */
550546
useEffect(() => {
551-
if (submitting) {
552-
if (isSaveMediaSuccess) {
553-
const newSubmittingMedia = [...submittingMedia];
554-
const submittedMedia = newSubmittingMedia.shift();
555-
556-
const newFormStateObject = { ...formStateObject };
557-
newFormStateObject.media.push(savedMediaData["@id"]);
558-
559-
// Replace TEMP-- id with real id.
560-
set(
561-
newFormStateObject.content,
562-
submittedMedia.fieldName,
563-
get(newFormStateObject.content, submittedMedia.fieldName).map(
564-
(mediaId) =>
565-
mediaId === submittedMedia.tempId
566-
? savedMediaData["@id"]
567-
: mediaId,
568-
),
547+
if (submitting && isSaveMediaSuccess) {
548+
const newSubmittingMedia = [...submittingMedia];
549+
const submittedMedia = newSubmittingMedia.shift();
550+
551+
const newFormStateObject = { ...formStateObject };
552+
newFormStateObject.media.push(savedMediaData["@id"]);
553+
554+
// Replace TEMP-- id with real id.
555+
newFormStateObject.content[submittedMedia.fieldName] =
556+
newFormStateObject.content[submittedMedia.fieldName].map((mediaId) =>
557+
mediaId === submittedMedia.tempId ? savedMediaData["@id"] : mediaId,
569558
);
570559

571-
const newMediaData = { ...mediaData };
572-
newMediaData[savedMediaData["@id"]] = savedMediaData;
573-
setMediaData(newMediaData);
560+
const newMediaData = { ...mediaData };
561+
newMediaData[savedMediaData["@id"]] = savedMediaData;
562+
setMediaData(newMediaData);
574563

575-
// Save new list.
576-
setSubmittingMedia(newSubmittingMedia);
577-
}
564+
// Save the new list.
565+
setSubmittingMedia(newSubmittingMedia);
578566
}
579567
}, [isSaveMediaSuccess]);
580568

0 commit comments

Comments
 (0)