Skip to content

Commit 3599a91

Browse files
committed
3172: Applied coding standards
1 parent bb98a4a commit 3599a91

File tree

11 files changed

+47
-48
lines changed

11 files changed

+47
-48
lines changed

src/components/activation-code/activation-code-form.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import StickyFooter from "../util/sticky-footer";
1717
* @param {object} props.activationCode The activationCode object to modify in the form.
1818
* @param {Function} props.handleInput Handles form input.
1919
* @param {Function} props.handleSubmit Handles form submit.
20-
* @param {Function} props.handleSaveNoClose Handles form submit without close.
2120
* @param {string} props.headerText Headline text.
2221
* @param {boolean} props.isLoading Indicator of whether the form is loading
2322
* @param {string} props.loadingMessage The loading message for the spinner
@@ -115,7 +114,6 @@ ActivationCodeForm.propTypes = {
115114
}).isRequired,
116115
handleInput: PropTypes.func.isRequired,
117116
handleSubmit: PropTypes.func.isRequired,
118-
handleSaveNoClose: PropTypes.func.isRequired,
119117
headerText: PropTypes.string.isRequired,
120118
isLoading: PropTypes.bool,
121119
loadingMessage: PropTypes.string,

src/components/feed-sources/feed-source-form.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import StickyFooter from "../util/sticky-footer";
2121
* @param {object} props.feedSource The feed-source object to modify in the form.
2222
* @param {Function} props.handleInput Handles form input.
2323
* @param {Function} props.handleSubmit Handles form submit.
24+
* @param {Function} props.handleSaveNoClose Handles form submit with close.
2425
* @param {string} props.headerText Headline text.
2526
* @param {boolean} [props.isLoading] Indicator of whether the form is loading.
2627
* Default is `false`
@@ -93,7 +94,8 @@ function FeedSourceForm({
9394
feedSourceId={feedSource["@id"]}
9495
/>
9596
)}
96-
{feedSource?.feedType === "App\\Feed\\EventDatabaseApiFeedType" && (
97+
{feedSource?.feedType ===
98+
"App\\Feed\\EventDatabaseApiFeedType" && (
9799
<EventDatabaseApiFeedType
98100
handleInput={handleSecretInput}
99101
formStateObject={feedSource.secrets}

src/components/playlist/playlist-campaign-form.jsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Alert, Button, Col, Form, Row } from "react-bootstrap";
33
import { useTranslation } from "react-i18next";
44
import { useNavigate } from "react-router-dom";
55
import PropTypes from "prop-types";
6+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
7+
import { faExpand } from "@fortawesome/free-solid-svg-icons";
68
import ContentBody from "../util/content-body/content-body";
79
import FormInput from "../util/forms/form-input";
810
import FormInputArea from "../util/forms/form-input-area";
@@ -12,8 +14,6 @@ import Preview from "../preview/preview";
1214
import idFromUrl from "../util/helpers/id-from-url";
1315
import StickyFooter from "../util/sticky-footer";
1416
import localStorageKeys from "../util/local-storage-keys";
15-
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
16-
import {faExpand} from "@fortawesome/free-solid-svg-icons";
1717

1818
/**
1919
* The shared form component.
@@ -29,6 +29,7 @@ import {faExpand} from "@fortawesome/free-solid-svg-icons";
2929
* @param {boolean} props.isCampaign If it is a campaign form.
3030
* @param {string} props.location Either playlist or campaign.
3131
* @param {Array} props.children The children being passed from parent
32+
* @param {Function} props.handleSaveNoClose Handles form submit with close.
3233
* @returns {object} The form shared by campaigns and playlists.
3334
*/
3435
function PlaylistCampaignForm({
@@ -44,7 +45,9 @@ function PlaylistCampaignForm({
4445
isCampaign = false,
4546
playlist = null,
4647
}) {
47-
const { t } = useTranslation("common", {'keyPrefix': 'playlist-campaign-form'});
48+
const { t } = useTranslation("common", {
49+
keyPrefix: "playlist-campaign-form",
50+
});
4851
const navigate = useNavigate();
4952
const [publishedFromError, setPublishedFromError] = useState(false);
5053
const [publishedToError, setPublishedToError] = useState(false);
@@ -98,19 +101,15 @@ function PlaylistCampaignForm({
98101
name="title"
99102
type="text"
100103
label={t("playlist-name-label")}
101-
placeholder={t(
102-
"playlist-name-placeholder"
103-
)}
104+
placeholder={t("playlist-name-placeholder")}
104105
value={playlist.title}
105106
onChange={handleInput}
106107
/>
107108
<FormInputArea
108109
name="description"
109110
type="text"
110111
label={t("playlist-description-label")}
111-
placeholder={t(
112-
"playlist-description-placeholder"
113-
)}
112+
placeholder={t("playlist-description-placeholder")}
114113
value={playlist.description}
115114
onChange={handleInput}
116115
/>
@@ -126,9 +125,7 @@ function PlaylistCampaignForm({
126125
{/* Playlist or campaign form */}
127126
{children}
128127
<ContentBody>
129-
<h3 className="h4">
130-
{t("publish-title")}
131-
</h3>
128+
<h3 className="h4">{t("publish-title")}</h3>
132129
<Row className="g-2">
133130
<Col md>
134131
<FormInput
@@ -189,7 +186,8 @@ function PlaylistCampaignForm({
189186
size="lg"
190187
className="me-3 mt-3"
191188
>
192-
<FontAwesomeIcon icon={faExpand} className="me-3" /> {t("preview-in-full-screen")}
189+
<FontAwesomeIcon icon={faExpand} className="me-3" />{" "}
190+
{t("preview-in-full-screen")}
193191
</Button>
194192
</div>
195193
{previewOverlayVisible && (

src/components/preview/preview.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { React, JSX, useEffect, useState } from "react";
22
import PropTypes from "prop-types";
33
import { useTranslation } from "react-i18next";
4-
import LocalStorageKeys from "../util/local-storage-keys.jsx";
5-
import ConfigLoader from "../../config-loader.js";
4+
import LocalStorageKeys from "../util/local-storage-keys";
5+
import ConfigLoader from "../../config-loader";
66

77
/**
88
* The preview component.
@@ -25,7 +25,6 @@ function Preview({
2525
simulatedHeight = 1080,
2626
}) {
2727
const { t } = useTranslation("common", { keyPrefix: "preview" });
28-
2928
const [previewClientUrl, setPreviewClientUrl] = useState(null);
3029

3130
useEffect(() => {
@@ -45,7 +44,7 @@ function Preview({
4544
urlSearchParams.set("preview-tenant", JSON.parse(tenantEntry).tenantKey);
4645

4746
setPreviewClientUrl(`${base}?${urlSearchParams}`);
48-
})
47+
});
4948
}, []);
5049

5150
const scale = width / simulatedWidth;

src/components/screen/screen-form.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function ScreenForm({
6767
const checkInputsHandleSubmit = () => {
6868
setLayoutError(false);
6969
let submit = true;
70+
7071
if (!selectedLayout) {
7172
displayError(t("remember-layout-error"));
7273
setLayoutError(true);
@@ -305,6 +306,7 @@ function ScreenForm({
305306
helpText={t("search-to-se-possible-selections")}
306307
selected={selectedLayout ? [selectedLayout] : []}
307308
name="layout"
309+
error={layoutError}
308310
singleSelect
309311
/>
310312
</div>

src/components/slide/preview/remote-component-wrapper.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function RemoteComponentWrapper({
8383
}, [showPreview]);
8484

8585
useEffect(() => {
86+
// eslint-disable-next-line no-undef
8687
const observer = new ResizeObserver((entries) => {
8788
if (entries.length > 0) {
8889
const first = entries[0];

src/components/slide/slide-form.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { useTranslation } from "react-i18next";
44
import { useNavigate } from "react-router-dom";
55
import PropTypes from "prop-types";
66
import Form from "react-bootstrap/Form";
7+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
8+
import { faExpand } from "@fortawesome/free-solid-svg-icons";
79
import ContentBody from "../util/content-body/content-body";
810
import MultiSelectComponent from "../util/forms/multiselect-dropdown/multi-dropdown";
911
import {
@@ -23,8 +25,6 @@ import userContext from "../../context/user-context";
2325
import "./slide-form.scss";
2426
import Preview from "../preview/preview";
2527
import StickyFooter from "../util/sticky-footer";
26-
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
27-
import {faExpand} from "@fortawesome/free-solid-svg-icons";
2828

2929
/**
3030
* The slide form component.
@@ -93,7 +93,8 @@ function SlideForm({
9393

9494
/**
9595
* Check if template is set
96-
* @param noRedirect
96+
*
97+
* @param {boolean | null} noRedirect Avoid close after save.
9798
*/
9899
const checkInputsHandleSubmit = (noRedirect) => {
99100
setTemplateError(false);
@@ -361,7 +362,7 @@ function SlideForm({
361362
{displayPreview && (
362363
<Col
363364
className="responsive-side shadow-sm p-3 mb-3 bg-body rounded me-3 sticky-top"
364-
style={{top: "20px"}}
365+
style={{ top: "20px" }}
365366
>
366367
<h2 className="h4">{t("slide-preview")}</h2>
367368

@@ -387,7 +388,8 @@ function SlideForm({
387388
}
388389
className="me-3 mt-3 float-end"
389390
>
390-
<FontAwesomeIcon icon={faExpand} className="me-3"/>{t("preview-in-full-screen")}
391+
<FontAwesomeIcon icon={faExpand} className="me-3" />
392+
{t("preview-in-full-screen")}
391393
</Button>
392394
</>
393395
)}
@@ -406,7 +408,7 @@ function SlideForm({
406408
>
407409
{t("slide-preview-about")}
408410
</Alert>
409-
<Preview id={idFromUrl(slide["@id"])} mode="slide"/>
411+
<Preview id={idFromUrl(slide["@id"])} mode="slide" />
410412
</div>
411413
)}
412414
</Col>

src/components/slide/slides-list.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import {React, useState, useEffect, useContext} from "react";
2-
import {useTranslation} from "react-i18next";
1+
import { React, useState, useEffect, useContext } from "react";
2+
import { useTranslation } from "react-i18next";
33
import List from "../util/list/list";
44
import idFromUrl from "../util/helpers/id-from-url";
55
import UserContext from "../../context/user-context";
66
import ListContext from "../../context/list-context";
77
import ContentHeader from "../util/content-header/content-header";
88
import ContentBody from "../util/content-body/content-body";
99
import useModal from "../../context/modal-context/modal-context-hook";
10-
import {SlideColumns} from "./slides-columns";
10+
import { SlideColumns } from "./slides-columns";
1111
import {
1212
displayError,
1313
displaySuccess,
@@ -17,23 +17,22 @@ import {
1717
useDeleteV2SlidesByIdMutation,
1818
useGetV2PlaylistsByIdQuery,
1919
} from "../../redux/api/api.generated.ts";
20-
import Row from "react-bootstrap/Row";
2120

2221
/**
2322
* The slides list component.
2423
*
2524
* @returns {object} The slides list
2625
*/
2726
function SlidesList() {
28-
const {t} = useTranslation("common", {keyPrefix: "slides-list"});
27+
const { t } = useTranslation("common", { keyPrefix: "slides-list" });
2928
const context = useContext(UserContext);
30-
const {selected, setSelected} = useModal();
29+
const { selected, setSelected } = useModal();
3130

3231
const {
33-
searchText: {get: searchText},
34-
page: {get: page},
35-
createdBy: {get: createdBy},
36-
isPublished: {get: isPublished},
32+
searchText: { get: searchText },
33+
page: { get: page },
34+
createdBy: { get: createdBy },
35+
isPublished: { get: isPublished },
3736
} = useContext(ListContext);
3837

3938
// Local state
@@ -44,7 +43,7 @@ function SlidesList() {
4443
);
4544

4645
// Delete call
47-
const [DeleteV2Slides, {isSuccess: isDeleteSuccess, error: isDeleteError}] =
46+
const [DeleteV2Slides, { isSuccess: isDeleteSuccess, error: isDeleteError }] =
4847
useDeleteV2SlidesByIdMutation();
4948

5049
// Get method
@@ -55,7 +54,7 @@ function SlidesList() {
5554
refetch,
5655
} = useGetV2SlidesQuery({
5756
page,
58-
order: {createdAt: "desc"},
57+
order: { createdAt: "desc" },
5958
title: searchText,
6059
published: isPublished,
6160
createdBy,
@@ -84,7 +83,7 @@ function SlidesList() {
8483
const slideToDelete = selected[0];
8584
setSelected(selected.slice(1));
8685
const slideToDeleteId = idFromUrl(slideToDelete.id);
87-
DeleteV2Slides({id: slideToDeleteId});
86+
DeleteV2Slides({ id: slideToDeleteId });
8887
}
8988
}, [isDeleting, isDeleteSuccess]);
9089

src/components/themes/theme-create.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ function ThemeCreate() {
1717
media: [],
1818
};
1919

20-
return (
21-
<ThemeManager saveMethod="POST" initialState={data} />
22-
);
20+
return <ThemeManager saveMethod="POST" initialState={data} />;
2321
}
2422

2523
export default ThemeCreate;

src/components/themes/theme-form.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import StickyFooter from "../util/sticky-footer";
1818
* @param {object} props.theme The theme object to modify in the form.
1919
* @param {Function} props.handleInput Handles form input.
2020
* @param {Function} props.handleSubmit Handles form submit.
21+
* @param {Function} props.handleSaveNoClose Handles form submit without close.
2122
* @param {string} props.headerText Headline text.
2223
* @param {boolean} props.isLoading Indicator of whether the form is loading
2324
* @param {string} props.loadingMessage The loading message for the spinner
@@ -37,10 +38,7 @@ function ThemeForm({
3738

3839
return (
3940
<div>
40-
<LoadingComponent
41-
isLoading={isLoading}
42-
loadingMessage={loadingMessage}
43-
/>
41+
<LoadingComponent isLoading={isLoading} loadingMessage={loadingMessage} />
4442
<Form>
4543
<Row className="m-2">
4644
<h1 id="themeTitle">{headerText}</h1>

0 commit comments

Comments
 (0)