From bdacf7940e36e9f511687d9ba12595239c01e73e Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Sun, 2 Aug 2026 17:34:16 +0530 Subject: [PATCH 1/2] fix: code quality and safety improvements --- src/hooks/useSubscription.js | 2 +- src/pages/Home/components/VisitorBadge.jsx | 2 +- src/pages/PageNumbers/PageNumbers.jsx | 2 +- src/pages/Split/Split.jsx | 2 +- src/pages/Watermark/Watermark.jsx | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hooks/useSubscription.js b/src/hooks/useSubscription.js index 34ebc9b..88474e7 100644 --- a/src/hooks/useSubscription.js +++ b/src/hooks/useSubscription.js @@ -8,7 +8,7 @@ const LS_KEY = "quickpdf_usage"; const USERS = "users"; function getLocalUsage() { - const n = parseInt(localStorage.getItem(LS_KEY), 10); + const n = parseInt(localStorage.getItem(LS_KEY, 10), 10); return isNaN(n) ? 0 : n; } diff --git a/src/pages/Home/components/VisitorBadge.jsx b/src/pages/Home/components/VisitorBadge.jsx index f36dee6..474f6f3 100644 --- a/src/pages/Home/components/VisitorBadge.jsx +++ b/src/pages/Home/components/VisitorBadge.jsx @@ -70,7 +70,7 @@ function OdometerDisplay({ value }) { , ) : ( - + ) )} diff --git a/src/pages/PageNumbers/PageNumbers.jsx b/src/pages/PageNumbers/PageNumbers.jsx index 601b7ea..ea942c5 100644 --- a/src/pages/PageNumbers/PageNumbers.jsx +++ b/src/pages/PageNumbers/PageNumbers.jsx @@ -216,7 +216,7 @@ export function PageNumbers() { value={startNumber} min={0} max={9999} - onChange={(e) => setStartNumber(Math.max(0, parseInt(e.target.value) || 0))} + onChange={(e) => setStartNumber(Math.max(0, parseInt(e.target.value, 10) || 0))} className="w-full h-11 px-4 bg-zinc-900/60 border border-white/10 rounded-xl text-sm text-white focus:outline-none focus:border-white/30 transition-colors" /> diff --git a/src/pages/Split/Split.jsx b/src/pages/Split/Split.jsx index 0df4eac..b437a9a 100644 --- a/src/pages/Split/Split.jsx +++ b/src/pages/Split/Split.jsx @@ -56,7 +56,7 @@ export function Split() { try { setIsProcessing(true); setError(null); - const splitBlob = await splitPdf(file, parseInt(range.start), parseInt(range.end)); + const splitBlob = await splitPdf(file, parseInt(range.start, 10), parseInt(range.end, 10)); const url = URL.createObjectURL(splitBlob); const link = document.createElement("a"); link.href = url; diff --git a/src/pages/Watermark/Watermark.jsx b/src/pages/Watermark/Watermark.jsx index 22574e5..35979f3 100644 --- a/src/pages/Watermark/Watermark.jsx +++ b/src/pages/Watermark/Watermark.jsx @@ -258,7 +258,7 @@ export function Watermark() { {watermarkMode === "text" && (
- updateOption("fontSize", parseInt(e.target.value))} className="w-full h-1.5 bg-zinc-800 rounded-lg appearance-none cursor-pointer accent-white" /> + updateOption("fontSize", parseInt(e.target.value, 10))} className="w-full h-1.5 bg-zinc-800 rounded-lg appearance-none cursor-pointer accent-white" />
)} {watermarkMode === "image" && ( @@ -278,7 +278,7 @@ export function Watermark() {
- updateOption("rotation", parseInt(e.target.value))} className="w-full h-1.5 bg-zinc-800 rounded-lg appearance-none cursor-pointer accent-white" /> + updateOption("rotation", parseInt(e.target.value, 10))} className="w-full h-1.5 bg-zinc-800 rounded-lg appearance-none cursor-pointer accent-white" />
@@ -287,7 +287,7 @@ export function Watermark() { updateOption("offsetX", parseInt(e.target.value) || 0)} + onChange={(e) => updateOption("offsetX", parseInt(e.target.value, 10) || 0)} className="w-full h-10 px-3 bg-black border border-white/10 text-white rounded-lg outline-none focus:ring-1 focus:ring-white/20" />
@@ -296,7 +296,7 @@ export function Watermark() { updateOption("offsetY", parseInt(e.target.value) || 0)} + onChange={(e) => updateOption("offsetY", parseInt(e.target.value, 10) || 0)} className="w-full h-10 px-3 bg-black border border-white/10 text-white rounded-lg outline-none focus:ring-1 focus:ring-white/20" /> From 7a56fed000249b7728bf3fadb829ac270ff65384 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 3 Aug 2026 00:22:31 +0530 Subject: [PATCH 2/2] fix: additional real bug fixes --- src/pages/PageNumbers/PageNumbers.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/PageNumbers/PageNumbers.jsx b/src/pages/PageNumbers/PageNumbers.jsx index ea942c5..f5cc413 100644 --- a/src/pages/PageNumbers/PageNumbers.jsx +++ b/src/pages/PageNumbers/PageNumbers.jsx @@ -157,7 +157,7 @@ export function PageNumbers() {
- {POSITIONS.map(({ value, label }) => ( + {(POSITIONS ?? []).map(({ value, label }) => (