From c3d79a23bfa92c133b7c323a55212e3691f5fad4 Mon Sep 17 00:00:00 2001 From: enes Date: Mon, 19 Aug 2024 14:55:26 +0200 Subject: [PATCH] fix(create-page): file list --- src/components/DrawPDFFields/index.tsx | 28 ++++++++++++-------------- src/pages/create/index.tsx | 20 +++++++++++------- src/pages/create/style.module.scss | 11 ++++++---- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/components/DrawPDFFields/index.tsx b/src/components/DrawPDFFields/index.tsx index 992f273..62216e1 100644 --- a/src/components/DrawPDFFields/index.tsx +++ b/src/components/DrawPDFFields/index.tsx @@ -16,7 +16,7 @@ import { Select } from '@mui/material' import styles from './style.module.scss' -import { useEffect, useState } from 'react' +import React, { useEffect, useState } from 'react' import * as PDFJS from 'pdfjs-dist' import { ProfileMetadata, User, UserRole } from '../../types' @@ -535,26 +535,24 @@ export const DrawPDFFields = (props: Props) => {
{pdfFiles.map((pdfFile, pdfFileIndex: number) => { return ( - <> +
{getPdfPages(pdfFile, pdfFileIndex)} + {pdfFileIndex < pdfFiles.length - 1 && ( + + File Separator + + )}
- {pdfFileIndex < pdfFiles.length - 1 && ( - - File Separator - - )} - +
) })} diff --git a/src/pages/create/index.tsx b/src/pages/create/index.tsx index 57e41b0..970e001 100644 --- a/src/pages/create/index.tsx +++ b/src/pages/create/index.tsx @@ -52,6 +52,7 @@ import { } from '../../utils' import { Container } from '../../components/Container' import styles from './style.module.scss' +import fileListStyles from '../../components/FileList/style.module.scss' import { PdfFile } from '../../types/drawing' import { DrawPDFFields } from '../../components/DrawPDFFields' import { Mark } from '../../types/mark.ts' @@ -69,6 +70,8 @@ export const CreatePage = () => { const navigate = useNavigate() const location = useLocation() const { uploadedFiles } = location.state || {} + const [currentFile, setCurrentFile] = useState() + const isActive = (file: File) => file.name === currentFile?.name const [isLoading, setIsLoading] = useState(false) const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('') @@ -281,8 +284,8 @@ export const CreatePage = () => { } } - const handleFileClick = (name: string) => { - document.getElementById(name)?.scrollIntoView({ behavior: 'smooth' }) + const handleFileClick = (id: string) => { + document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' }) } const handleRemoveFile = ( @@ -737,13 +740,16 @@ export const CreatePage = () => {
    {selectedFiles.length > 0 && selectedFiles.map((file, index) => ( - - +
))}