diff --git a/.github/workflows/javascript.yaml b/.github/workflows/javascript.yaml index 5b20c8da..801ddbe9 100644 --- a/.github/workflows/javascript.yaml +++ b/.github/workflows/javascript.yaml @@ -33,4 +33,4 @@ jobs: docker network create frontend - run: | - docker compose run --rm prettier 'assets/**/*.js' --check + docker compose run --rm prettier 'assets/**/*.{js,jsx}' --check diff --git a/assets/admin/app.jsx b/assets/admin/app.jsx index bca4ee6a..c34c6d70 100644 --- a/assets/admin/app.jsx +++ b/assets/admin/app.jsx @@ -92,7 +92,7 @@ function App() { useEffect(() => { AdminConfigLoader.loadConfig().then((loadedConfig) => { setConfig(loadedConfig); - }) + }); }, []); const handleReauthenticate = () => { @@ -122,7 +122,7 @@ function App() { // If there is a selected tenant, fetch from local storage and use if (localStorage.getItem(localStorageKeys.SELECTED_TENANT)) { setSelectedTenant( - JSON.parse(localStorage.getItem(localStorageKeys.SELECTED_TENANT)) + JSON.parse(localStorage.getItem(localStorageKeys.SELECTED_TENANT)), ); } diff --git a/assets/admin/components/activation-code/activation-code-columns.jsx b/assets/admin/components/activation-code/activation-code-columns.jsx index 9350f5db..bc7761a1 100644 --- a/assets/admin/components/activation-code/activation-code-columns.jsx +++ b/assets/admin/components/activation-code/activation-code-columns.jsx @@ -50,7 +50,7 @@ function getActivationCodeColumns() { const ActivationCodeColumns = ColumnHoc(getActivationCodeColumns, true, true); const SelectActivationCodeColumns = SelectColumnHoc( getActivationCodeColumns, - true + true, ); export { SelectActivationCodeColumns, ActivationCodeColumns }; diff --git a/assets/admin/components/activation-code/activation-code-list.jsx b/assets/admin/components/activation-code/activation-code-list.jsx index fb1fdf08..a7803b04 100644 --- a/assets/admin/components/activation-code/activation-code-list.jsx +++ b/assets/admin/components/activation-code/activation-code-list.jsx @@ -40,7 +40,7 @@ function ActivationCodeList() { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-activation-code") + t("loading-messages.loading-activation-code"), ); // Remove from tenant call @@ -104,7 +104,7 @@ function ActivationCodeList() { setIsDeleting(false); displayError( t("error-messages.activation-code-delete-error"), - isDeleteError + isDeleteError, ); } }, [isDeleteError]); @@ -120,7 +120,7 @@ function ActivationCodeList() { if (activationCodeGetError) { displayError( t("error-messages.activation-code-load-error"), - activationCodeGetError + activationCodeGetError, ); } }, [activationCodeGetError]); @@ -139,7 +139,7 @@ function ActivationCodeList() { userActivationCodeActivationCode: JSON.stringify({ activationCode: item[0].code, }), - }) + }), ) .then((response) => { if (response.data) { diff --git a/assets/admin/components/feed-sources/feed-source-manager.jsx b/assets/admin/components/feed-sources/feed-source-manager.jsx index cbe2ca4d..d263259b 100644 --- a/assets/admin/components/feed-sources/feed-source-manager.jsx +++ b/assets/admin/components/feed-sources/feed-source-manager.jsx @@ -38,11 +38,11 @@ function FeedSourceManager({ // State const [headerText] = useState( - saveMethod === "PUT" ? t("edit-feed-source") : t("create-new-feed-source") + saveMethod === "PUT" ? t("edit-feed-source") : t("create-new-feed-source"), ); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-feed-source") + t("loading-messages.loading-feed-source"), ); const [submitting, setSubmitting] = useState(false); @@ -171,7 +171,7 @@ function FeedSourceManager({ if (loadingError) { displayError( t("error-messages.load-feed-source-error", { id }), - loadingError + loadingError, ); } }, [loadingError]); diff --git a/assets/admin/components/feed-sources/feed-sources-columns.jsx b/assets/admin/components/feed-sources/feed-sources-columns.jsx index a4710994..cc39082d 100644 --- a/assets/admin/components/feed-sources/feed-sources-columns.jsx +++ b/assets/admin/components/feed-sources/feed-sources-columns.jsx @@ -33,7 +33,7 @@ function getFeedSourcesColumns({ apiCall, infoModalRedirect, infoModalTitle }) { tenants?.length === 0 || !tenants.find( (tenant) => - tenant.tenantKey === context.selectedTenant.get.tenantKey + tenant.tenantKey === context.selectedTenant.get.tenantKey, ) ); }, diff --git a/assets/admin/components/feed-sources/feed-sources-list.jsx b/assets/admin/components/feed-sources/feed-sources-list.jsx index 6f9c0ea1..57a1a46a 100644 --- a/assets/admin/components/feed-sources/feed-sources-list.jsx +++ b/assets/admin/components/feed-sources/feed-sources-list.jsx @@ -31,7 +31,7 @@ function FeedSourcesList() { const [listData, setListData] = useState(); const [isDeleting, setIsDeleting] = useState(false); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-feed-sources") + t("loading-messages.loading-feed-sources"), ); // Delete call @@ -123,7 +123,7 @@ function FeedSourcesList() { if (feedSourcesGetError) { displayError( t("error-messages.feed-sources-load-error"), - feedSourcesGetError + feedSourcesGetError, ); } }, [feedSourcesGetError]); diff --git a/assets/admin/components/feed-sources/templates/calendar-api-feed-type.jsx b/assets/admin/components/feed-sources/templates/calendar-api-feed-type.jsx index cda578bf..bedeb361 100644 --- a/assets/admin/components/feed-sources/templates/calendar-api-feed-type.jsx +++ b/assets/admin/components/feed-sources/templates/calendar-api-feed-type.jsx @@ -16,8 +16,8 @@ const CalendarApiFeedType = ({ useEffect(() => { if (feedSourceId && feedSourceId !== "") { - const endpoint = "/" + feedSourceId + "/config/locations"; - setOptionsEndpoint(endpoint); + const endpoint = "/" + feedSourceId + "/config/locations"; + setOptionsEndpoint(endpoint); } }, [feedSourceId]); diff --git a/assets/admin/components/feed-sources/templates/colibo-feed-type.jsx b/assets/admin/components/feed-sources/templates/colibo-feed-type.jsx index e1053ceb..20a4d36e 100644 --- a/assets/admin/components/feed-sources/templates/colibo-feed-type.jsx +++ b/assets/admin/components/feed-sources/templates/colibo-feed-type.jsx @@ -18,7 +18,7 @@ const ColiboFeedType = ({ useEffect(() => { if (feedSourceId && feedSourceId !== "") { - const endpoint = '/' + feedSourceId + "/config/recipients"; + const endpoint = "/" + feedSourceId + "/config/recipients"; setOptionsEndpoint(endpoint); } }, [feedSourceId]); diff --git a/assets/admin/components/groups/group-edit.jsx b/assets/admin/components/groups/group-edit.jsx index b1ba321f..d1d649c2 100644 --- a/assets/admin/components/groups/group-edit.jsx +++ b/assets/admin/components/groups/group-edit.jsx @@ -23,7 +23,7 @@ function GroupEdit() { const [formStateObject, setFormStateObject] = useState(); const [savingGroup, setSavingGroup] = useState(false); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-group") + t("loading-messages.loading-group"), ); const { id } = useParams(); const [PutV2ScreenGroup, { error: saveError, isSuccess: isSaveSuccess }] = @@ -68,7 +68,7 @@ function GroupEdit() { ? loadError.error : loadError.data["hydra:description"], id, - }) + }), ); } }, [loadError]); diff --git a/assets/admin/components/groups/groups-list.jsx b/assets/admin/components/groups/groups-list.jsx index a3c9448e..c3bddc53 100644 --- a/assets/admin/components/groups/groups-list.jsx +++ b/assets/admin/components/groups/groups-list.jsx @@ -37,7 +37,7 @@ function GroupsList() { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-groups") + t("loading-messages.loading-groups"), ); // Delete call diff --git a/assets/admin/components/media/media-create.jsx b/assets/admin/components/media/media-create.jsx index 488999a0..0c5e7247 100644 --- a/assets/admin/components/media/media-create.jsx +++ b/assets/admin/components/media/media-create.jsx @@ -72,7 +72,7 @@ function MediaCreate() { setLoadingMessage( t("loading-messages.saving-media", { title: element.title || t("unamed"), - }) + }), ); const formData = new FormData(); formData.append("file", element.file); diff --git a/assets/admin/components/media/media-list.jsx b/assets/admin/components/media/media-list.jsx index e4cfaced..2e097338 100644 --- a/assets/admin/components/media/media-list.jsx +++ b/assets/admin/components/media/media-list.jsx @@ -54,10 +54,10 @@ function MediaList({ fromModal = false, multiple = true }) { const [media, setMedia] = useState([]); const [page, setPage] = useState(parseInt(pageParams || 1, 10)); const [searchText, setSearchText] = useState( - searchParams === null ? "" : searchParams + searchParams === null ? "" : searchParams, ); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-media") + t("loading-messages.loading-media"), ); // Delete method diff --git a/assets/admin/components/navigation/logo.jsx b/assets/admin/components/navigation/logo.jsx index 5f1c0bc4..f670f0ea 100644 --- a/assets/admin/components/navigation/logo.jsx +++ b/assets/admin/components/navigation/logo.jsx @@ -4,7 +4,7 @@ import DisplayLogo from "./logo.svg"; const Logo = () => { return (
- +
); }; diff --git a/assets/admin/components/navigation/nav-items/restricted-nav-route.jsx b/assets/admin/components/navigation/nav-items/restricted-nav-route.jsx index 192cca75..25618910 100644 --- a/assets/admin/components/navigation/nav-items/restricted-nav-route.jsx +++ b/assets/admin/components/navigation/nav-items/restricted-nav-route.jsx @@ -14,7 +14,7 @@ function RestrictedNavRoute({ children, roles }) { // If the user has a role with access to children. const userHasRequiredRole = context.selectedTenant.get?.roles.find((value) => - roles.includes(value) + roles.includes(value), ); if (!userHasRequiredRole) { diff --git a/assets/admin/components/navigation/nav-items/tenant-selector.jsx b/assets/admin/components/navigation/nav-items/tenant-selector.jsx index 7035a0ba..bac865d6 100644 --- a/assets/admin/components/navigation/nav-items/tenant-selector.jsx +++ b/assets/admin/components/navigation/nav-items/tenant-selector.jsx @@ -28,7 +28,7 @@ function TenantSelector() { setSelectedTenant(newTenant); localStorage.setItem( localStorageKeys.SELECTED_TENANT, - JSON.stringify(newTenant) + JSON.stringify(newTenant), ); } diff --git a/assets/admin/components/playlist/playlist-campaign-form.jsx b/assets/admin/components/playlist/playlist-campaign-form.jsx index 5226113e..cd4fe3be 100644 --- a/assets/admin/components/playlist/playlist-campaign-form.jsx +++ b/assets/admin/components/playlist/playlist-campaign-form.jsx @@ -64,7 +64,7 @@ function PlaylistCampaignForm({ }, ]; const [previewOrientation, setPreviewOrientation] = useState( - previewOrientationOptions[0].value + previewOrientationOptions[0].value, ); const navigate = useNavigate(); const [publishedFromError, setPublishedFromError] = useState(false); diff --git a/assets/admin/components/playlist/playlist-campaign-list.jsx b/assets/admin/components/playlist/playlist-campaign-list.jsx index a9611b0a..85264ede 100644 --- a/assets/admin/components/playlist/playlist-campaign-list.jsx +++ b/assets/admin/components/playlist/playlist-campaign-list.jsx @@ -43,7 +43,7 @@ function PlaylistCampaignList({ location }) { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t(`${location}.loading-messages.loading`) + t(`${location}.loading-messages.loading`), ); // Delete call @@ -135,7 +135,7 @@ function PlaylistCampaignList({ location }) { if (playlistsGetError) { displayError( t(`${location}.error-messages.load-error`), - playlistsGetError + playlistsGetError, ); } }, [playlistsGetError]); diff --git a/assets/admin/components/playlist/playlist-campaign-manager.jsx b/assets/admin/components/playlist/playlist-campaign-manager.jsx index 7b838fff..599e2e11 100644 --- a/assets/admin/components/playlist/playlist-campaign-manager.jsx +++ b/assets/admin/components/playlist/playlist-campaign-manager.jsx @@ -79,12 +79,12 @@ function PlaylistCampaignManager({ // Set published to format accepted by bootstrap date component if (localFormStateObject.published.from) { localFormStateObject.published.from = dayjs( - localFormStateObject.published.from + localFormStateObject.published.from, ).format("YYYY-MM-DDTHH:mm"); } if (localFormStateObject.published.to) { localFormStateObject.published.to = dayjs( - localFormStateObject.published.to + localFormStateObject.published.to, ).format("YYYY-MM-DDTHH:mm"); } @@ -119,13 +119,13 @@ function PlaylistCampaignManager({ enhancedApi.endpoints.putV2ScreensByIdCampaigns.initiate({ id: playlistId, body: JSON.stringify(selectedScreens), - }) + }), ) .then((response) => { if (response.error) { displayError( t(`${location}.error-messages.save-screens-error`), - response.error + response.error, ); reject(response.error); } else { @@ -154,13 +154,13 @@ function PlaylistCampaignManager({ enhancedApi.endpoints.putV2ScreenGroupsByIdCampaigns.initiate({ id: playlistId, body: JSON.stringify(selectedScreenGroups), - }) + }), ) .then((response) => { if (response.error) { displayError( t(`${location}.error-messages.save-group-error`), - response.error + response.error, ); reject(response.error); } else { @@ -188,13 +188,13 @@ function PlaylistCampaignManager({ enhancedApi.endpoints.putV2PlaylistsByIdSlides.initiate({ id: playlistId, body: JSON.stringify(selectedSlides), - }) + }), ) .then((response) => { if (response.error) { displayError( t(`${location}.error-messages.save-slides-error`), - response.error + response.error, ); reject(response.error); } else { diff --git a/assets/admin/components/playlist/playlist-gantt-chart.jsx b/assets/admin/components/playlist/playlist-gantt-chart.jsx index 08884dea..74bfaa66 100644 --- a/assets/admin/components/playlist/playlist-gantt-chart.jsx +++ b/assets/admin/components/playlist/playlist-gantt-chart.jsx @@ -17,7 +17,7 @@ function PlaylistGanttChart({ slides }) { /** Get show from local storage */ useEffect(() => { const localStorageShow = localStorage.getItem( - localStorageKeys.VIEW_GANT_PLAYLIST + localStorageKeys.VIEW_GANT_PLAYLIST, ); setShowGantt(localStorageShow === "true"); }, []); @@ -31,7 +31,7 @@ function PlaylistGanttChart({ slides }) { const inAYear = new Date( today.getFullYear() + 1, today.getMonth(), - today.getDate() + today.getDate(), ); setDataForGantChart( slides.map((slide) => { @@ -44,7 +44,7 @@ function PlaylistGanttChart({ slides }) { stroke: "black", title: slide.title, }; - }) + }), ); } }, [slides]); diff --git a/assets/admin/components/playlist/playlists-columns.jsx b/assets/admin/components/playlist/playlists-columns.jsx index d09babdb..8bb28ae0 100644 --- a/assets/admin/components/playlist/playlists-columns.jsx +++ b/assets/admin/components/playlist/playlists-columns.jsx @@ -37,7 +37,7 @@ function getPlaylistColumns({ tenants?.length === 0 || !tenants.find( (tenant) => - tenant.tenantKey === context.selectedTenant.get.tenantKey + tenant.tenantKey === context.selectedTenant.get.tenantKey, ) ); }, diff --git a/assets/admin/components/preview/preview.jsx b/assets/admin/components/preview/preview.jsx index fb4c77f9..2c369766 100644 --- a/assets/admin/components/preview/preview.jsx +++ b/assets/admin/components/preview/preview.jsx @@ -31,11 +31,9 @@ function Preview({ urlSearchParams.set("preview-id", id); urlSearchParams.set( "preview-token", - localStorage.getItem(LocalStorageKeys.API_TOKEN) - ); - const tenantEntry = localStorage.getItem( - LocalStorageKeys.SELECTED_TENANT + localStorage.getItem(LocalStorageKeys.API_TOKEN), ); + const tenantEntry = localStorage.getItem(LocalStorageKeys.SELECTED_TENANT); urlSearchParams.set("preview-tenant", JSON.parse(tenantEntry).tenantKey); setPreviewClientUrl(`/client?${urlSearchParams}`); diff --git a/assets/admin/components/restricted-route.jsx b/assets/admin/components/restricted-route.jsx index 970d1868..c4a6efc0 100644 --- a/assets/admin/components/restricted-route.jsx +++ b/assets/admin/components/restricted-route.jsx @@ -15,7 +15,7 @@ function RestrictedRoute({ children, roles }) { // If the user has a role with access to children. const userHasRequiredRole = context.selectedTenant.get?.roles.find((value) => - roles.includes(value) + roles.includes(value), ); if (context.authenticated.get && !userHasRequiredRole) { return ; diff --git a/assets/admin/components/screen/screen-form.jsx b/assets/admin/components/screen/screen-form.jsx index 6c565c33..2ee2c616 100644 --- a/assets/admin/components/screen/screen-form.jsx +++ b/assets/admin/components/screen/screen-form.jsx @@ -80,7 +80,7 @@ function ScreenForm({ }, ]; const [previewOrientation, setPreviewOrientation] = useState( - previewOrientationOptions[0].value + previewOrientationOptions[0].value, ); /** @@ -116,7 +116,7 @@ function ScreenForm({ useEffect(() => { if (layoutOptions) { const localSelectedLayout = layoutOptions.find( - (layout) => layout["@id"] === screen.layout + (layout) => layout["@id"] === screen.layout, ); if (localSelectedLayout) { setSelectedLayout(localSelectedLayout); diff --git a/assets/admin/components/screen/screen-list.jsx b/assets/admin/components/screen/screen-list.jsx index 4c7095bb..cf5dad6d 100644 --- a/assets/admin/components/screen/screen-list.jsx +++ b/assets/admin/components/screen/screen-list.jsx @@ -41,7 +41,7 @@ function ScreenList() { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-screens") + t("loading-messages.loading-screens"), ); const [showScreenStatus, setShowScreenStatus] = useState(false); diff --git a/assets/admin/components/screen/screen-manager.jsx b/assets/admin/components/screen/screen-manager.jsx index 473672f8..273344eb 100644 --- a/assets/admin/components/screen/screen-manager.jsx +++ b/assets/admin/components/screen/screen-manager.jsx @@ -74,7 +74,7 @@ function ScreenManager({ if (saveErrorPut || saveErrorPost) { displayError( t("error-messages.save-screen-error"), - saveErrorPut || saveErrorPost + saveErrorPut || saveErrorPost, ); setSavingScreen(false); } @@ -107,13 +107,13 @@ function ScreenManager({ if (localFormStateObject.orientation) { localFormStateObject.orientation = orientationOptions.filter( (orientation) => - orientation["@id"] === localFormStateObject.orientation + orientation["@id"] === localFormStateObject.orientation, ); } if (localFormStateObject.resolution) { localFormStateObject.resolution = resolutionOptions.filter( - (resolution) => resolution["@id"] === localFormStateObject.resolution + (resolution) => resolution["@id"] === localFormStateObject.resolution, ); } @@ -197,7 +197,7 @@ function ScreenManager({ returnArray.push({ playlists: [], regionId: idFromUrl(regionId), - }) + }), ); } return returnArray; diff --git a/assets/admin/components/screen/screen-status.jsx b/assets/admin/components/screen/screen-status.jsx index 6650534a..cfd553b1 100644 --- a/assets/admin/components/screen/screen-status.jsx +++ b/assets/admin/components/screen/screen-status.jsx @@ -47,7 +47,7 @@ function ScreenStatus({ screen, handleInput = () => {}, mode = "default" }) { screenBindObject: JSON.stringify({ bindKey, }), - }) + }), ).then((response) => { if (response.error) { const err = response.error; @@ -55,7 +55,7 @@ function ScreenStatus({ screen, handleInput = () => {}, mode = "default" }) { t("error-messages.error-binding", { status: err.status, }), - err + err, ); } else { // Set screenUser to true, to indicate it has been set. @@ -72,7 +72,7 @@ function ScreenStatus({ screen, handleInput = () => {}, mode = "default" }) { dispatch( enhancedApi.endpoints.postScreenUnbind.initiate({ id: idFromUrl(screen["@id"]), - }) + }), ).then((response) => { if (response.error) { const err = response.error; @@ -80,7 +80,7 @@ function ScreenStatus({ screen, handleInput = () => {}, mode = "default" }) { t("error-messages.error-unbinding", { status: err.status, }), - err + err, ); } else { // Set screenUser and status to null, to indicate it has been removed. @@ -253,7 +253,7 @@ function ScreenStatus({ screen, handleInput = () => {}, mode = "default" }) {
  • {t("latest-request")}:{" "} {dayjs(status.latestRequestDateTime).format( - "D/M YYYY HH:mm" + "D/M YYYY HH:mm", )}
  • )} @@ -272,14 +272,14 @@ function ScreenStatus({ screen, handleInput = () => {}, mode = "default" }) {
  • {t("release-timestamp")}:{" "} {dayjs(status.releaseTimestamp * 1000).format( - "D/M YYYY HH:mm" + "D/M YYYY HH:mm", )} {notRunningLatestRelease && ( <> {" "}({t("newest")}:{" "} {clientRelease?.releaseTimestamp && dayjs(clientRelease?.releaseTimestamp * 1000).format( - "D/M YYYY HH:mm" + "D/M YYYY HH:mm", )} ) diff --git a/assets/admin/components/screen/util/campaign-icon.jsx b/assets/admin/components/screen/util/campaign-icon.jsx index 049148b7..752eaafb 100644 --- a/assets/admin/components/screen/util/campaign-icon.jsx +++ b/assets/admin/components/screen/util/campaign-icon.jsx @@ -28,7 +28,7 @@ function CampaignIcon({ id, delay = 1000 }) { const { data: campaigns, isLoading } = useGetV2ScreensByIdCampaignsQuery( { id }, - { skip: !getData } + { skip: !getData }, ); const { data: groups, isLoading: isLoadingScreenGroups } = useGetV2ScreensByIdScreenGroupsQuery({ id }, { skip: !getData }); @@ -36,7 +36,7 @@ function CampaignIcon({ id, delay = 1000 }) { useEffect(() => { if (campaigns) { setAllCampaigns( - campaigns["hydra:member"].map(({ campaign }) => campaign) + campaigns["hydra:member"].map(({ campaign }) => campaign), ); setScreenCampaignsChecked(true); } @@ -48,12 +48,12 @@ function CampaignIcon({ id, delay = 1000 }) { dispatch( enhancedApi.endpoints.getV2ScreenGroupsByIdCampaigns.initiate({ id: idFromUrl(group["@id"]), - }) + }), ).then((result) => { let allCampaignsCopy = [...allCampaigns]; if (allCampaignsCopy.length > 0 && result.data) { allCampaignsCopy = allCampaignsCopy.concat( - result.data["hydra:member"].map(({ campaign }) => campaign) + result.data["hydra:member"].map(({ campaign }) => campaign), ); } setAllCampaigns(allCampaignsCopy); diff --git a/assets/admin/components/screen/util/grid-generation-and-select.jsx b/assets/admin/components/screen/util/grid-generation-and-select.jsx index 5b4a8de3..4c5e2aea 100644 --- a/assets/admin/components/screen/util/grid-generation-and-select.jsx +++ b/assets/admin/components/screen/util/grid-generation-and-select.jsx @@ -1,6 +1,9 @@ import { useState, useEffect } from "react"; import { Tabs, Tab, Alert } from "react-bootstrap"; -import { createGridArea, createGrid } from "../../../../shared/grid-generator/grid-generator"; +import { + createGridArea, + createGrid, +} from "../../../../shared/grid-generator/grid-generator"; import { useTranslation } from "react-i18next"; import { useDispatch } from "react-redux"; import idFromUrl from "../../util/helpers/id-from-url"; @@ -83,8 +86,8 @@ function GridGenerationAndSelect({ self.findIndex( (secondPlaylist) => secondPlaylist["@id"] === playlist["@id"] && - secondPlaylist.region === playlist.region - ) + secondPlaylist.region === playlist.region, + ), ); return localSelectedPlaylists; @@ -96,13 +99,15 @@ function GridGenerationAndSelect({ regions.forEach(({ "@id": id }) => { promises.push( dispatch( - enhancedApi.endpoints.getV2ScreensByIdRegionsAndRegionIdPlaylists.initiate({ - id: screenId, - regionId: idFromUrl(id), - page: 1, - itemsPerPage: 50, - }) - ) + enhancedApi.endpoints.getV2ScreensByIdRegionsAndRegionIdPlaylists.initiate( + { + id: screenId, + regionId: idFromUrl(id), + page: 1, + itemsPerPage: 50, + }, + ), + ), ); }); @@ -123,7 +128,7 @@ function GridGenerationAndSelect({ region: regionId, })), ]; - } + }, ); playlists = playlists.sort((a, b) => a.weight - b.weight); setSelectedPlaylists(playlists); @@ -159,7 +164,7 @@ function GridGenerationAndSelect({ const indexOfItemToRemove = selectedPlaylists.findIndex( ({ "@id": id, region }) => { return region === inputRegion && id === inputPlaylist; - } + }, ); const selectedPlaylistsCopy = [...selectedPlaylists]; selectedPlaylistsCopy.splice(indexOfItemToRemove, 1); @@ -212,7 +217,7 @@ function GridGenerationAndSelect({ screenId={screenId} regionId={idFromUrl(data["@id"])} selectedPlaylists={selectedPlaylists.filter( - ({ region }) => region === idFromUrl(data["@id"]) + ({ region }) => region === idFromUrl(data["@id"]), )} /> {data?.type === "touch-buttons" && ( diff --git a/assets/admin/components/screen/util/screen-gantt-chart.jsx b/assets/admin/components/screen/util/screen-gantt-chart.jsx index 140aa18d..a7b90b2b 100644 --- a/assets/admin/components/screen/util/screen-gantt-chart.jsx +++ b/assets/admin/components/screen/util/screen-gantt-chart.jsx @@ -21,7 +21,7 @@ function ScreenGanttChart({ playlists, id }) { /** Get show from local storage */ useEffect(() => { const localStorageShow = localStorage.getItem( - localStorageKeys.VIEW_GANT_SCREEN + localStorageKeys.VIEW_GANT_SCREEN, ); setShowGantt(localStorageShow === "true"); }, []); @@ -41,7 +41,7 @@ function ScreenGanttChart({ playlists, id }) { const redirectPossible = tenants?.length === 0 || !tenants.find( - (tenant) => tenant.tenantKey === context.selectedTenant.get.tenantKey + (tenant) => tenant.tenantKey === context.selectedTenant.get.tenantKey, ); // If the playlist has scheduling, a playlist per scheduling will @@ -51,7 +51,7 @@ function ScreenGanttChart({ playlists, id }) { // Get rrule dates in an array // From today, to in a year - which is also the upper boundary of the gantt chart const occurrences = RRule.fromString( - rrule.replace("\\n", "\n") + rrule.replace("\\n", "\n"), ).between(new Date(), inAYear); // Map published and add to data structure @@ -60,7 +60,7 @@ function ScreenGanttChart({ playlists, id }) { // End date is start date plus duration, as rrule const endDateTime = new Date(occurrence).setSeconds( - startDateTime.getSeconds() + duration + startDateTime.getSeconds() + duration, ); const playlistWithPublished = { ...playlist }; diff --git a/assets/admin/components/slide/content/contacts/contacts.jsx b/assets/admin/components/slide/content/contacts/contacts.jsx index d114e847..df46a276 100644 --- a/assets/admin/components/slide/content/contacts/contacts.jsx +++ b/assets/admin/components/slide/content/contacts/contacts.jsx @@ -48,7 +48,7 @@ function Contacts({ const updateContact = (changedContact) => { const newContacts = [...contacts]; const findIndex = newContacts.findIndex( - ({ id }) => id === changedContact.id + ({ id }) => id === changedContact.id, ); newContacts[findIndex] = changedContact; onChange({ target: { id: name, value: newContacts } }); diff --git a/assets/admin/components/slide/content/feed-selector.jsx b/assets/admin/components/slide/content/feed-selector.jsx index 9483951e..f6eeaaa3 100644 --- a/assets/admin/components/slide/content/feed-selector.jsx +++ b/assets/admin/components/slide/content/feed-selector.jsx @@ -64,7 +64,7 @@ function FeedSelector({ key: source["@id"], id: source["@id"], }; - }) + }), ); } }, [feedSourcesData]); @@ -78,7 +78,7 @@ function FeedSelector({ dispatch( enhancedApi.endpoints.getV2FeedSourcesById.initiate({ id: idFromUrl(value.feedSource), - }) + }), ) .then((response) => { setFeedSourceData(response.data); diff --git a/assets/admin/components/slide/content/file-dropzone.jsx b/assets/admin/components/slide/content/file-dropzone.jsx index 1d427ce2..ca22bb38 100644 --- a/assets/admin/components/slide/content/file-dropzone.jsx +++ b/assets/admin/components/slide/content/file-dropzone.jsx @@ -21,7 +21,7 @@ function FileDropzone({ onFilesAdded, acceptedMimetypes = null }) { return { code: "file-too-large", message: `${file.name} (${Math.floor( - file.size / 1000000 + file.size / 1000000, )} MB) ${largerThanText} (${allowedSize / 1000000} MB)`, }; } diff --git a/assets/admin/components/slide/content/multiselect-from-endpoint.jsx b/assets/admin/components/slide/content/multiselect-from-endpoint.jsx index fffbf1d1..bc86da59 100644 --- a/assets/admin/components/slide/content/multiselect-from-endpoint.jsx +++ b/assets/admin/components/slide/content/multiselect-from-endpoint.jsx @@ -41,7 +41,7 @@ function MultiselectFromEndpoint({ // Attach tenant key . const tenantKey = JSON.parse( - localStorage.getItem(localStorageKeys.SELECTED_TENANT) + localStorage.getItem(localStorageKeys.SELECTED_TENANT), ); if (tenantKey) { @@ -61,11 +61,11 @@ function MultiselectFromEndpoint({ key: element.value, title: element.title, }; - }) + }), ); }) .catch(() => - displayError(t("multiselect-from-endpoint.error-fetching")) + displayError(t("multiselect-from-endpoint.error-fetching")), ); } }, [optionsEndpoint]); diff --git a/assets/admin/components/slide/content/poster/poster-selector-v1.jsx b/assets/admin/components/slide/content/poster/poster-selector-v1.jsx index 2217b4d2..0ab232cc 100644 --- a/assets/admin/components/slide/content/poster/poster-selector-v1.jsx +++ b/assets/admin/components/slide/content/poster/poster-selector-v1.jsx @@ -26,7 +26,7 @@ function PosterSelectorV1({ const { t } = useTranslation("common"); const apiToken = localStorage.getItem(localStorageKeys.API_TOKEN); const tenantKey = JSON.parse( - localStorage.getItem(localStorageKeys.SELECTED_TENANT) + localStorage.getItem(localStorageKeys.SELECTED_TENANT), ); const headers = { @@ -44,23 +44,23 @@ function PosterSelectorV1({ const [singleDisplayOverrides, setSingleDisplayOverrides] = useState(false); const [singleSelectedEvent, setSingleSelectedEvent] = useState( - getValueFromConfiguration("singleSelectedEvent") ?? null + getValueFromConfiguration("singleSelectedEvent") ?? null, ); const [singleSelectedOccurrence, setSingleSelectedOccurrence] = useState( - getValueFromConfiguration("singleSelectedOccurrence") ?? null + getValueFromConfiguration("singleSelectedOccurrence") ?? null, ); const [subscriptionPlaceValue, setSubscriptionPlaceValue] = useState( - getValueFromConfiguration("subscriptionPlaceValue") ?? [] + getValueFromConfiguration("subscriptionPlaceValue") ?? [], ); const [subscriptionOrganizerValue, setSubscriptionOrganizerValue] = useState( - getValueFromConfiguration("subscriptionOrganizerValue") ?? [] + getValueFromConfiguration("subscriptionOrganizerValue") ?? [], ); const [subscriptionTagValue, setSubscriptionTagValue] = useState( - getValueFromConfiguration("subscriptionTagValue") ?? [] + getValueFromConfiguration("subscriptionTagValue") ?? [], ); const [subscriptionNumberValue, setSubscriptionNumberValue] = useState( - getValueFromConfiguration("subscriptionNumberValue") ?? 5 + getValueFromConfiguration("subscriptionNumberValue") ?? 5, ); const [subscriptionEvents, setSubscriptionEvents] = useState(null); @@ -73,7 +73,7 @@ function PosterSelectorV1({ const url = feedSource.admin[0].endpointEntity; const eventId = getValueFromConfiguration("singleSelectedEvent"); const occurrenceId = getValueFromConfiguration( - "singleSelectedOccurrence" + "singleSelectedOccurrence", ); if (eventId !== null) { @@ -326,7 +326,7 @@ function PosterSelectorV1({ return capitalize( dayjs(date) .locale(localeDa) - .format(format ?? "LLLL") + .format(format ?? "LLLL"), ); }; @@ -438,7 +438,7 @@ function PosterSelectorV1({ /> {searchEvent?.occurrences?.length > 0 && formatDate( - searchEvent?.occurrences[0]?.startDate + searchEvent?.occurrences[0]?.startDate, )} {searchEvent?.occurrences?.length > 1 && ( , ... @@ -662,17 +662,17 @@ function PosterSelectorV1({ - ) + ), )} @@ -712,7 +712,7 @@ function PosterSelectorV1({ loadDropdownOptions( inputValue, callback, - "places" + "places", ) } value={subscriptionPlaceValue} @@ -741,7 +741,7 @@ function PosterSelectorV1({ loadDropdownOptions( inputValue, callback, - "organizers" + "organizers", ) } value={subscriptionOrganizerValue} @@ -770,7 +770,7 @@ function PosterSelectorV1({ loadDropdownOptions( inputValue, callback, - "tags" + "tags", ) } value={subscriptionTagValue} @@ -861,10 +861,10 @@ function PosterSelectorV1({ <> {`${formatDate( firstOccurrence.startDate, - "L" + "L", )} - ${formatDate( firstOccurrence.endDate, - "L" + "L", )}`} )} diff --git a/assets/admin/components/slide/content/poster/poster-single-events.jsx b/assets/admin/components/slide/content/poster/poster-single-events.jsx index c487e130..ff478d37 100644 --- a/assets/admin/components/slide/content/poster/poster-single-events.jsx +++ b/assets/admin/components/slide/content/poster/poster-single-events.jsx @@ -50,8 +50,9 @@ function PosterSingleEvents({ events, handleSelectEvent }) { handleSelectEvent( entityId, occurrences.map( - ({ entityId: occurrenceEntityId }) => occurrenceEntityId - ) + ({ entityId: occurrenceEntityId }) => + occurrenceEntityId, + ), ) } > @@ -59,7 +60,7 @@ function PosterSingleEvents({ events, handleSelectEvent }) { - ) + ), )} {events?.length === 0 && ( diff --git a/assets/admin/components/slide/content/poster/poster-single-search.jsx b/assets/admin/components/slide/content/poster/poster-single-search.jsx index 10a1f89e..9633a400 100644 --- a/assets/admin/components/slide/content/poster/poster-single-search.jsx +++ b/assets/admin/components/slide/content/poster/poster-single-search.jsx @@ -34,21 +34,21 @@ function PosterSingleSearch({ useEffect(() => { loadDropdownOptionsPromise(optionsEndpoint, getHeaders(), "", "tags").then( - (r) => setTagOptions(r) + (r) => setTagOptions(r), ); loadDropdownOptionsPromise( optionsEndpoint, getHeaders(), "", - "locations" + "locations", ).then((r) => setLocationOptions(r)); loadDropdownOptionsPromise( optionsEndpoint, getHeaders(), "", - "organizations" + "organizations", ).then((r) => setOrganizationOptions(r)); }, []); diff --git a/assets/admin/components/slide/content/poster/poster-subscription-criteria.jsx b/assets/admin/components/slide/content/poster/poster-subscription-criteria.jsx index c4f109b1..ba388090 100644 --- a/assets/admin/components/slide/content/poster/poster-subscription-criteria.jsx +++ b/assets/admin/components/slide/content/poster/poster-subscription-criteria.jsx @@ -35,21 +35,21 @@ function PosterSubscriptionCriteria({ useEffect(() => { loadDropdownOptionsPromise(optionsEndpoint, getHeaders(), "", "tags").then( - (r) => setTags(r) + (r) => setTags(r), ); loadDropdownOptionsPromise( optionsEndpoint, getHeaders(), "", - "locations" + "locations", ).then((r) => setLocations(r)); loadDropdownOptionsPromise( optionsEndpoint, getHeaders(), "", - "organizations" + "organizations", ).then((r) => setOrganizations(r)); }, []); diff --git a/assets/admin/components/slide/content/poster/poster-subscription.jsx b/assets/admin/components/slide/content/poster/poster-subscription.jsx index 5bd6bc59..5c4ecd55 100644 --- a/assets/admin/components/slide/content/poster/poster-subscription.jsx +++ b/assets/admin/components/slide/content/poster/poster-subscription.jsx @@ -147,7 +147,7 @@ function PosterSubscription({ ); - } + }, )} diff --git a/assets/admin/components/slide/content/station/station-selector.jsx b/assets/admin/components/slide/content/station/station-selector.jsx index cf4e06cd..8b235ed3 100644 --- a/assets/admin/components/slide/content/station/station-selector.jsx +++ b/assets/admin/components/slide/content/station/station-selector.jsx @@ -76,7 +76,7 @@ function StationSelector({ accessId: config.rejseplanenApiKey || "", format: "json", input: searchText, - })}` + })}`, ) .then((response) => response.json()) .then((rpData) => { diff --git a/assets/admin/components/slide/preview/slide-preview.jsx b/assets/admin/components/slide/preview/slide-preview.jsx index 277fd3cf..3f9da413 100644 --- a/assets/admin/components/slide/preview/slide-preview.jsx +++ b/assets/admin/components/slide/preview/slide-preview.jsx @@ -39,7 +39,11 @@ function SlidePreview({ useEffect(() => { if (slide) { // Local slide and local content, to not accidentally mess with the actual content. - const newSlide = { ...slide, templateData, executionId: 'EXE-ID-PREVIEW' }; + const newSlide = { + ...slide, + templateData, + executionId: "EXE-ID-PREVIEW", + }; if (mediaData) { newSlide.mediaData = mediaData; @@ -49,7 +53,7 @@ function SlidePreview({ // Find tempid keys const keys = Object.keys(mediaDataCopy).filter((key) => - key.includes("TEMP") + key.includes("TEMP"), ); // Create "fake" url to file @@ -88,7 +92,8 @@ function SlidePreview({ if (entries.length > 0) { const first = entries[0]; setFontSizeRem( - first.contentRect.width / (orientation === "vertical" ? 1080 : 1920) + first.contentRect.width / + (orientation === "vertical" ? 1080 : 1920), ); } } diff --git a/assets/admin/components/slide/slide-create.jsx b/assets/admin/components/slide/slide-create.jsx index bb5a39d2..a8403756 100644 --- a/assets/admin/components/slide/slide-create.jsx +++ b/assets/admin/components/slide/slide-create.jsx @@ -16,7 +16,7 @@ function SlideCreate() { let themeInfo = null; if (localStorage.getItem(localStorageKeys.THEME)) { const prevSelectedThemes = JSON.parse( - localStorage.getItem(localStorageKeys.THEME) + localStorage.getItem(localStorageKeys.THEME), ); themeInfo = prevSelectedThemes[context.selectedTenant.get.tenantKey] || null; diff --git a/assets/admin/components/slide/slide-form.jsx b/assets/admin/components/slide/slide-form.jsx index 359558e6..b4cd4dcb 100644 --- a/assets/admin/components/slide/slide-form.jsx +++ b/assets/admin/components/slide/slide-form.jsx @@ -80,7 +80,7 @@ function SlideForm({ }, ]; const [previewOrientation, setPreviewOrientation] = useState( - previewOrientationOptions[0].value + previewOrientationOptions[0].value, ); const [previewOverlayVisible, setPreviewOverlayVisible] = useState(false); @@ -158,7 +158,7 @@ function SlideForm({ const newSelectedTemplates = []; if (selectedTemplate) { - const slideConfig = getConfig(selectedTemplate['id']); + const slideConfig = getConfig(selectedTemplate["id"]); setContentFormElements(slideConfig.adminForm ?? []); setDisableLivePreview(slideConfig?.options?.disableLivePreview ?? false); newSelectedTemplates.push(selectedTemplate); @@ -391,7 +391,9 @@ function SlideForm({ } > - {t("preview-in-full-screen")} + + {t("preview-in-full-screen")} + @@ -401,41 +403,41 @@ function SlideForm({ )} {!disableLivePreview && ( - <> - {previewOrientation === "horizontal" && ( -
    - 0 ? selectedTheme[0] : {} - } - orientation={previewOrientation} - /> -
    - )} - {previewOrientation === "vertical" && ( -
    - 0 ? selectedTheme[0] : {} - } - orientation={previewOrientation} - /> -
    - )} - - )} + <> + {previewOrientation === "horizontal" && ( +
    + 0 ? selectedTheme[0] : {} + } + orientation={previewOrientation} + /> +
    + )} + {previewOrientation === "vertical" && ( +
    + 0 ? selectedTheme[0] : {} + } + orientation={previewOrientation} + /> +
    + )} + + )} {previewOverlayVisible && ( <> {config?.enhancedPreview && ( diff --git a/assets/admin/components/slide/slide-manager.jsx b/assets/admin/components/slide/slide-manager.jsx index fbef3b1d..6e0c84fc 100644 --- a/assets/admin/components/slide/slide-manager.jsx +++ b/assets/admin/components/slide/slide-manager.jsx @@ -50,7 +50,7 @@ function SlideManager({ // State const [headerText] = useState( - saveMethod === "PUT" ? t("edit-slide-header") : t("create-slide-header") + saveMethod === "PUT" ? t("edit-slide-header") : t("create-slide-header"), ); const [getTheme, setGetTheme] = useState(true); const [getTemplate, setGetTemplate] = useState(true); @@ -63,7 +63,7 @@ function SlideManager({ const [selectedTheme, setSelectedTheme] = useState(); const [saveWithoutClose, setSaveWithoutClose] = useState(false); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-slide") + t("loading-messages.loading-slide"), ); // Initialize to empty slide object. @@ -218,14 +218,14 @@ function SlideManager({ formStateObject?.templateInfo && Object.prototype.hasOwnProperty.call( formStateObject.templateInfo, - "@id" + "@id", ) && getTemplate ) { dispatch( enhancedApi.endpoints.getV2TemplatesById.initiate({ id: idFromUrl(formStateObject.templateInfo["@id"]), - }) + }), ) .then((result) => { const template = result.data; @@ -242,7 +242,7 @@ function SlideManager({ dispatch( enhancedApi.endpoints.getV2ThemesById.initiate({ id: idFromUrl(formStateObject.theme), - }) + }), ) .then((result) => { // To only get the theme once. @@ -272,7 +272,7 @@ function SlideManager({ dispatch( enhancedApi.endpoints.getV2FeedsByIdData.initiate({ id: idFromUrl(initialState.feed["@id"]), - }) + }), ).then((response) => { setFormStateObject({ ...localFormStateObject, @@ -292,8 +292,10 @@ function SlideManager({ localFormStateObject.media.forEach((media) => { promises.push( dispatch( - enhancedApi.endpoints.getv2MediaById.initiate({ id: idFromUrl(media) }) - ) + enhancedApi.endpoints.getv2MediaById.initiate({ + id: idFromUrl(media), + }), + ), ); }); @@ -312,12 +314,12 @@ function SlideManager({ // Set published to format accepted by bootstrap date component if (localFormStateObject.published.from) { localFormStateObject.published.from = dayjs( - localFormStateObject.published.from + localFormStateObject.published.from, ).format("YYYY-MM-DDTHH:mm"); } if (localFormStateObject.published.to) { localFormStateObject.published.to = dayjs( - localFormStateObject.published.to + localFormStateObject.published.to, ).format("YYYY-MM-DDTHH:mm"); } @@ -452,7 +454,7 @@ function SlideManager({ setPlaylistsToAdd( playlists.map((playlist) => { return { playlist: idFromUrl(playlist) }; - }) + }), ); } @@ -489,21 +491,21 @@ function SlideManager({ if (formStateObject.theme) { const { tenantKey } = context.selectedTenant.get; let previouslySavedTheme = localStorage.getItem( - localStorageKeys.THEME + localStorageKeys.THEME, ); if (previouslySavedTheme) { previouslySavedTheme = JSON.parse(previouslySavedTheme); previouslySavedTheme[tenantKey] = formStateObject.theme; localStorage.setItem( localStorageKeys.THEME, - JSON.stringify(previouslySavedTheme) + JSON.stringify(previouslySavedTheme), ); } else { const themeToSave = {}; themeToSave[tenantKey] = formStateObject.theme; localStorage.setItem( localStorageKeys.THEME, - JSON.stringify(themeToSave) + JSON.stringify(themeToSave), ); } } @@ -562,8 +564,8 @@ function SlideManager({ (mediaId) => mediaId === submittedMedia.tempId ? savedMediaData["@id"] - : mediaId - ) + : mediaId, + ), ); const newMediaData = { ...mediaData }; diff --git a/assets/admin/components/slide/slides-list.jsx b/assets/admin/components/slide/slides-list.jsx index 77cc2ada..231dc637 100644 --- a/assets/admin/components/slide/slides-list.jsx +++ b/assets/admin/components/slide/slides-list.jsx @@ -39,7 +39,7 @@ function SlidesList() { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-slides") + t("loading-messages.loading-slides"), ); // Delete call diff --git a/assets/admin/components/themes/theme-manager.jsx b/assets/admin/components/themes/theme-manager.jsx index 28609c82..1814f133 100644 --- a/assets/admin/components/themes/theme-manager.jsx +++ b/assets/admin/components/themes/theme-manager.jsx @@ -37,11 +37,11 @@ function ThemeManager({ // State const [headerText] = useState( - saveMethod === "PUT" ? t("edit-theme") : t("create-new-theme") + saveMethod === "PUT" ? t("edit-theme") : t("create-new-theme"), ); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-theme") + t("loading-messages.loading-theme"), ); const [saveWithoutClose, setSaveWithoutClose] = useState(false); diff --git a/assets/admin/components/themes/themes-list.jsx b/assets/admin/components/themes/themes-list.jsx index 3065dbe6..78f0ae5b 100644 --- a/assets/admin/components/themes/themes-list.jsx +++ b/assets/admin/components/themes/themes-list.jsx @@ -31,7 +31,7 @@ function ThemesList() { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-themes") + t("loading-messages.loading-themes"), ); const { diff --git a/assets/admin/components/user/login.jsx b/assets/admin/components/user/login.jsx index 06726006..c79dc03c 100644 --- a/assets/admin/components/user/login.jsx +++ b/assets/admin/components/user/login.jsx @@ -1,16 +1,16 @@ -import {React, useEffect, useState, useContext} from "react"; -import {Button, Form, Row} from "react-bootstrap"; -import {useTranslation} from "react-i18next"; -import {useDispatch} from "react-redux"; -import {useLocation} from "react-router-dom"; +import { React, useEffect, useState, useContext } from "react"; +import { Button, Form, Row } from "react-bootstrap"; +import { useTranslation } from "react-i18next"; +import { useDispatch } from "react-redux"; +import { useLocation } from "react-router-dom"; import queryString from "query-string"; import Col from "react-bootstrap/Col"; -import {MultiSelect} from "react-multi-select-component"; +import { MultiSelect } from "react-multi-select-component"; import UserContext from "../../context/user-context"; import FormInput from "../util/forms/form-input"; import { enhancedApi } from "../../../shared/redux/enhanced-api.ts"; import AdminConfigLoader from "../util/admin-config-loader.js"; -import {displayError} from "../util/list/toast-component/display-toast"; +import { displayError } from "../util/list/toast-component/display-toast"; import localStorageKeys from "../util/local-storage-keys"; import LoginSidebar from "../navigation/login-sidebar/login-sidebar"; import OIDCLogin from "./oidc-login"; @@ -23,421 +23,420 @@ import "./login.scss"; * @returns {object} - The component */ function Login() { - // Hooks - const {t} = useTranslation("common", {keyPrefix: "login"}); - const {search} = useLocation(); - const dispatch = useDispatch(); - - // Context - const context = useContext(UserContext); - - // Local state - const [ready, setReady] = useState(false); - const [error, setError] = useState(false); - const [password, setPassword] = useState(""); - const [activationCode, setActivationCode] = useState(""); - const [email, setEmail] = useState(""); - const [loggedIn, setLoggedIn] = useState(false); - const [errorMessage, setErrorMessage] = useState(""); - const [loginMethods, setLoginMethods] = useState([]); - - /** - * Login, both called from oidc login and manuel login. - * - * @param {object} data - Login data - */ - const login = (data) => { - const {user} = data; - const {tenants} = data; - - if (!tenants) { - setError(true); - displayError(t("missing-tenants")); - } + // Hooks + const { t } = useTranslation("common", { keyPrefix: "login" }); + const { search } = useLocation(); + const dispatch = useDispatch(); + + // Context + const context = useContext(UserContext); + + // Local state + const [ready, setReady] = useState(false); + const [error, setError] = useState(false); + const [password, setPassword] = useState(""); + const [activationCode, setActivationCode] = useState(""); + const [email, setEmail] = useState(""); + const [loggedIn, setLoggedIn] = useState(false); + const [errorMessage, setErrorMessage] = useState(""); + const [loginMethods, setLoginMethods] = useState([]); + + /** + * Login, both called from oidc login and manuel login. + * + * @param {object} data - Login data + */ + const login = (data) => { + const { user } = data; + const { tenants } = data; + + if (!tenants) { + setError(true); + displayError(t("missing-tenants")); + } + + // Set data in local storage, to persist login on refresh + localStorage.setItem(localStorageKeys.API_TOKEN, data.token); + localStorage.setItem( + localStorageKeys.API_REFRESH_TOKEN, + data.refresh_token, + ); + localStorage.setItem(localStorageKeys.USER_NAME, user?.fullname); + localStorage.setItem(localStorageKeys.EMAIL, user?.email); + localStorage.setItem(localStorageKeys.TENANTS, JSON.stringify(tenants)); + + context.userName.set(user?.fullname); + context.email.set(user?.email); + context.tenants.set(tenants); + context.userType.set(user?.type); + + // If there are more than one tenant, the user should pick a tenant + if (tenants.length === 1) { + // authenticated, and use the only tenant. + context.authenticated.set(true); + localStorage.setItem( + localStorageKeys.SELECTED_TENANT, + JSON.stringify(tenants[0]), + ); + context.selectedTenant.set(tenants[0]); + } + + setLoggedIn(true); + }; + + /** + * Select tenant function + * + * @param {Array} selected - The multiform returns an array of selected + * values, this is a single select, so it will only have one entry + */ + const onSelectTenant = (selected) => { + const { value } = selected[0]; + + // set selected tenant in context + context.selectedTenant.set( + context.tenants.get.find((tenant) => tenant.tenantKey === value), + ); - // Set data in local storage, to persist login on refresh - localStorage.setItem(localStorageKeys.API_TOKEN, data.token); - localStorage.setItem( - localStorageKeys.API_REFRESH_TOKEN, - data.refresh_token - ); - localStorage.setItem(localStorageKeys.USER_NAME, user?.fullname); - localStorage.setItem(localStorageKeys.EMAIL, user?.email); - localStorage.setItem(localStorageKeys.TENANTS, JSON.stringify(tenants)); - - context.userName.set(user?.fullname); - context.email.set(user?.email); - context.tenants.set(tenants); - context.userType.set(user?.type); - - // If there are more than one tenant, the user should pick a tenant - if (tenants.length === 1) { - // authenticated, and use the only tenant. - context.authenticated.set(true); - localStorage.setItem( - localStorageKeys.SELECTED_TENANT, - JSON.stringify(tenants[0]) - ); - context.selectedTenant.set(tenants[0]); - } + // Set authenticated when tenant is selected + context.authenticated.set(true); - setLoggedIn(true); - }; + // Save selected tenant in localstorage + localStorage.setItem( + localStorageKeys.SELECTED_TENANT, + JSON.stringify( + context.tenants.get.find((tenant) => tenant.tenantKey === value), + ), + ); + }; + + const refreshTokenAndLogin = () => { + fetch(`/v2/authentication/token/refresh`, { + mode: "cors", + method: "POST", + headers: { + "Content-Type": "application/json", + }, + credentials: "include", + body: JSON.stringify({ + refresh_token: localStorage.getItem(localStorageKeys.API_REFRESH_TOKEN), + }), + }) + .then((resp) => resp.json()) + .then((data) => { + if (data.code !== 200) { + setErrorMessage(data.message); + } - /** - * Select tenant function - * - * @param {Array} selected - The multiform returns an array of selected - * values, this is a single select, so it will only have one entry - */ - const onSelectTenant = (selected) => { - const {value} = selected[0]; - - // set selected tenant in context - context.selectedTenant.set( - context.tenants.get.find((tenant) => tenant.tenantKey === value) - ); - - // Set authenticated when tenant is selected - context.authenticated.set(true); - - // Save selected tenant in localstorage - localStorage.setItem( - localStorageKeys.SELECTED_TENANT, - JSON.stringify( - context.tenants.get.find((tenant) => tenant.tenantKey === value) - ) - ); - }; + if (data?.token) { + login(data); + } + }) + .catch((err) => { + setError(true); + displayError(t("error-refreshing-code"), err); + }); + }; + + const onActivationCodeSubmit = (e) => { + e.preventDefault(); + e.stopPropagation(); + + dispatch( + enhancedApi.endpoints.postV2UserActivationCodesActivate.initiate({ + userActivationCodeActivationCode: JSON.stringify({ + activationCode, + }), + }), + ) + .then(() => { + refreshTokenAndLogin(); + }) + .catch((err) => { + setError(true); + displayError(t("error-activating-code"), err); + }); + }; + + const onSubmit = (e) => { + e.preventDefault(); + e.stopPropagation(); + + dispatch( + enhancedApi.endpoints.loginCheckPost.initiate({ + body: JSON.stringify({ + providerId: email, + password, + }), + }), + ) + .then((response) => { + if (response?.error) { + if (response?.error?.data?.message === "Invalid credentials.") { + setError(true); + displayError(t("invalid-credentials"), response.error); + } else { + setError(true); + displayError(t("error"), response.error); + } + } + if (response?.data?.token) { + login(response.data); + } + }) + .catch((err) => { + setError(true); + displayError(t("error"), err); + }); + }; + + useEffect(() => { + const loginMethodDefaults = [ + { + type: "oidc", + provider: "internal", + enabled: true, + label: null, + icon: null, + }, + { + type: "oidc", + provider: "external", + enabled: true, + label: null, + icon: null, + }, + { + type: "username-password", + enabled: true, + label: null, + icon: null, + }, + ]; + + AdminConfigLoader.loadConfig().then((loadedConfig) => { + setLoginMethods(loadedConfig.loginMethods ?? loginMethodDefaults); + }); + }, []); + + useEffect(() => { + let isMounted = true; + let code = null; + let state = null; + + if (search) { + const query = queryString.parse(search); + + code = query.code; + state = query.state; + + if (state && code) { + const searchParams = new URLSearchParams({ + state, + code, + }); - const refreshTokenAndLogin = () => { - fetch(`/v2/authentication/token/refresh`, { - mode: "cors", - method: "POST", - headers: { - "Content-Type": "application/json", - }, - credentials: "include", - body: JSON.stringify({ - refresh_token: localStorage.getItem( - localStorageKeys.API_REFRESH_TOKEN - ), - }), + fetch(`/v2/authentication/oidc/token?${searchParams}`, { + mode: "cors", + credentials: "include", }) - .then((resp) => resp.json()) - .then((data) => { - if (data.code !== 200) { - setErrorMessage(data.message); - } - - if (data?.token) { - login(data); - } - }) - .catch((err) => { - setError(true); - displayError(t("error-refreshing-code"), err); - }); - }; - - const onActivationCodeSubmit = (e) => { - e.preventDefault(); - e.stopPropagation(); - - dispatch( - enhancedApi.endpoints.postV2UserActivationCodesActivate.initiate({ - userActivationCodeActivationCode: JSON.stringify({ - activationCode, - }), - }) - ) - .then(() => { - refreshTokenAndLogin(); - }) - .catch((err) => { - setError(true); - displayError(t("error-activating-code"), err); - }); - }; - - const onSubmit = (e) => { - e.preventDefault(); - e.stopPropagation(); - - dispatch( - enhancedApi.endpoints.loginCheckPost.initiate({ - body: JSON.stringify({ - providerId: email, - password, - }), - }) - ) - .then((response) => { - if (response?.error) { - if (response?.error?.data?.message === "Invalid credentials.") { - setError(true); - displayError(t("invalid-credentials"), response.error); - } else { - setError(true); - displayError(t("error"), response.error); - } - } - if (response?.data?.token) { - login(response.data); - } - }) - .catch((err) => { - setError(true); - displayError(t("error"), err); - }); - }; + .then((resp) => resp.json()) + .then((data) => { + if (data.code !== 200) { + setErrorMessage(data.message); + } - useEffect(() => { - const loginMethodDefaults = [ - { - type: "oidc", - provider: "internal", - enabled: true, - label: null, - icon: null, - }, - { - type: "oidc", - provider: "external", - enabled: true, - label: null, - icon: null, - }, - { - type: "username-password", - enabled: true, - label: null, - icon: null, - }, - ]; - - AdminConfigLoader.loadConfig().then((loadedConfig) => { - setLoginMethods( - loadedConfig.loginMethods ?? loginMethodDefaults - ); - }); - }, []); - - useEffect(() => { - let isMounted = true; - let code = null; - let state = null; - - if (search) { - const query = queryString.parse(search); - - code = query.code; - state = query.state; - - if (state && code) { - const searchParams = new URLSearchParams({ - state, - code, - }); - - fetch(`/v2/authentication/oidc/token?${searchParams}`, { - mode: "cors", - credentials: "include", - }) - .then((resp) => resp.json()) - .then((data) => { - if (data.code !== 200) { - setErrorMessage(data.message); - } - - if (isMounted) { - if (data?.token) { - login(data); - } - } - }) - .finally(() => { - setReady(true); - }); - } else { - setReady(true); + if (isMounted) { + if (data?.token) { + login(data); + } } - } else { + }) + .finally(() => { setReady(true); - } - - return () => { - isMounted = false; - }; - }, [search]); - - const oidcLogins = loginMethods.filter( - (loginMethod) => loginMethod.enabled && loginMethod.type === "oidc" - ); - const usernamePasswordLogins = loginMethods.filter( - (loginMethod) => - loginMethod.enabled && loginMethod.type === "username-password" - ); - - return ( - <> - {ready && ( -
    -
    - - - - - - -
    - {errorMessage && errorMessage !== "" && ( -
    - {errorMessage} -
    - )} - - {loggedIn && - !context.selectedTenant.get && - (context.tenants.get.length ?? 0) === 0 && - context.userType.get === "OIDC_EXTERNAL" && ( - <> -
    - setActivationCode(ev.target.value)} - value={activationCode} - name="activationCode" - label={t("activation-code")} - required - /> - - - - - )} - - {loggedIn && - !context.selectedTenant.get && - (context.tenants.get.length ?? 0) > 1 && ( - <> -

    {t("logged-in-select-tenant")}

    - -
    - - {t("select-tenant-label")} - - - { - return { - label: item.title, - value: item.tenantKey, - }; - }) || [] - } - hasSelectAll={false} - onChange={onSelectTenant} - className="single-select" - labelledBy="tenant" - /> - {t("tenant-help-text")} -
    - - )} - - {!loggedIn && ( - <> -

    {t("login-header")}

    - - {oidcLogins.length > 0 && ( - <> -

    - {t("oidc-mit-id-header")} -

    - -
    - {oidcLogins.map((loginMethod) => ( - - ))} -
    - - )} - - {usernamePasswordLogins.length > 0 && - usernamePasswordLogins.map((loginMethod) => ( -
    -

    - {loginMethod.label ?? t("os2-display-user-header")} -

    - -
    - setEmail(ev.target.value)} - value={email} - name="email" - label={t("email")} - required - /> - - setPassword(ev.target.value)} - value={password} - name="password" - label={t("password")} - type="password" - required - /> - - - -
    - ))} - - )} -
    - -
    + }); + } else { + setReady(true); + } + } else { + setReady(true); + } + + return () => { + isMounted = false; + }; + }, [search]); + + const oidcLogins = loginMethods.filter( + (loginMethod) => loginMethod.enabled && loginMethod.type === "oidc", + ); + const usernamePasswordLogins = loginMethods.filter( + (loginMethod) => + loginMethod.enabled && loginMethod.type === "username-password", + ); + + return ( + <> + {ready && ( +
    +
    + + + + + + +
    + {errorMessage && errorMessage !== "" && ( +
    + {errorMessage}
    + )} + + {loggedIn && + !context.selectedTenant.get && + (context.tenants.get.length ?? 0) === 0 && + context.userType.get === "OIDC_EXTERNAL" && ( + <> +
    + + setActivationCode(ev.target.value) + } + value={activationCode} + name="activationCode" + label={t("activation-code")} + required + /> + + + + + )} + + {loggedIn && + !context.selectedTenant.get && + (context.tenants.get.length ?? 0) > 1 && ( + <> +

    {t("logged-in-select-tenant")}

    + +
    + + {t("select-tenant-label")} + + + { + return { + label: item.title, + value: item.tenantKey, + }; + }) || [] + } + hasSelectAll={false} + onChange={onSelectTenant} + className="single-select" + labelledBy="tenant" + /> + {t("tenant-help-text")} +
    + + )} + + {!loggedIn && ( + <> +

    {t("login-header")}

    + + {oidcLogins.length > 0 && ( + <> +

    + {t("oidc-mit-id-header")} +

    + +
    + {oidcLogins.map((loginMethod) => ( + + ))} +
    + + )} + + {usernamePasswordLogins.length > 0 && + usernamePasswordLogins.map((loginMethod) => ( +
    +

    + {loginMethod.label ?? + t("os2-display-user-header")} +

    + +
    + setEmail(ev.target.value)} + value={email} + name="email" + label={t("email")} + required + /> + + setPassword(ev.target.value)} + value={password} + name="password" + label={t("password")} + type="password" + required + /> + + + +
    + ))} + + )}
    - )} - - {!ready && ( - - )} - - ); + +
    +
    +
    + )} + + {!ready && ( + + )} + + ); } export default Login; diff --git a/assets/admin/components/user/oidc-login.jsx b/assets/admin/components/user/oidc-login.jsx index 729a8493..15876fde 100644 --- a/assets/admin/components/user/oidc-login.jsx +++ b/assets/admin/components/user/oidc-login.jsx @@ -41,7 +41,7 @@ function OIDCLogin({ config }) { if (icon !== null) { if (icon === "mitID") { - iconRender = ; + iconRender = ; } else if (icon.indexOf("fa") === 0) { iconRender = ( @@ -55,13 +55,10 @@ function OIDCLogin({ config }) { * "v2/authentication/oidc/urls" session can be active at a time. */ const onClick = () => { - fetch( - `/v2/authentication/oidc/urls?providerKey=${provider}`, - { - mode: "cors", - credentials: "include", - } - ) + fetch(`/v2/authentication/oidc/urls?providerKey=${provider}`, { + mode: "cors", + credentials: "include", + }) .then((resp) => { resp.json().then((data) => { window.location.href = data.authorizationUrl; diff --git a/assets/admin/components/users/users-list.jsx b/assets/admin/components/users/users-list.jsx index f303e128..f3a496a6 100644 --- a/assets/admin/components/users/users-list.jsx +++ b/assets/admin/components/users/users-list.jsx @@ -37,7 +37,7 @@ function UsersList() { const [isDeleting, setIsDeleting] = useState(false); const [listData, setListData] = useState(); const [loadingMessage, setLoadingMessage] = useState( - t("loading-messages.loading-users") + t("loading-messages.loading-users"), ); const [items, setItems] = useState([]); diff --git a/assets/admin/components/util/drag-and-drop-table/drag-and-drop-table.jsx b/assets/admin/components/util/drag-and-drop-table/drag-and-drop-table.jsx index 481d3414..356a381b 100644 --- a/assets/admin/components/util/drag-and-drop-table/drag-and-drop-table.jsx +++ b/assets/admin/components/util/drag-and-drop-table/drag-and-drop-table.jsx @@ -80,7 +80,7 @@ function DragAndDropTable({ const reorderedListOfPlaylists = reorder( data, result.source.index, - result.destination.index + result.destination.index, ); const target = { value: reorderedListOfPlaylists, id: name }; onDropped({ target }); @@ -131,7 +131,7 @@ function DragAndDropTable({ {...providedDraggable.dragHandleProps} style={getItemStyle( providedSnapshot.isDragging, - providedDraggable.draggableProps.style + providedDraggable.draggableProps.style, )} className={data.className ?? ""} > diff --git a/assets/admin/components/util/forms/form-table/form-table.jsx b/assets/admin/components/util/forms/form-table/form-table.jsx index c6acf575..8294c21e 100644 --- a/assets/admin/components/util/forms/form-table/form-table.jsx +++ b/assets/admin/components/util/forms/form-table/form-table.jsx @@ -117,7 +117,7 @@ function FormTable({ name, onChange, formGroupClasses = "", value = [] }) { const removeColumn = (removeId) => { // remove column const columnsCopy = [...columns].filter( - (column) => column.accessor !== removeId + (column) => column.accessor !== removeId, ); setColumns(columnsCopy); @@ -154,7 +154,7 @@ function FormTable({ name, onChange, formGroupClasses = "", value = [] }) { }; } return row; - }) + }), ); }; diff --git a/assets/admin/components/util/forms/multiselect-dropdown/multi-dropdown.jsx b/assets/admin/components/util/forms/multiselect-dropdown/multi-dropdown.jsx index b3145862..52c01268 100644 --- a/assets/admin/components/util/forms/multiselect-dropdown/multi-dropdown.jsx +++ b/assets/admin/components/util/forms/multiselect-dropdown/multi-dropdown.jsx @@ -87,7 +87,7 @@ function MultiSelectComponent({ const optionsWithSelected = removeDuplicatesByKey( [...localMappedOptions, ...localMappedSelected], - "value" + "value", ); setMappedOptions(optionsWithSelected); @@ -110,7 +110,7 @@ function MultiSelectComponent({ return optionsToFilter.filter( ({ label: shadowLabel }) => - shadowLabel && shadowLabel.match(new RegExp(filter, "i")) + shadowLabel && shadowLabel.match(new RegExp(filter, "i")), ); }; @@ -127,16 +127,16 @@ function MultiSelectComponent({ if ("@id" in selectedAndOptions[0]) { selectedOptions = removeDuplicatesByKey( selectedAndOptions.filter((option) => - idsOfSelectedEntries.includes(option["@id"]) + idsOfSelectedEntries.includes(option["@id"]), ), - "@id" + "@id", ); } else { selectedOptions = removeDuplicatesByKey( selectedAndOptions.filter(({ id }) => - idsOfSelectedEntries.includes(id) + idsOfSelectedEntries.includes(id), ), - "id" + "id", ); } diff --git a/assets/admin/components/util/gantt-chart.jsx b/assets/admin/components/util/gantt-chart.jsx index fec3d100..1ad82cf7 100644 --- a/assets/admin/components/util/gantt-chart.jsx +++ b/assets/admin/components/util/gantt-chart.jsx @@ -39,7 +39,7 @@ function GanttChart({ id, data, component }) { dateAxis.max = new Date( d.getFullYear() + 1, d.getMonth(), - d.getDate() + d.getDate(), ).getTime(); dateAxis.dateFormatter.dateFormat = "yyyy-MM-dd"; @@ -55,7 +55,7 @@ function GanttChart({ id, data, component }) { function redirect(ev) { if (ev.target.dataItem.dataContext.redirectPossible) { navigate( - `/${component}/edit/${idFromUrl(ev.target.dataItem.dataContext.id)}` + `/${component}/edit/${idFromUrl(ev.target.dataItem.dataContext.id)}`, ); } } diff --git a/assets/admin/components/util/helpers/form-errors-helper.jsx b/assets/admin/components/util/helpers/form-errors-helper.jsx index 9a9076db..51ad4532 100644 --- a/assets/admin/components/util/helpers/form-errors-helper.jsx +++ b/assets/admin/components/util/helpers/form-errors-helper.jsx @@ -1,4 +1,3 @@ - /** * @param {Array} requiredFields The fields that are required. * @param {object} formStateObject The object to validate. diff --git a/assets/admin/components/util/list/list-button.jsx b/assets/admin/components/util/list/list-button.jsx index fabfa38d..f5a795bf 100644 --- a/assets/admin/components/util/list/list-button.jsx +++ b/assets/admin/components/util/list/list-button.jsx @@ -34,7 +34,7 @@ function ListButton({ page: 1, itemsPerPage: 0, }, - { skip: !getData } + { skip: !getData }, ); } diff --git a/assets/admin/components/util/list/toast-component/display-toast.jsx b/assets/admin/components/util/list/toast-component/display-toast.jsx index 8493df50..ca7dec08 100644 --- a/assets/admin/components/util/list/toast-component/display-toast.jsx +++ b/assets/admin/components/util/list/toast-component/display-toast.jsx @@ -35,7 +35,7 @@ export function displayError(errorString, error) { } const displayText = `${errorString} ${errorText} ${dayjs().format( - "HH:mm:ss" + "HH:mm:ss", )}`; toast.error(displayText, { diff --git a/assets/admin/components/util/multi-and-table/select-groups-table.jsx b/assets/admin/components/util/multi-and-table/select-groups-table.jsx index 21dd0c01..43d60cf0 100644 --- a/assets/admin/components/util/multi-and-table/select-groups-table.jsx +++ b/assets/admin/components/util/multi-and-table/select-groups-table.jsx @@ -46,7 +46,7 @@ function SelectGroupsTable({ page, id, }, - { skip: !id } + { skip: !id }, ); /** Map loaded data. */ @@ -57,7 +57,7 @@ function SelectGroupsTable({ newGroups = alreadySelectedGroups["hydra:member"].map( (localScreenGroup) => { return localScreenGroup[mappingId]; - } + }, ); } setTotalItems(alreadySelectedGroups["hydra:totalItems"]); diff --git a/assets/admin/components/util/multi-and-table/select-playlists-table.jsx b/assets/admin/components/util/multi-and-table/select-playlists-table.jsx index 710cff70..106a86dc 100644 --- a/assets/admin/components/util/multi-and-table/select-playlists-table.jsx +++ b/assets/admin/components/util/multi-and-table/select-playlists-table.jsx @@ -43,7 +43,7 @@ function SelectPlaylistsTable({ handleChange, name, id = "", helpText }) { page, id, }, - { skip: !id } + { skip: !id }, ); /** Map loaded data. */ @@ -53,7 +53,7 @@ function SelectPlaylistsTable({ handleChange, name, id = "", helpText }) { const newPlaylists = alreadySelectedPlaylists["hydra:member"].map( ({ playlist }) => { return playlist; - } + }, ); setSelectedData([...selectedData, ...newPlaylists]); } diff --git a/assets/admin/components/util/multi-and-table/select-screens-table.jsx b/assets/admin/components/util/multi-and-table/select-screens-table.jsx index a12c4010..baddb48f 100644 --- a/assets/admin/components/util/multi-and-table/select-screens-table.jsx +++ b/assets/admin/components/util/multi-and-table/select-screens-table.jsx @@ -39,14 +39,14 @@ function SelectScreensTable({ handleChange, name, campaignId = "" }) { itemsPerPage: 10, page, }, - { skip: !campaignId } + { skip: !campaignId }, ); useEffect(() => { if (alreadySelectedScreens) { setTotalItems(alreadySelectedScreens["hydra:totalItems"]); const newScreens = alreadySelectedScreens["hydra:member"].map( - ({ screen }) => screen + ({ screen }) => screen, ); setSelectedData([...selectedData, ...newScreens]); } diff --git a/assets/admin/components/util/multi-and-table/select-slides-table.jsx b/assets/admin/components/util/multi-and-table/select-slides-table.jsx index 67ea9fed..61d3c2d6 100644 --- a/assets/admin/components/util/multi-and-table/select-slides-table.jsx +++ b/assets/admin/components/util/multi-and-table/select-slides-table.jsx @@ -40,7 +40,7 @@ function SelectSlidesTable({ handleChange, name, slideId = "" }) { itemsPerPage: 30, page, }, - { skip: !slideId } + { skip: !slideId }, ); const sortByStatus = () => { diff --git a/assets/admin/components/util/schedule/schedule.jsx b/assets/admin/components/util/schedule/schedule.jsx index 7ad682d0..2568c3fb 100644 --- a/assets/admin/components/util/schedule/schedule.jsx +++ b/assets/admin/components/util/schedule/schedule.jsx @@ -42,7 +42,7 @@ function Schedule({ schedules, onChange }) { useEffect(() => { const newSchedules = schedules.map((schedule) => - createScheduleFromRRule(schedule.id, schedule.duration, schedule.rrule) + createScheduleFromRRule(schedule.id, schedule.duration, schedule.rrule), ); setLocalSchedules(newSchedules); }, [schedules]); @@ -75,7 +75,7 @@ function Schedule({ schedules, onChange }) { const newLocalSchedules = [...localSchedules]; const index = newLocalSchedules.findIndex( - (schedule) => schedule.id === scheduleId + (schedule) => schedule.id === scheduleId, ); newLocalSchedules[index][targetId] = value; newLocalSchedules[index].rrule = getRruleString(newLocalSchedules[index]); @@ -90,7 +90,7 @@ function Schedule({ schedules, onChange }) { */ const removeSchedule = (scheduleId) => { const newLocalSchedules = [...localSchedules].filter( - (schedule) => schedule.id !== scheduleId + (schedule) => schedule.id !== scheduleId, ); onChange(newLocalSchedules); }; @@ -107,7 +107,7 @@ function Schedule({ schedules, onChange }) { } if (Array.isArray(value)) { return value.map((monthNumber) => - byMonthOptions.find((month) => month.value === monthNumber) + byMonthOptions.find((month) => month.value === monthNumber), ); } return []; @@ -134,9 +134,9 @@ function Schedule({ schedules, onChange }) { date.getMonth(), date.getDate(), date.getHours(), - date.getMinutes() - ) - ) + date.getMinutes(), + ), + ), ); }; @@ -311,8 +311,8 @@ function Schedule({ schedules, onChange }) { label={t("schedule.end")} value={getDateValue( new Date( - schedule.dtstart.getTime() + schedule.duration * 1000 - ) + schedule.dtstart.getTime() + schedule.duration * 1000, + ), )} name="end" onChange={({ target }) => @@ -360,7 +360,7 @@ function Schedule({ schedules, onChange }) { changeSchedule( schedule.id, target.id, - target.value + target.value, ) } value={schedule.freq} @@ -404,7 +404,7 @@ function Schedule({ schedules, onChange }) { } value={getTimeValue( schedule.byhour, - schedule.byminute + schedule.byminute, )} label={t("schedule.bytime")} type="time" @@ -432,8 +432,8 @@ function Schedule({ schedules, onChange }) { ? schedule.byweekday.map((weekdayNumber) => byWeekdayOptions.find( (weekDay) => - weekDay.value === weekdayNumber - ) + weekDay.value === weekdayNumber, + ), ) : [] } @@ -444,7 +444,7 @@ function Schedule({ schedules, onChange }) { clearSelected: t("schedule.clear-selection"), selectAll: t("schedule.selected-all"), selectSomeItems: t( - "schedule.select-some-options" + "schedule.select-some-options", ), }} labelledBy="Select" @@ -452,7 +452,7 @@ function Schedule({ schedules, onChange }) { changeSchedule( schedule.id, "byweekday", - value.map((v) => v.value) + value.map((v) => v.value), ); }} /> @@ -478,14 +478,14 @@ function Schedule({ schedules, onChange }) { clearSelected: t("schedule.clear-selection"), selectAll: t("schedule.selected-all"), selectSomeItems: t( - "schedule.select-some-options" + "schedule.select-some-options", ), }} onChange={(values) => changeSchedule( schedule.id, "bymonth", - values.map((v) => v.value) + values.map((v) => v.value), ) } /> @@ -515,7 +515,7 @@ function Schedule({ schedules, onChange }) { changeSchedule( schedule.id, target.id, - target.value + target.value, ) } name="byweekno" @@ -538,7 +538,7 @@ function Schedule({ schedules, onChange }) { {getNextOccurrences( schedule.rruleObject, schedule.duration, - schedule.count ? Math.min(schedule.count, 5) : 5 + schedule.count ? Math.min(schedule.count, 5) : 5, ).map((occurrence) => (
    {occurrence.text} diff --git a/assets/admin/components/util/select-column-hoc.jsx b/assets/admin/components/util/select-column-hoc.jsx index a46715f9..0714aca4 100644 --- a/assets/admin/components/util/select-column-hoc.jsx +++ b/assets/admin/components/util/select-column-hoc.jsx @@ -46,7 +46,7 @@ function SelectColumnHoc(columns, omitStandardColumns) {
    {!tenants?.find( (tenant) => - tenant.tenantKey === context.selectedTenant.get.tenantKey + tenant.tenantKey === context.selectedTenant.get.tenantKey, ) && }