mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-11-16 01:21:16 +01:00
style(frontend): remove redundant React imports in TypeScript components (#4738)
# Description of Changes This pull request removes unnecessary imports of the default React object from multiple frontend files. The changes help clean up the codebase by only importing specific React hooks where needed, rather than importing the entire React object. **Code cleanup and import optimization:** * Removed default `React` imports from component files, retaining only the necessary React hooks (such as `useEffect`, `useState`, `useMemo`, etc.) in files like `FileEditor.tsx`, `FullscreenToolList.tsx`, `ToolPanel.tsx`, `PageNumberPreview.tsx`, `AdjustContrastPreview.tsx`, `AutomationRun.tsx`, `LocalEmbedPDFWithAnnotations.tsx`, `ToolRegistryProvider.tsx`, `useTranslatedToolRegistry.tsx`, and `AdjustContrast.tsx`. [[1]](diffhunk://#diff-481d0a2d8a1714d34d21181db63a020b08dfccfbfa80bf47ac9af382dff25310L1-R1) [[2]](diffhunk://#diff-1d6e9507cb0744e03ec0e80c510874bfc5054986b0275ae3b8592eb67b5ec0f2L1-R1) [[3]](diffhunk://#diff-8ee3da71652291722dc6130f44565c098fe0f9cdf5e8ec0ba3c631be8980b13eL1-R1) [[4]](diffhunk://#diff-ecc12bf9b557e947ae2f1866d07446b19bad1fbdf143bf231dd3076b1e794826L1-R1) [[5]](diffhunk://#diff-6ba4ca6f491368b62e160639e97207f5c1d35fee77f4eebd39133630e0ecb7a1L1-R1) [[6]](diffhunk://#diff-ff7cba3dba3b1f4ec4c8758a9fbe539351f96225284d0c61cca2642ec7a8e486L1-R1) [[7]](diffhunk://#diff-d99cf54aa50d266c08844fac31c79e73a7f1714adeedb186d1decab8b9fb7f78L1-R1) [[8]](diffhunk://#diff-3467ae2b00d2ea95c360bc367adfbae124a4fb1d2627e889d12fb00e288bf508L1-R1) [[9]](diffhunk://#diff-0a3e636736c137356dd9354ff3cacbd302ebda40147545e13c62d073525d1969L1-R1) [[10]](diffhunk://#diff-2fed64bea41254c30dcc038f6b92943272bcaa771af200b8a3dc1a2cef6b5ca7L2-R2) * Removed default `React` imports from presentational and settings components that do not use JSX at the top level, such as `Workbench.tsx`, `SliderWithInput.tsx`, `AdjustContrastBasicSettings.tsx`, `AdjustContrastColorSettings.tsx`, `AdjustContrastSingleStepSettings.tsx`, `FileSummaryHeader.tsx`, `SignatureSection.tsx`, `SignatureStatusBadge.tsx`, and `ThumbnailPreview.tsx`. [[1]](diffhunk://#diff-6ffa9f7048b8e2a454ccf52b712179784cf32d42ecac9c85331c595a4cee39b4L1) [[2]](diffhunk://#diff-a1159e58f6668bc6de9595b4014fd7b8e0a19f9efa75294ba80184cfe54b601fL1) [[3]](diffhunk://#diff-ce5bbd748c15bc456e7f01180b7ff04c80c782e3d6662384f28e032af36ed3ccL1) [[4]](diffhunk://#diff-494006ec5e237eb7b3a16b9bc144a6ed49ed38c547d95b68a89f69a5af6676ceL1) [[5]](diffhunk://#diff-e61a3e2d98c9601eea868062258b925e6f6d672f49df14e3684b12f736622db4L1) [[6]](diffhunk://#diff-97df8b451114e347bb3f581ff5c91057601fb821e224479e1106493ce9479dcdL1) [[7]](diffhunk://#diff-cc070bfc4dc892a4e9a2be725c9f27ab66bdbc821a525fad10e14b27096d4e5aL1) [[8]](diffhunk://#diff-c179df2634412e4938bcd686f86b3bdbd1a6039d8a8b62c44fd0c085cc58af74L1) [[9]](diffhunk://#diff-64403230a8c8e90135bd8d7cd275c40d8e22bd3a22ed642dec5451018eec3c10L1) These changes reduce unnecessary imports and make the codebase cleaner and more consistent. --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. Co-authored-by: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com>
This commit is contained in:
parent
c33d705c32
commit
81dec53488
@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback, useRef, useMemo, useEffect } from 'react';
|
||||
import { useState, useCallback, useRef, useMemo, useEffect } from 'react';
|
||||
import {
|
||||
Text, Center, Box, LoadingOverlay, Stack
|
||||
} from '@mantine/core';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Box } from '@mantine/core';
|
||||
import { useRainbowThemeContext } from '../shared/RainbowThemeProvider';
|
||||
import { useToolWorkflow } from '../../contexts/ToolWorkflowContext';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Slider, Text, Group, NumberInput } from '@mantine/core';
|
||||
|
||||
interface Props {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { Text } from '@mantine/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ToolRegistryEntry, getSubcategoryLabel, getSubcategoryColor, getSubcategoryIcon } from '../../data/toolsTaxonomy';
|
||||
@ -104,7 +104,7 @@ const FullscreenToolList = ({
|
||||
{showRecentFavorites && (
|
||||
<>
|
||||
{favoriteToolItems.length > 0 && (
|
||||
<section
|
||||
<section
|
||||
className="tool-panel__fullscreen-group tool-panel__fullscreen-group--special"
|
||||
style={{
|
||||
borderColor: 'var(--fullscreen-border-favorites)',
|
||||
@ -146,7 +146,7 @@ const FullscreenToolList = ({
|
||||
)}
|
||||
|
||||
{recommendedItems.length > 0 && (
|
||||
<section
|
||||
<section
|
||||
className="tool-panel__fullscreen-group tool-panel__fullscreen-group--special"
|
||||
style={{
|
||||
borderColor: 'var(--fullscreen-border-recommended)',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useRainbowThemeContext } from '../shared/RainbowThemeProvider';
|
||||
import { useToolWorkflow } from '../../contexts/ToolWorkflowContext';
|
||||
import { usePreferences } from '../../contexts/PreferencesContext';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AddPageNumbersParameters } from './useAddPageNumbersParameters';
|
||||
import { pdfWorkerManager } from '../../../services/pdfWorkerManager';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Stack } from '@mantine/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AdjustContrastParameters } from '../../../hooks/tools/adjustContrast/useAdjustContrastParameters';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Stack } from '@mantine/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AdjustContrastParameters } from '../../../hooks/tools/adjustContrast/useAdjustContrastParameters';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { AdjustContrastParameters } from '../../../hooks/tools/adjustContrast/useAdjustContrastParameters';
|
||||
import { useThumbnailGeneration } from '../../../hooks/useThumbnailGeneration';
|
||||
import ObscuredOverlay from '../../shared/ObscuredOverlay';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Stack } from '@mantine/core';
|
||||
import { AdjustContrastParameters } from '../../../hooks/tools/adjustContrast/useAdjustContrastParameters';
|
||||
import AdjustContrastBasicSettings from './AdjustContrastBasicSettings';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button, Text, Stack, Group, Card, Progress } from "@mantine/core";
|
||||
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import './styles.css';
|
||||
import FieldBlock from './FieldBlock';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Divider, Group, Stack, Text } from '@mantine/core';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { SignatureValidationSignature } from '../../../../types/validateSignature';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Badge, Popover, Text } from '@mantine/core';
|
||||
import './styles.css';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
|
||||
import './styles.css';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { createPluginRegistration } from '@embedpdf/core';
|
||||
import { EmbedPDF } from '@embedpdf/core/react';
|
||||
import { usePdfiumEngine } from '@embedpdf/engines/react';
|
||||
@ -316,4 +316,4 @@ export function LocalEmbedPDFWithAnnotations({
|
||||
</EmbedPDF>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import type { ToolId } from '../types/toolId';
|
||||
import type { ToolRegistry } from '../data/toolsTaxonomy';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import React, { useMemo } from "react";
|
||||
import { useMemo } from "react";
|
||||
import LocalIcon from "../components/shared/LocalIcon";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import SplitPdfPanel from "../tools/Split";
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { createToolFlow } from '../components/tools/shared/createToolFlow';
|
||||
import { BaseToolProps, ToolComponent } from '../types/tool';
|
||||
import { useBaseTool } from '../hooks/tools/shared/useBaseTool';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user