Releasing new design #161

Merged
b merged 241 commits from staging into main 2024-08-21 11:38:25 +00:00
3 changed files with 22 additions and 22 deletions
Showing only changes of commit 3d3b8ba6e1 - Show all commits

View File

@ -37,7 +37,7 @@ interface Props {
} }
export const DrawPDFFields = (props: Props) => { export const DrawPDFFields = (props: Props) => {
const { selectedFiles, selectedTool } = props const { selectedFiles, selectedTool, onDrawFieldsChange, users } = props
const [pdfFiles, setPdfFiles] = useState<PdfFile[]>([]) const [pdfFiles, setPdfFiles] = useState<PdfFile[]>([])
const [parsingPdf, setParsingPdf] = useState<boolean>(false) const [parsingPdf, setParsingPdf] = useState<boolean>(false)
@ -67,8 +67,8 @@ export const DrawPDFFields = (props: Props) => {
}, [selectedFiles]) }, [selectedFiles])
useEffect(() => { useEffect(() => {
if (pdfFiles) props.onDrawFieldsChange(pdfFiles) if (pdfFiles) onDrawFieldsChange(pdfFiles)
}, [pdfFiles, props]) }, [onDrawFieldsChange, pdfFiles])
/** /**
* Drawing events * Drawing events
@ -96,7 +96,7 @@ export const DrawPDFFields = (props: Props) => {
* @param page PdfPage where press happened * @param page PdfPage where press happened
*/ */
const onMouseDown = ( const onMouseDown = (
event: React.MouseEvent<HTMLDivElement, MouseEvent>, event: React.MouseEvent<HTMLDivElement>,
page: PdfPage page: PdfPage
) => { ) => {
// Proceed only if left click // Proceed only if left click
@ -149,7 +149,7 @@ export const DrawPDFFields = (props: Props) => {
* @param page PdfPage where moving is happening * @param page PdfPage where moving is happening
*/ */
const onMouseMove = ( const onMouseMove = (
event: React.MouseEvent<HTMLDivElement, MouseEvent>, event: React.MouseEvent<HTMLDivElement>,
page: PdfPage page: PdfPage
) => { ) => {
if (mouseState.clicked && selectedTool) { if (mouseState.clicked && selectedTool) {
@ -188,9 +188,7 @@ export const DrawPDFFields = (props: Props) => {
* @param event Mouse event * @param event Mouse event
* @param drawnField Which we are moving * @param drawnField Which we are moving
*/ */
const onDrawnFieldMouseDown = ( const onDrawnFieldMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {
event: React.MouseEvent<HTMLDivElement, MouseEvent>
) => {
event.stopPropagation() event.stopPropagation()
// Proceed only if left click // Proceed only if left click
@ -214,7 +212,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnField which we are moving * @param drawnField which we are moving
*/ */
const onDrawnFieldMouseMove = ( const onDrawnFieldMouseMove = (
event: React.MouseEvent<HTMLDivElement, MouseEvent>, event: React.MouseEvent<HTMLDivElement>,
drawnField: DrawnField drawnField: DrawnField
) => { ) => {
if (mouseState.dragging) { if (mouseState.dragging) {
@ -250,7 +248,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnField which we are resizing * @param drawnField which we are resizing
*/ */
const onResizeHandleMouseDown = ( const onResizeHandleMouseDown = (
event: React.MouseEvent<HTMLSpanElement, MouseEvent> event: React.MouseEvent<HTMLSpanElement>
) => { ) => {
// Proceed only if left click // Proceed only if left click
if (event.button !== 0) return if (event.button !== 0) return
@ -268,7 +266,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnField which we are resizing * @param drawnField which we are resizing
*/ */
const onResizeHandleMouseMove = ( const onResizeHandleMouseMove = (
event: React.MouseEvent<HTMLSpanElement, MouseEvent>, event: React.MouseEvent<HTMLSpanElement>,
drawnField: DrawnField drawnField: DrawnField
) => { ) => {
if (mouseState.resizing) { if (mouseState.resizing) {
@ -298,7 +296,7 @@ export const DrawPDFFields = (props: Props) => {
* @param drawnFileIndex drawn file index * @param drawnFileIndex drawn file index
*/ */
const onRemoveHandleMouseDown = ( const onRemoveHandleMouseDown = (
event: React.MouseEvent<HTMLSpanElement, MouseEvent>, event: React.MouseEvent<HTMLSpanElement>,
pdfFileIndex: number, pdfFileIndex: number,
pdfPageIndex: number, pdfPageIndex: number,
drawnFileIndex: number drawnFileIndex: number
@ -317,7 +315,7 @@ export const DrawPDFFields = (props: Props) => {
* @param event Mouse event * @param event Mouse event
*/ */
const onUserSelectHandleMouseDown = ( const onUserSelectHandleMouseDown = (
event: React.MouseEvent<HTMLDivElement, MouseEvent> event: React.MouseEvent<HTMLDivElement>
) => { ) => {
event.stopPropagation() event.stopPropagation()
} }
@ -329,8 +327,8 @@ export const DrawPDFFields = (props: Props) => {
* event.target will be used * event.target will be used
*/ */
const getMouseCoordinates = ( const getMouseCoordinates = (
event: React.MouseEvent<HTMLElement, MouseEvent>, event: React.MouseEvent<HTMLElement>,
customTarget?: HTMLElement | null customTarget?: HTMLElement
) => { ) => {
const target = customTarget ? customTarget : event.currentTarget const target = customTarget ? customTarget : event.currentTarget
const rect = target.getBoundingClientRect() const rect = target.getBoundingClientRect()
@ -419,7 +417,7 @@ export const DrawPDFFields = (props: Props) => {
labelId="counterparts" labelId="counterparts"
label="Counterparts" label="Counterparts"
> >
{props.users {users
.filter((u) => u.role === UserRole.signer) .filter((u) => u.role === UserRole.signer)
.map((user, index) => { .map((user, index) => {
let displayValue = truncate( let displayValue = truncate(

View File

@ -7,15 +7,17 @@ import {
isCurrentUserMarksComplete, isCurrentUserMarksComplete,
isCurrentValueLast isCurrentValueLast
} from '../../utils' } from '../../utils'
import { useState } from 'react' import React, { useState } from 'react'
interface MarkFormFieldProps { interface MarkFormFieldProps {
handleSubmit: (event: any) => void
handleSelectedMarkValueChange: (event: any) => void
selectedMark: CurrentUserMark
selectedMarkValue: string
currentUserMarks: CurrentUserMark[] currentUserMarks: CurrentUserMark[]
handleCurrentUserMarkChange: (mark: CurrentUserMark) => void handleCurrentUserMarkChange: (mark: CurrentUserMark) => void
handleSelectedMarkValueChange: (
event: React.ChangeEvent<HTMLInputElement>
) => void
handleSubmit: (event: React.FormEvent<HTMLFormElement>) => void
selectedMark: CurrentUserMark
selectedMarkValue: string
} }
/** /**

View File

@ -1,4 +1,4 @@
import { MarkType } from "./drawing"; import { MarkType } from './drawing'
export interface CurrentUserMark { export interface CurrentUserMark {
id: number id: number