Skip to content

Commit 5935625

Browse files
authored
Merge pull request #29 from ilb/update-library-and-add-props-unoptimized
update library and add props unoptimized
2 parents 96ed5dc + 30802c4 commit 5935625

6 files changed

Lines changed: 22 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ilb/classifiercomponent",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"description": "",
55
"main": "src/index.js",
66
"scripts": {

src/classifier/client/components/Classifier.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const Classifier = ({
3232
schema,
3333
hiddenTabs = [],
3434
readonlyClassifier = null,
35+
unoptimized = true,
3536
defaultTab = 'classifier'
3637
}) => {
3738
const [classifier, setClassifier] = useState(schema.classifier);
@@ -433,6 +434,7 @@ const Classifier = ({
433434
srcSet={selectedDocument}
434435
onRemove={handlePageDelete}
435436
active={activeDraggable}
437+
unoptimized={unoptimized}
436438
/>
437439
</Dimmer.Dimmable>
438440
</Grid.Column>

src/classifier/client/components/gallery/GalleryItem/GalleryItem.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ const GalleryItem = React.memo(
1919
onClick,
2020
attributes,
2121
listeners,
22-
errors
22+
errors,
23+
unoptimized
2324
},
2425
ref
2526
) => {
@@ -74,7 +75,7 @@ const GalleryItem = React.memo(
7475
height={height}
7576
layout="responsive"
7677
quality={10}
77-
unoptimized={true}
78+
unoptimized={unoptimized}
7879
onClick={onClick}
7980
className="img-ofit"
8081
style={{

src/classifier/client/components/gallery/GalleryItem/SegmentItem.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Image from 'next/image';
22
import React, { useEffect, useRef, useState } from 'react';
33
import ScrollContainer from 'react-indiana-drag-scroll';
44

5-
const SegmentItem = ({ src, onClick, rotation, scale }) => {
5+
const SegmentItem = ({ src, onClick, rotation, scale, unoptimized }) => {
66
const [[width, height], setWidthHeight] = useState([460, 600]);
77
const contentRef = useRef(null);
88
useEffect(() => {
@@ -26,6 +26,7 @@ const SegmentItem = ({ src, onClick, rotation, scale }) => {
2626
src={src}
2727
//width={width * scale}
2828
//height={height * scale}
29+
unoptimized={unoptimized}
2930
width={rotation === 0 || rotation === 180 ? width * scale : height * scale}
3031
height={rotation === 90 || rotation === 270 ? width * scale : height * scale}
3132
layout="fixed"

src/classifier/client/components/gallery/SortableGallery.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SegmentItem from './GalleryItem/SegmentItem';
77
import React, { useEffect, useState } from 'react';
88
import ControlsMenu from '../gallery/GalleryItem/ControlsMenu';
99

10-
const SortableGallery = ({ srcSet, active, onRemove, tab, pageErrors }) => {
10+
const SortableGallery = ({ srcSet, active, onRemove, tab, pageErrors, unoptimized }) => {
1111
const [state, setState] = useState({
1212
scale: 1,
1313
rotation: 0,
@@ -92,6 +92,7 @@ const SortableGallery = ({ srcSet, active, onRemove, tab, pageErrors }) => {
9292
tablet={8}
9393
mobile={16}>
9494
<SortableGalleryItem
95+
unoptimized={unoptimized}
9596
src={src}
9697
errors={pageErrors[src.uuid]}
9798
disabled={tab.readonly}
@@ -109,6 +110,7 @@ const SortableGallery = ({ srcSet, active, onRemove, tab, pageErrors }) => {
109110
)}
110111
{state.previewOpen && (
111112
<SegmentItem
113+
unoptimized={unoptimized}
112114
src={state.src}
113115
rotation={state.rotation}
114116
scale={state.scale}

src/classifier/client/components/gallery/SortableGalleryItem.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ import { useSortable } from '@dnd-kit/sortable';
22
import { CSS } from '@dnd-kit/utilities';
33
import GalleryItem from './GalleryItem/GalleryItem';
44

5-
const SortableGalleryItem = ({ src, width, height, onRemove, onClick, disabled, errors }) => {
5+
const SortableGalleryItem = ({
6+
src,
7+
width,
8+
height,
9+
onRemove,
10+
onClick,
11+
disabled,
12+
errors,
13+
unoptimized
14+
}) => {
615
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
716
id: src.id,
817
disabled: !src.type.includes('image/') || disabled
@@ -29,6 +38,7 @@ const SortableGalleryItem = ({ src, width, height, onRemove, onClick, disabled,
2938
attributes={attributes}
3039
listeners={listeners}
3140
errors={errors}
41+
unoptimized={unoptimized}
3242
/>
3343
);
3444
};

0 commit comments

Comments
 (0)