id 가격 표시 옆

This commit is contained in:
익희 김 2025-01-20 23:54:54 +09:00
parent 57e9537c94
commit 1b06030bd2
2 changed files with 57 additions and 45 deletions

View File

@ -105,7 +105,9 @@ function ProductDetailsCarousel({ ...props }) {
}} }}
onClick={() => setModal(true)} onClick={() => setModal(true)}
> >
<Typography>{annotation.price}</Typography> <Typography>
{annotation.id}: {annotation.price}
</Typography>
</Button> </Button>
)) ))
: ''} : ''}

View File

@ -12,8 +12,6 @@ import { varFadeInRight } from '../animate';
// react dropzone // react dropzone
import { useDropzone } from 'react-dropzone'; import { useDropzone } from 'react-dropzone';
const DropZoneStyle = styled('div')(({ theme }) => ({ const DropZoneStyle = styled('div')(({ theme }) => ({
outline: 'none', outline: 'none',
display: 'flex', display: 'flex',
@ -48,13 +46,11 @@ export default function UploadMultiFile({ onAnnotationsChange, ...props }) {
const { error, files, onRemove, blob, isEdit, onRemoveAll, loading, sx, ...other } = props; const { error, files, onRemove, blob, isEdit, onRemoveAll, loading, sx, ...other } = props;
const [modalOpen, setModalOpen] = useState(false); const [modalOpen, setModalOpen] = useState(false);
const [priceModalOpen, setPriceModalOpen] = useState(false); // const [priceModalOpen, setPriceModalOpen] = useState(false); //
const [clientPosition, setClientPosition] = useState({ x: 0, y: 0 }); // const [clientPosition, setClientPosition] = useState({ x: 0, y: 0 }); //
const [price, setPrice] = useState(''); // const [price, setPrice] = useState(''); //
const [annotations, setAnnotations] = useState([]); // const [annotations, setAnnotations] = useState([]); //
const [image, setImage] = useState(''); const [image, setImage] = useState('');
const [predictions, setPredictions] = useState([]); // Roboflow const [predictions, setPredictions] = useState([]); // Roboflow
const canvasRef = useRef(null); // const canvasRef = useRef(null); //
@ -138,8 +134,23 @@ export default function UploadMultiFile({ onAnnotationsChange, ...props }) {
}; };
// //
// const handleSavePrice = () => {
// const updatedAnnotations = [...annotations, { x: clientPosition.x, y: clientPosition.y, price }];
// setAnnotations(updatedAnnotations);
// setPriceModalOpen(false); //
// setPrice(''); //
// if (onAnnotationsChange) {
// onAnnotationsChange(updatedAnnotations); //
// }
// };
const handleSavePrice = () => { const handleSavePrice = () => {
const updatedAnnotations = [...annotations, { x: clientPosition.x, y: clientPosition.y, price }]; const newId = annotations.length > 0 ? annotations[annotations.length - 1].id + 1 : 1;
const updatedAnnotations = [...annotations, { id: newId, x: clientPosition.x, y: clientPosition.y, price }];
setAnnotations(updatedAnnotations); setAnnotations(updatedAnnotations);
setPriceModalOpen(false); // setPriceModalOpen(false); //
setPrice(''); // setPrice(''); //
@ -147,7 +158,6 @@ export default function UploadMultiFile({ onAnnotationsChange, ...props }) {
if (onAnnotationsChange) { if (onAnnotationsChange) {
onAnnotationsChange(updatedAnnotations); // onAnnotationsChange(updatedAnnotations); //
} }
}; };
useEffect(() => { useEffect(() => {
@ -284,7 +294,7 @@ export default function UploadMultiFile({ onAnnotationsChange, ...props }) {
background: '#fff', background: '#fff',
padding: 3, padding: 3,
borderRadius: 1, borderRadius: 1,
boxShadow: 24, boxShadow: 24
}} }}
> >
<Typography variant="h6">Enter Price</Typography> <Typography variant="h6">Enter Price</Typography>
@ -313,10 +323,10 @@ export default function UploadMultiFile({ onAnnotationsChange, ...props }) {
backgroundColor: 'rgba(0,0,0,0.7)', backgroundColor: 'rgba(0,0,0,0.7)',
color: '#fff', color: '#fff',
padding: '2px 5px', padding: '2px 5px',
borderRadius: '4px', borderRadius: '4px'
}} }}
> >
{annotation.price} { annotation.id}: {annotation.price}
</Typography> </Typography>
))} ))}
</Stack> </Stack>