Skip to content

Commit

Permalink
Merge pull request #430 from JulianKniephoff/fix-build-warnings
Browse files Browse the repository at this point in the history
Fix build warnings
  • Loading branch information
lkiesow committed May 30, 2024
2 parents ddfd555 + 2fce570 commit b77c0c2
Show file tree
Hide file tree
Showing 31 changed files with 352 additions and 328 deletions.
26 changes: 23 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@babel/core": "^7.23.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-syntax-optional-chaining": "^7.8.3",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "^7.23.8",
"@babel/preset-react": "^7.24.1",
"@types/lodash": "^4.14.202",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { initialFormValuesNewThemes } from "../../../../configs/modalConfig";
import { usePageFunctions } from "../../../../hooks/wizardHooks";
import { NewThemeSchema } from "../../../../utils/validate";
import { useAppDispatch } from "../../../../store";
import { Details, postNewTheme } from "../../../../slices/themeSlice";
import { postNewTheme } from "../../../../slices/themeSlice";

/**
* This component manages the pages of the new theme wizard and the submission of values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import RenderDate from "../../../shared/RenderDate";
import RenderMultiField from "../../../shared/wizard/RenderMultiField";
import RenderField from "../../../shared/wizard/RenderField";
import { getUserInformation } from "../../../../selectors/userInfoSelectors";
import { getCurrentLanguageInformation, hasAccess, isJson } from "../../../../utils/utils";
import { hasAccess, isJson } from "../../../../utils/utils";
import { getMetadataCollectionFieldName } from "../../../../utils/resourceUtils";
import { useAppSelector } from "../../../../store";

Expand All @@ -31,8 +31,6 @@ const DetailsMetadataTab: React.FC<{
const { t } = useTranslation();

const user = useAppSelector(state => getUserInformation(state));
// Get info about the current language and its date locale
const currentLanguage = getCurrentLanguageInformation();

// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.
const handleSubmit = (values) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const EventDetailsAssetAttachmentDetails = ({
}
</td>
<td>
{/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
<a
className="fa fa-external-link"
href={attachment.url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const EventDetailsAssetCatalogDetails = ({
}
</td>
<td>
{/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
<a className="fa fa-external-link" href={catalog.url} />
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const EventDetailsAssetPublicationDetails = ({
}
</td>
<td>
{/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
<a
className="fa fa-external-link"
href={publication.url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const EventDetailsAssetsAddAsset = ({
{" "}
{translateOverrideFallback(asset, t)}
<span className="ui-helper-hidden">
{ // eslint-disable-next-line react/jsx-no-comment-textnodes
} ({asset.type} "{asset.flavorType}//
{/* eslint-disable-next-line react/jsx-no-comment-textnodes */}
({asset.type} "{asset.flavorType}//
{asset.flavorSubType}")
</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const EventDetailsPublicationTab = ({
</div>

{publication.enabled ? (
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a className="play" href={publication.url} />
) : (
<span style={styleSpan}>
Expand Down
1 change: 1 addition & 0 deletions src/components/events/partials/modals/StartTaskModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const StartTaskModal = ({
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
formik.validateForm().then();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [page]);

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/events/partials/wizards/NewEventSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ const NewEventSummary = <T extends RequiredFormProps>({
<td>
{asset.translate}
<span className="ui-helper-hidden">
{ // eslint-disable-next-line react/jsx-no-comment-textnodes
} ({asset.type} "{asset.flavorType}//
{/* eslint-disable-next-line react/jsx-no-comment-textnodes */}
({asset.type} "{asset.flavorType}//
{asset.flavorSubType}")
</span>
</td>
Expand Down Expand Up @@ -165,8 +165,8 @@ const NewEventSummary = <T extends RequiredFormProps>({
<td>
{translateOverrideFallback(asset, t, "SHORT")}
<span className="ui-helper-hidden">
{ // eslint-disable-next-line react/jsx-no-comment-textnodes
} ({asset.type} "{asset.flavorType}//
{/* eslint-disable-next-line react/jsx-no-comment-textnodes */}
({asset.type} "{asset.flavorType}//
{asset.flavorSubType}")
</span>
</td>
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/TableFilterProfiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const TableFiltersProfiles = ({
// State for helping saving and editing profiles
const [profileName, setProfileName] = useState("");
const [profileDescription, setProfileDescription] = useState("");
const [currentlyEditing, setCurrentlyEditing] = useState("");
const [, setCurrentlyEditing] = useState("");
const [validName, setValidName] = useState(false);

const { t } = useTranslation();
Expand Down
65 changes: 31 additions & 34 deletions src/components/shared/TableFilters.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createRef, useRef, useState } from "react";
import React, { useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
Expand Down Expand Up @@ -297,41 +297,39 @@ const TableFilters = ({

{/* Show for each selected filter a blue label containing its name and option */}
{filterMap.map((filter, key) => {
if (!!filter.value) {
return (
<span className="ng-multi-value" key={key}>
<span>
{
// Use different representation of name and value depending on type of filter
filter.type === "select" ? (
renderBlueBox(filter)
) : filter.type === "period" ? (
return filter.value && (
<span className="ng-multi-value" key={key}>
<span>
{
// Use different representation of name and value depending on type of filter
filter.type === "select" ? (
renderBlueBox(filter)
) : filter.type === "period" ? (
<span>
<span>
<span>
{t(filter.label).substr(0, 40)}:
{t("dateFormats.date.short", {
date: new Date(filter.value.split("/")[0]),
})}
-
{t("dateFormats.date.short", {
date: new Date(filter.value.split("/")[1]),
})}
</span>
{t(filter.label).substr(0, 40)}:
{t("dateFormats.date.short", {
date: new Date(filter.value.split("/")[0]),
})}
-
{t("dateFormats.date.short", {
date: new Date(filter.value.split("/")[1]),
})}
</span>
) : null
}
</span>
{/* Remove icon in blue area around filter */}
<button
title={t("TABLE_FILTERS.REMOVE")}
onClick={() => removeFilter(filter)}
className="button-like-anchor"
>
<i className="fa fa-times" />
</button>
</span>
) : null
}
</span>
);
}
{/* Remove icon in blue area around filter */}
<button
title={t("TABLE_FILTERS.REMOVE")}
onClick={() => removeFilter(filter)}
className="button-like-anchor"
>
<i className="fa fa-times" />
</button>
</span>
);
})}
</div>

Expand Down Expand Up @@ -517,7 +515,6 @@ const FilterSwitch = ({
// This should never happen
default:
return null;

}
};

Expand Down
11 changes: 3 additions & 8 deletions src/components/shared/TimeSeriesStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ const TimeSeriesStatistics = ({
// @ts-expect-error TS(7031): Binding element 'chartOptions' implicitly has an '... Remove this comment to see the full error message
chartOptions,
}) => {
// Style for date picker
const datePickerStyle = {
border: "1px solid #dedddd",
borderRadius: "4px",
marginLeft: "3px",
marginRight: "5px",
};

// Style for radio buttons
const radioButtonStyle = {
backgroundColor: "whitesmoke",
Expand Down Expand Up @@ -212,6 +204,7 @@ const TimeSeriesStatistics = ({
<div className="statistics-graph">
{/* download link for a statistic file */}
<div className="download">
{/* eslint-disable-next-line jsx-a11y/anchor-has-content */}
<a
className="download-icon"
href={exportUrl}
Expand Down Expand Up @@ -265,6 +258,7 @@ const TimeSeriesStatistics = ({
formik.values.timeMode === "month") && (
/* year/month selection for statistic via previous and next buttons */
<span className="preset">
{/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}
<a
className="navigation prev"
onClick={() =>
Expand All @@ -282,6 +276,7 @@ const TimeSeriesStatistics = ({
formik.values.timeMode
)}
</div>
{/* eslint-disable-next-line jsx-a11y/anchor-has-content, jsx-a11y/anchor-is-valid */}
<a
className="navigation next"
onClick={() =>
Expand Down
76 changes: 36 additions & 40 deletions src/components/shared/wizard/RenderField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,49 +183,45 @@ const EditableDateValue = ({
showCheck,
// @ts-expect-error TS(7031):
handleKeyDown
}) => {
const { t } = useTranslation();

return editMode ? (
<div>
<DateTimePicker
name={field.name}
value={typeof field.value === "string" ? parseISO(field.value) : field.value}
onChange={(value) => setFieldValue(field.name, value)}
onClose={() => setEditMode(false)}
slotProps={{
textField: {
fullWidth: true,
onKeyDown: (event) => {
if (event.key === "Enter") {
handleKeyDown(event, "date")
}
},
onBlur: (event) => {
setEditMode(false)
}) => editMode ? (
<div>
<DateTimePicker
name={field.name}
value={typeof field.value === "string" ? parseISO(field.value) : field.value}
onChange={(value) => setFieldValue(field.name, value)}
onClose={() => setEditMode(false)}
slotProps={{
textField: {
fullWidth: true,
onKeyDown: (event) => {
if (event.key === "Enter") {
handleKeyDown(event, "date")
}
},
onBlur: (event) => {
setEditMode(false)
}
}}
/>
</div>
) : (
<div onClick={() => setEditMode(true)} className="show-edit">
<span className="editable preserve-newlines">
<RenderDate date={text} />
</span>
<div>
<i className="edit fa fa-pencil-square" />
{showCheck && (
<i
className={cn("saved fa fa-check", {
active: initialValues[field.name] !== field.value,
})}
/>
)}
</div>
}
}}
/>
</div>
) : (
<div onClick={() => setEditMode(true)} className="show-edit">
<span className="editable preserve-newlines">
<RenderDate date={text} />
</span>
<div>
<i className="edit fa fa-pencil-square" />
{showCheck && (
<i
className={cn("saved fa fa-check", {
active: initialValues[field.name] !== field.value,
})}
/>
)}
</div>
);
};
</div>
);

// renders editable field for selecting value via dropdown
const EditableSingleSelect = ({
Expand Down
3 changes: 1 addition & 2 deletions src/components/shared/wizard/SelectContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ const SelectContainer = ({

// Formik hook for getting data of specific form field
// DON'T delete field and meta, hook works with indices not variable names
// eslint-disable-next-line no-unused-vars
const [field, meta, helpers] = useField(formikField);
const [field, , helpers] = useField(formikField);

// Search field for filter options/items
const [searchField, setSearchField] = useState("");
Expand Down
1 change: 1 addition & 0 deletions src/components/users/partials/wizard/NewUserWizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const NewUserWizard = ({
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
formik.validateForm();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tab]);

return (
Expand Down
Loading

0 comments on commit b77c0c2

Please sign in to comment.