fix: lint project (#2693)

This commit is contained in:
David Nguyen
2026-05-08 16:04:22 +10:00
committed by GitHub
parent edbf65969b
commit 8671f269e8
1414 changed files with 12867 additions and 24335 deletions
@@ -1,17 +1,13 @@
import React, { useEffect, useMemo, useRef, useState } from 'react';
import type { ImageLoadingState, PageRenderData } from '@documenso/lib/client-only/providers/envelope-render-provider';
import { PDF_VIEWER_PAGE_CLASSNAME } from '@documenso/lib/constants/pdf-viewer';
import { cn } from '@documenso/ui/lib/utils';
import { useToast } from '@documenso/ui/primitives/use-toast';
import { Trans, useLingui } from '@lingui/react/macro';
import pMap from 'p-map';
import * as pdfjsLib from 'pdfjs-dist';
import pdfjsWorker from 'pdfjs-dist/build/pdf.worker?url';
import type {
ImageLoadingState,
PageRenderData,
} from '@documenso/lib/client-only/providers/envelope-render-provider';
import { PDF_VIEWER_PAGE_CLASSNAME } from '@documenso/lib/constants/pdf-viewer';
import { cn } from '@documenso/ui/lib/utils';
import { useToast } from '@documenso/ui/primitives/use-toast';
import type React from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
import type { ScrollTarget } from '../virtual-list/use-virtual-list';
import { useVirtualList } from '../virtual-list/use-virtual-list';
@@ -113,8 +109,7 @@ export default function PDFViewer({
return;
}
const loadedPdf = await pdfjsLib.getDocument({ data: result!, cMapUrl: '/static/cmaps/' })
.promise;
const loadedPdf = await pdfjsLib.getDocument({ data: result!, cMapUrl: '/static/cmaps/' }).promise;
if (isCancelled) {
await loadedPdf.destroy();
@@ -130,18 +125,15 @@ export default function PDFViewer({
pdfRef.current = loadedPdf;
// Fetch the pages
const pages = await pMap(
Array.from({ length: loadedPdf.numPages }),
async (_, pageIndex) => {
const page = await loadedPdf.getPage(pageIndex + 1);
const viewport = page.getViewport({ scale: 1 });
const pages = await pMap(Array.from({ length: loadedPdf.numPages }), async (_, pageIndex) => {
const page = await loadedPdf.getPage(pageIndex + 1);
const viewport = page.getViewport({ scale: 1 });
return {
width: viewport.width,
height: viewport.height,
};
},
);
return {
width: viewport.width,
height: viewport.height,
};
});
if (isCancelled) {
return;
@@ -191,7 +183,7 @@ export default function PDFViewer({
if (!data) {
return (
<div ref={$el} className={cn('h-full w-full', className)} {...props}>
<p className="py-32 text-center text-sm text-muted-foreground">
<p className="py-32 text-center text-muted-foreground text-sm">
<Trans>No document found</Trans>
</p>
</div>
@@ -351,10 +343,7 @@ const PdfViewerPage = ({
});
return (
<div
className="relative w-full rounded border border-border"
style={{ width: scaledWidth, height: scaledHeight }}
>
<div className="relative w-full rounded border border-border" style={{ width: scaledWidth, height: scaledHeight }}>
{CustomPageRenderer && imageLoadingState === 'loaded' && (
<CustomPageRenderer
pageData={{
@@ -376,13 +365,7 @@ const PdfViewerPage = ({
/**
* Manages rendering a page from a pdf.
*/
const usePdfPageImage = ({
pageNumber,
pdf,
scale,
scaledWidth,
scaledHeight,
}: PdfViewerPageProps) => {
const usePdfPageImage = ({ pageNumber, pdf, scale, scaledWidth, scaledHeight }: PdfViewerPageProps) => {
const [imageLoadingState, setImageLoadingState] = useState<ImageLoadingState>('loading');
const [imageUrl, setImageUrl] = useState('');