mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-02-02 00:16:34 +01:00
Fixed warnings optimised load time
This commit is contained in:
parent
c404754e26
commit
de2c1fd3e2
@ -1,19 +1,14 @@
|
|||||||
|
|
||||||
import { AiOutlineMergeCells, AiOutlineSplitCells } from "react-icons/ai";
|
import { AiOutlineMergeCells, AiOutlineSplitCells } from "react-icons/ai";
|
||||||
import { BiCrop } from "react-icons/bi";
|
import { BiCrop, BiSprayCan } from "react-icons/bi";
|
||||||
import {
|
import {
|
||||||
BsTools, BsSortNumericDown, BsArrowClockwise, BsFileEarmarkX, BsLayoutSplit, BsPalette, BsArrowUpSquare, Bs1Square, BsFileEarmarkPdf,
|
BsTools, BsSortNumericDown, BsArrowClockwise, BsFileEarmarkX, BsLayoutSplit, BsPalette, BsArrowUpSquare, Bs1Square, BsFileEarmarkPdf,
|
||||||
BsArrowLeftRight, BsFileEarmarkImage, BsFileEarmark, BsFiletypeHtml, BsLink, BsFiletypeMd, BsFileEarmarkWord, BsFiletypePpt, BsFiletypeTxt,
|
BsArrowLeftRight, BsFileEarmarkImage, BsFileEarmark, BsFiletypeHtml, BsLink, BsFiletypeMd, BsFileEarmarkWord, BsFiletypePpt, BsFiletypeTxt,
|
||||||
BsFiletypeXml, BsLock, BsUnlock, BsShieldLock, BsDroplet, BsAward, BsEraserFill, BsCardList, BsClipboardData, BsFile, BsFileEarmarkRichtext,
|
BsFiletypeXml, BsLock, BsUnlock, BsShieldLock, BsDroplet, BsAward, BsEraserFill, BsCardList, BsClipboardData, BsFile, BsFileEarmarkRichtext,
|
||||||
BsFileZip, BsFiletypeJs, BsFonts, BsImages, BsInfoCircle, BsSearch, BsShieldCheck, BsVectorPen, BsWrench
|
BsFileZip, BsFiletypeJs, BsFonts, BsImages, BsInfoCircle, BsSearch, BsShieldCheck, BsVectorPen, BsWrench, BsArrowsCollapse, BsGrid, Bs123,
|
||||||
|
BsArrowsFullscreen
|
||||||
} from "react-icons/bs";
|
} from "react-icons/bs";
|
||||||
import { GiScales } from "react-icons/gi";
|
import { MdOutlineScanner, MdOutlineBalance } from "react-icons/md";
|
||||||
import { LuLayoutGrid } from "react-icons/lu";
|
|
||||||
import { MdOutlineScanner } from "react-icons/md";
|
|
||||||
import { PiArrowsInLineVertical } from "react-icons/pi";
|
|
||||||
import { SlSizeFullscreen } from "react-icons/sl";
|
|
||||||
import { TfiSpray } from "react-icons/tfi";
|
|
||||||
import { TbNumbers } from "react-icons/tb";
|
|
||||||
import { IconType } from "react-icons";
|
import { IconType } from "react-icons";
|
||||||
|
|
||||||
import Container from 'react-bootstrap/Container';
|
import Container from 'react-bootstrap/Container';
|
||||||
@ -40,14 +35,14 @@ interface NavInfoSublist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function convertToNavLink(item: NavInfoItem, index: number) {
|
function convertToNavLink(item: NavInfoItem, index: number) {
|
||||||
return <LinkContainer key={index} to={item.dest}><Nav.Link className="nav-icon" title={item.tooltip}><item.icon/><span>{item.displayText}</span></Nav.Link></LinkContainer>;
|
return <LinkContainer key={"nav-link-"+index} to={item.dest}><Nav.Link className="nav-icon" title={item.tooltip}><item.icon/><span>{item.displayText}</span></Nav.Link></LinkContainer>;
|
||||||
}
|
}
|
||||||
function convertToNavDropdownItem(item: NavInfoItem | null) {
|
function convertToNavDropdownItem(item: NavInfoItem | null, index: number) {
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return <NavDropdown.Divider />;
|
return <NavDropdown.Divider key={"nav-dropdown-divider-"+index}/>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LinkContainer to={item.dest}>
|
<LinkContainer to={item.dest} key={"nav-dropdown-item-"+index}>
|
||||||
<NavDropdown.Item className="nav-icon" title={item.tooltip}>
|
<NavDropdown.Item className="nav-icon" title={item.tooltip}>
|
||||||
<item.icon/>
|
<item.icon/>
|
||||||
<span>{item.displayText}</span>
|
<span>{item.displayText}</span>
|
||||||
@ -55,7 +50,7 @@ function convertToNavDropdownItem(item: NavInfoItem | null) {
|
|||||||
</LinkContainer>
|
</LinkContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function convertToNavDropdown(sublist: NavInfoSublist) {
|
function convertToNavDropdown(sublist: NavInfoSublist, index: number) {
|
||||||
var myTitle = <>
|
var myTitle = <>
|
||||||
<span className="nav-icon">
|
<span className="nav-icon">
|
||||||
<sublist.icon/>
|
<sublist.icon/>
|
||||||
@ -64,8 +59,8 @@ function convertToNavDropdown(sublist: NavInfoSublist) {
|
|||||||
</>;
|
</>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavDropdown title={myTitle} id="basic-nav-dropdown">
|
<NavDropdown title={myTitle} id="basic-nav-dropdown" key={"nav-dropdown-"+index}>
|
||||||
{sublist.sublist.map(convertToNavDropdownItem)}
|
{sublist.sublist.map((item, i) => convertToNavDropdownItem(item, i))}
|
||||||
</NavDropdown>
|
</NavDropdown>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -77,12 +72,12 @@ function NavBar() {
|
|||||||
{displayText: t('multiTool.title'), icon: BsTools, dest: "/home", tooltip: t('home.multiTool.desc')},
|
{displayText: t('multiTool.title'), icon: BsTools, dest: "/home", tooltip: t('home.multiTool.desc')},
|
||||||
{displayText: t('navbar.pageOps'), icon: BsFileEarmarkPdf, sublist: [
|
{displayText: t('navbar.pageOps'), icon: BsFileEarmarkPdf, sublist: [
|
||||||
{ displayText: t('home.merge.title'), icon: AiOutlineMergeCells, dest: "/dashboard", tooltip: t('home.merge.desc') },
|
{ displayText: t('home.merge.title'), icon: AiOutlineMergeCells, dest: "/dashboard", tooltip: t('home.merge.desc') },
|
||||||
{ displayText: t('home.split.title'), icon: AiOutlineSplitCells, dest: "/nothing-here", tooltip: t('home.split.desc') },
|
{ displayText: t('home.split.title'), icon: AiOutlineSplitCells, dest: "/about", tooltip: t('home.split.desc') },
|
||||||
{ displayText: t('home.pdfOrganiser.title'), icon: BsSortNumericDown, dest: "/nothing-here", tooltip: t('home.pdfOrganiser.desc') },
|
{ displayText: t('home.pdfOrganiser.title'), icon: BsSortNumericDown, dest: "/nothing-here", tooltip: t('home.pdfOrganiser.desc') },
|
||||||
{ displayText: t('home.rotate.title'), icon: BsArrowClockwise, dest: "/nothing-here", tooltip: t('home.rotate.desc') },
|
{ displayText: t('home.rotate.title'), icon: BsArrowClockwise, dest: "/nothing-here", tooltip: t('home.rotate.desc') },
|
||||||
{ displayText: t('home.removePages.title'), icon: BsFileEarmarkX, dest: "/nothing-here", tooltip: t('home.removePages.desc') },
|
{ displayText: t('home.removePages.title'), icon: BsFileEarmarkX, dest: "/nothing-here", tooltip: t('home.removePages.desc') },
|
||||||
{ displayText: t('home.pageLayout.title'), icon: LuLayoutGrid, dest: "/nothing-here", tooltip: t('home.pageLayout.desc') },
|
{ displayText: t('home.pageLayout.title'), icon: BsGrid, dest: "/nothing-here", tooltip: t('home.pageLayout.desc') },
|
||||||
{ displayText: t('home.scalePages.title'), icon: SlSizeFullscreen, dest: "/nothing-here", tooltip: t('home.scalePages.desc') },
|
{ displayText: t('home.scalePages.title'), icon: BsArrowsFullscreen, dest: "/nothing-here", tooltip: t('home.scalePages.desc') },
|
||||||
{ displayText: t('home.autoSplitPDF.title'), icon: BsLayoutSplit, dest: "/nothing-here", tooltip: t('home.autoSplitPDF.desc') },
|
{ displayText: t('home.autoSplitPDF.title'), icon: BsLayoutSplit, dest: "/nothing-here", tooltip: t('home.autoSplitPDF.desc') },
|
||||||
{ displayText: t('home.adjust-contrast.title'), icon: BsPalette, dest: "/nothing-here", tooltip: t('home.adjust-contrast.desc') },
|
{ displayText: t('home.adjust-contrast.title'), icon: BsPalette, dest: "/nothing-here", tooltip: t('home.adjust-contrast.desc') },
|
||||||
{ displayText: t('home.crop.title'), icon: BiCrop, dest: "/nothing-here", tooltip: t('home.crop.desc') },
|
{ displayText: t('home.crop.title'), icon: BiCrop, dest: "/nothing-here", tooltip: t('home.crop.desc') },
|
||||||
@ -110,7 +105,7 @@ function NavBar() {
|
|||||||
{ displayText: t('home.permissions.title'), icon: BsShieldLock, dest: "/nothing-here", tooltip: t('home.permissions.desc') },
|
{ displayText: t('home.permissions.title'), icon: BsShieldLock, dest: "/nothing-here", tooltip: t('home.permissions.desc') },
|
||||||
{ displayText: t('home.watermark.title'), icon: BsDroplet, dest: "/nothing-here", tooltip: t('home.watermark.desc') },
|
{ displayText: t('home.watermark.title'), icon: BsDroplet, dest: "/nothing-here", tooltip: t('home.watermark.desc') },
|
||||||
{ displayText: t('home.certSign.title'), icon: BsAward, dest: "/nothing-here", tooltip: t('home.certSign.desc') },
|
{ displayText: t('home.certSign.title'), icon: BsAward, dest: "/nothing-here", tooltip: t('home.certSign.desc') },
|
||||||
{ displayText: t('home.sanitizePdf.title'), icon: TfiSpray, dest: "/nothing-here", tooltip: t('home.sanitizePdf.desc') },
|
{ displayText: t('home.sanitizePdf.title'), icon: BiSprayCan, dest: "/nothing-here", tooltip: t('home.sanitizePdf.desc') },
|
||||||
{ displayText: t('home.autoRedact.title'), icon: BsEraserFill, dest: "/nothing-here", tooltip: t('home.autoRedact.desc') },
|
{ displayText: t('home.autoRedact.title'), icon: BsEraserFill, dest: "/nothing-here", tooltip: t('home.autoRedact.desc') },
|
||||||
]},
|
]},
|
||||||
{displayText: t('navbar.other'), icon: BsCardList, sublist: [
|
{displayText: t('navbar.other'), icon: BsCardList, sublist: [
|
||||||
@ -121,11 +116,11 @@ function NavBar() {
|
|||||||
{ displayText: t('home.changeMetadata.title'), icon: BsClipboardData, dest: "/nothing-here", tooltip: t('home.changeMetadata.desc') },
|
{ displayText: t('home.changeMetadata.title'), icon: BsClipboardData, dest: "/nothing-here", tooltip: t('home.changeMetadata.desc') },
|
||||||
{ displayText: t('home.ScannerImageSplit.title'), icon: MdOutlineScanner, dest: "/nothing-here", tooltip: t('home.ScannerImageSplit.desc') },
|
{ displayText: t('home.ScannerImageSplit.title'), icon: MdOutlineScanner, dest: "/nothing-here", tooltip: t('home.ScannerImageSplit.desc') },
|
||||||
{ displayText: t('home.sign.title'), icon: BsVectorPen, dest: "/nothing-here", tooltip: t('home.sign.desc') },
|
{ displayText: t('home.sign.title'), icon: BsVectorPen, dest: "/nothing-here", tooltip: t('home.sign.desc') },
|
||||||
{ displayText: t('home.flatten.title'), icon: PiArrowsInLineVertical, dest: "/nothing-here", tooltip: t('home.flatten.desc') },
|
{ displayText: t('home.flatten.title'), icon: BsArrowsCollapse, dest: "/nothing-here", tooltip: t('home.flatten.desc') },
|
||||||
{ displayText: t('home.repair.title'), icon: BsWrench, dest: "/nothing-here", tooltip: t('home.repair.desc') },
|
{ displayText: t('home.repair.title'), icon: BsWrench, dest: "/nothing-here", tooltip: t('home.repair.desc') },
|
||||||
{ displayText: t('home.removeBlanks.title'), icon: BsFile, dest: "/nothing-here", tooltip: t('home.removeBlanks.desc') },
|
{ displayText: t('home.removeBlanks.title'), icon: BsFile, dest: "/nothing-here", tooltip: t('home.removeBlanks.desc') },
|
||||||
{ displayText: t('home.compare.title'), icon: GiScales, dest: "/nothing-here", tooltip: t('home.compare.desc') },
|
{ displayText: t('home.compare.title'), icon: MdOutlineBalance, dest: "/nothing-here", tooltip: t('home.compare.desc') },
|
||||||
{ displayText: t('home.add-page-numbers.title'), icon: TbNumbers, dest: "/nothing-here", tooltip: t('home.add-page-numbers.desc') },
|
{ displayText: t('home.add-page-numbers.title'), icon: Bs123, dest: "/nothing-here", tooltip: t('home.add-page-numbers.desc') },
|
||||||
{ displayText: t('home.auto-rename.title'), icon: BsFonts, dest: "/nothing-here", tooltip: t('home.auto-rename.desc') },
|
{ displayText: t('home.auto-rename.title'), icon: BsFonts, dest: "/nothing-here", tooltip: t('home.auto-rename.desc') },
|
||||||
{ displayText: t('home.getPdfInfo.title'), icon: BsInfoCircle, dest: "/nothing-here", tooltip: t('home.getPdfInfo.desc') },
|
{ displayText: t('home.getPdfInfo.title'), icon: BsInfoCircle, dest: "/nothing-here", tooltip: t('home.getPdfInfo.desc') },
|
||||||
{ displayText: t('home.showJS.title'), icon: BsFiletypeJs, dest: "/nothing-here", tooltip: t('home.showJS.desc') },
|
{ displayText: t('home.showJS.title'), icon: BsFiletypeJs, dest: "/nothing-here", tooltip: t('home.showJS.desc') },
|
||||||
@ -134,18 +129,6 @@ function NavBar() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Navbar expand="lg" className="bg-light">
|
<Navbar expand="lg" className="bg-light">
|
||||||
<Container>
|
<Container>
|
||||||
@ -157,28 +140,30 @@ function NavBar() {
|
|||||||
</LinkContainer>
|
</LinkContainer>
|
||||||
<Navbar.Toggle aria-controls="basic-navbar-nav"/>
|
<Navbar.Toggle aria-controls="basic-navbar-nav"/>
|
||||||
<Navbar.Collapse id="basic-navbar-nav">
|
<Navbar.Collapse id="basic-navbar-nav">
|
||||||
|
|
||||||
<Nav>
|
<Nav>
|
||||||
{navInfo.map((ni, idx) => {
|
{navInfo.map((ni, idx) => {
|
||||||
var element;
|
var element;
|
||||||
if ('dest' in ni) {
|
if ('dest' in ni) {
|
||||||
element = convertToNavLink(ni, idx);
|
element = convertToNavLink(ni, idx);
|
||||||
} else {
|
} else {
|
||||||
element = convertToNavDropdown(ni);
|
element = convertToNavDropdown(ni, idx);
|
||||||
}
|
}
|
||||||
|
const out: JSX.Element[] = [];
|
||||||
if (idx >= 1 ) {
|
if (idx >= 1 ) {
|
||||||
return (<>
|
out.push( <div className="nav-item nav-item-separator" key={"nav-item-separator-"+idx}></div> );
|
||||||
<li className="nav-item nav-item-separator"></li>
|
|
||||||
{element}
|
|
||||||
</>)
|
|
||||||
} else {
|
|
||||||
return element;
|
|
||||||
}
|
}
|
||||||
|
out.push(element);
|
||||||
|
return out;
|
||||||
})}
|
})}
|
||||||
</Nav>
|
</Nav>
|
||||||
|
|
||||||
<div className="flex-fill-remaining-space"></div>
|
<div className="flex-fill-remaining-space"></div>
|
||||||
|
|
||||||
<Nav>
|
<Nav>
|
||||||
<LanguagePicker />
|
<LanguagePicker />
|
||||||
</Nav>
|
</Nav>
|
||||||
|
|
||||||
</Navbar.Collapse>
|
</Navbar.Collapse>
|
||||||
</Container>
|
</Container>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
|
Loading…
Reference in New Issue
Block a user