@@ -244,7 +250,7 @@ class PageTextDisplay extends React.Component {
>
{line.text}
- )
+ ),
)}
diff --git a/src/components/settings/ButtonContainer.js b/src/components/settings/ButtonContainer.js
index 4a5aa80..557d2cb 100644
--- a/src/components/settings/ButtonContainer.js
+++ b/src/components/settings/ButtonContainer.js
@@ -34,10 +34,10 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
});
/** Container for a settings button */
-const ButtonContainer = ({ children, withBorder, paddingPrev, paddingNext }) => {
+function ButtonContainer({ children, withBorder, paddingPrev, paddingNext }) {
const classes = useStyles({ withBorder, paddingPrev, paddingNext });
return
{children}
;
-};
+}
ButtonContainer.propTypes = {
children: PropTypes.node.isRequired,
withBorder: PropTypes.bool,
diff --git a/src/components/settings/ColorInput.js b/src/components/settings/ColorInput.js
index 7de2906..b25104c 100644
--- a/src/components/settings/ColorInput.js
+++ b/src/components/settings/ColorInput.js
@@ -37,7 +37,7 @@ const useStyles = makeStyles({
});
/** Input to select a color */
-const ColorInput = ({ color, onChange, title, autoColors, className }) => {
+function ColorInput({ color, onChange, title, autoColors, className }) {
const classes = useStyles({ color, autoColors });
// We rely on the browser behavior that clicking on an input's label is equivalent
// to clicking the input to show a custom color picker button.
@@ -65,7 +65,7 @@ const ColorInput = ({ color, onChange, title, autoColors, className }) => {
/>
);
-};
+}
ColorInput.propTypes = {
className: PropTypes.string,
color: PropTypes.string.isRequired,
diff --git a/src/components/settings/ColorWidget.js b/src/components/settings/ColorWidget.js
index 392a086..b011271 100644
--- a/src/components/settings/ColorWidget.js
+++ b/src/components/settings/ColorWidget.js
@@ -57,15 +57,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
});
/** Widget to update text and background color */
-const ColorWidget = ({
- textColor,
- bgColor,
- onChange,
- t,
- pageColors,
- useAutoColors,
- containerId,
-}) => {
+function ColorWidget({ textColor, bgColor, onChange, t, pageColors, useAutoColors, containerId }) {
const showResetButton =
!useAutoColors && pageColors && pageColors.some((c) => c && (c.textColor || c.bgColor));
const classes = useStyles({ showResetButton });
@@ -118,7 +110,7 @@ const ColorWidget = ({
/>
);
-};
+}
ColorWidget.propTypes = {
containerId: PropTypes.string.isRequired,
textColor: PropTypes.string.isRequired,
@@ -130,7 +122,7 @@ ColorWidget.propTypes = {
PropTypes.shape({
textColor: PropTypes.string,
bgColor: PropTypes.string,
- })
+ }),
).isRequired,
};
diff --git a/src/components/settings/OpacityWidget.js b/src/components/settings/OpacityWidget.js
index 3e2a3e0..f3bb383 100644
--- a/src/components/settings/OpacityWidget.js
+++ b/src/components/settings/OpacityWidget.js
@@ -33,7 +33,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
});
/** Widget to control the opacity of the displayed text */
-const OpacityWidget = ({ opacity, onChange, t }) => {
+function OpacityWidget({ opacity, onChange, t }) {
const classes = useStyles();
const theme = useTheme();
const isSmallDisplay = useMediaQuery(theme.breakpoints.down('sm'));
@@ -54,7 +54,7 @@ const OpacityWidget = ({ opacity, onChange, t }) => {
/>
);
-};
+}
OpacityWidget.propTypes = {
opacity: PropTypes.number.isRequired,
onChange: PropTypes.func.isRequired,
diff --git a/src/components/settings/OverlaySettings.js b/src/components/settings/OverlaySettings.js
index 6014558..ec634e6 100644
--- a/src/components/settings/OverlaySettings.js
+++ b/src/components/settings/OverlaySettings.js
@@ -46,7 +46,7 @@ const useStyles = makeStyles(({ palette, breakpoints }) => {
});
/** Control text overlay settings */
-const OverlaySettings = ({
+function OverlaySettings({
windowTextOverlayOptions,
imageToolsEnabled,
textsAvailable,
@@ -55,7 +55,7 @@ const OverlaySettings = ({
t,
pageColors,
containerId,
-}) => {
+}) {
const {
enabled,
visible,
@@ -221,7 +221,7 @@ const OverlaySettings = ({
{!isSmallDisplay && toggleButton}
);
-};
+}
OverlaySettings.propTypes = {
containerId: PropTypes.string.isRequired,
@@ -236,7 +236,7 @@ OverlaySettings.propTypes = {
PropTypes.shape({
textColor: PropTypes.string,
bgColor: PropTypes.string,
- })
+ }),
).isRequired,
};
diff --git a/src/lib/color.js b/src/lib/color.js
index 7e09e61..c08418c 100644
--- a/src/lib/color.js
+++ b/src/lib/color.js
@@ -35,7 +35,7 @@ function luminance([r, g, b]) {
if (vSrgb <= 0.03928) {
return vSrgb / 12.92;
}
- return Math.pow((vSrgb + 0.055) / 1.055, 2.4);
+ return ((vSrgb + 0.055) / 1.055) ** 2.4;
});
return colors[0] * 0.2126 + colors[1] * 0.7152 + colors[2] * 0.0722;
}
diff --git a/src/lib/ocrFormats.js b/src/lib/ocrFormats.js
index 9a0eba4..f61f886 100644
--- a/src/lib/ocrFormats.js
+++ b/src/lib/ocrFormats.js
@@ -80,7 +80,7 @@ export function parseHocr(hocrText, referenceSize) {
const scaledHeight = Math.round(scaleFactorX * pageSize[3]);
if (scaledWidth !== referenceSize.width || scaledHeight !== referenceSize.height) {
console.warn(
- `Differing scale factors for x and y axis: x=${scaleFactorX}, y=${scaleFactorY}`
+ `Differing scale factors for x and y axis: x=${scaleFactorX}, y=${scaleFactorY}`,
);
}
scaleFactor = scaleFactorX;
@@ -350,7 +350,7 @@ export function parseIiifAnnotations(annos, imgSize) {
const lineAnnos = annos.filter(
(anno) =>
anno.textGranularity === 'line' || // IIIF Text Granularity
- anno.dcType === 'Line' // Europeana
+ anno.dcType === 'Line', // Europeana
);
const targetAnnos = lineAnnos.length > 0 ? lineAnnos : annos;
const boxes = targetAnnos.map((anno) => {
diff --git a/src/state/sagas.js b/src/state/sagas.js
index 22319f5..fcbca17 100644
--- a/src/state/sagas.js
+++ b/src/state/sagas.js
@@ -76,9 +76,8 @@ export function* discoverExternalOcr({ visibleCanvases: visibleCanvasIds, window
// seem to do anything :-/
for (const canvas of visibleCanvases) {
const { width, height } = canvas.__jsonld;
- const seeAlso = (Array.isArray(canvas.__jsonld.seeAlso)
- ? canvas.__jsonld.seeAlso
- : [canvas.__jsonld.seeAlso]
+ const seeAlso = (
+ Array.isArray(canvas.__jsonld.seeAlso) ? canvas.__jsonld.seeAlso : [canvas.__jsonld.seeAlso]
).filter((res) => isAlto(res) || isHocr(res))[0];
if (seeAlso !== undefined) {
const ocrSource = seeAlso['@id'];
@@ -129,7 +128,7 @@ export function* fetchExternalAnnotationResources({ targetId, annotationId, anno
return;
}
const resourceUris = uniq(
- annotationJson.resources.map((anno) => anno.resource['@id'].split('#')[0])
+ annotationJson.resources.map((anno) => anno.resource['@id'].split('#')[0]),
);
const contents = yield all(resourceUris.map((uri) => call(fetchAnnotationResource, uri)));
const contentMap = Object.fromEntries(contents.map((c) => [c.id ?? c['@id'], c]));
@@ -148,7 +147,7 @@ export function* fetchExternalAnnotationResources({ targetId, annotationId, anno
return { ...anno, resource: { ...anno.resource, value: partialContent } };
});
yield put(
- receiveAnnotation(targetId, annotationId, { ...annotationJson, resources: completedAnnos })
+ receiveAnnotation(targetId, annotationId, { ...annotationJson, resources: completedAnnos }),
);
}
@@ -160,7 +159,7 @@ export function* processTextsFromAnnotations({ targetId, annotationId, annotatio
(anno) =>
anno.motivation === 'supplementing' || // IIIF 3.0
anno.resource['@type']?.toLowerCase() === 'cnt:contentastext' || // IIIF 2.0
- ['Line', 'Word'].indexOf(anno.dcType) >= 0 // Europeana IIIF 2.0
+ ['Line', 'Word'].indexOf(anno.dcType) >= 0, // Europeana IIIF 2.0
);
if (contentAsTextAnnos.length > 0) {
@@ -178,7 +177,7 @@ export function* onConfigChange({ payload, id: windowId }) {
const texts = yield select(getTextsForVisibleCanvases, { windowId });
// Check if any of the texts need fetching
const needFetching = texts.filter(
- ({ sourceType, text }) => sourceType === 'ocr' && text === undefined
+ ({ sourceType, text }) => sourceType === 'ocr' && text === undefined,
);
// Check if we need to discover external OCR
const needsDiscovery =
@@ -191,7 +190,7 @@ export function* onConfigChange({ payload, id: windowId }) {
needFetching.map(({ canvasId, source }) => {
const { width, height } = visibleCanvases.find((c) => c.id === canvasId).__jsonld;
return put(requestText(canvasId, source, { height, width }));
- })
+ }),
);
if (needsDiscovery) {
const canvasIds = visibleCanvases.map((c) => c.id);
@@ -204,7 +203,7 @@ export function* injectTranslations() {
yield put(
updateConfig({
translations,
- })
+ }),
);
}
@@ -232,7 +231,7 @@ export function* fetchColors({ targetId, infoId }) {
const { success: infoSuccess, failure: infoFailure } = yield race({
success: take((a) => a.type === ActionTypes.RECEIVE_INFO_RESPONSE && a.infoId === infoId),
failure: take(
- (a) => a.type === ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE && a.infoId === infoId
+ (a) => a.type === ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE && a.infoId === infoId,
),
});
if (infoFailure) {
diff --git a/src/state/selectors.js b/src/state/selectors.js
index bbb5e54..1c3f88b 100644
--- a/src/state/selectors.js
+++ b/src/state/selectors.js
@@ -27,7 +27,7 @@ export const getWindowTextOverlayOptions = createSelector(
fontFamily,
...defaultConfig,
...(textOverlay ?? {}),
- })
+ }),
);
/** Selector to get all loaded texts */
@@ -43,5 +43,5 @@ export const getTextsForVisibleCanvases = createSelector(
return [];
}
return texts;
- }
+ },
);