Skip to content

Commit 1c978f6

Browse files
aramb-devCopilot
andcommitted
refactor(core): remove printerz proxy and unused pdf dependencies
Remove the Printerz API proxy route, server-side endpoint, and local PDF generation logic. This includes cleaning up associated environment variables and removing unused dependencies like jspdf and pdfmake. - Delete `src/app/api/printerz-proxy/route.ts` and `src/lib/pdf-generation.ts` - Remove `/api/printerz/render` endpoint from `src/server/index.ts` - Clean up `package.json` and `.env.example` - Simplify `EnhancedTranscript` and `ErrorState` components by removing unnecessary lint suppressions and logic complexity Co-authored-by: Copilot <copilot@github.com>
1 parent 750553e commit 1c978f6

10 files changed

Lines changed: 3 additions & 594 deletions

File tree

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@ NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
66
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
77
NEXT_PUBLIC_FIREBASE_APP_ID=
88

9-
PRINTERZ_API_KEY=
109
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
1110
NEXT_PUBLIC_MICROSOFT_CLARITY_ID=
12-
NEXT_PUBLIC_PRINTERZ_TEMPLATE_ID=

bun.lock

Lines changed: 0 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@
3939
"file-saver": "^2.0.5",
4040
"firebase": "^12.12.1",
4141
"framer-motion": "^12.38.0",
42-
"jspdf": "^4.2.1",
43-
"jspdf-autotable": "^5.0.7",
4442
"jszip": "^3.10.1",
4543
"lucide-react": "^1.11.0",
4644
"marked": "^18.0.2",
4745
"motion": "^12.38.0",
4846
"next": "^16.2.4",
4947
"next-themes": "^0.4.6",
5048
"node-fetch": "^3.3.2",
51-
"pdfmake": "^0.3.7",
5249
"radix-ui": "^1.4.3",
5350
"react": "^19.2.5",
5451
"react-confetti": "^6.4.0",
@@ -72,7 +69,6 @@
7269
"@types/file-saver": "^2.0.7",
7370
"@types/marked": "^6.0.0",
7471
"@types/node": "^25.6.0",
75-
"@types/pdfmake": "^0.3.2",
7672
"@types/react": "^19.2.14",
7773
"@types/react-dom": "^19.2.3",
7874
"@types/uuid": "^11.0.0",

src/app/api/printerz-proxy/route.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/components/errors/ErrorState.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export function ErrorState({
132132
<CardContent className="space-y-3">
133133
{hints.map((hint, index) => (
134134
<div
135-
// biome-ignore lint/suspicious/noArrayIndexKey: hints are static strings with no stable identity
136135
key={index}
137136
className="border-border/70 bg-background rounded-xl border px-4 py-3"
138137
>

src/components/studio/EnhancedTranscript.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ export const EnhancedTranscript: React.FC<EnhancedTranscriptProps> = ({
8181
})
8282
setSearchResults(results)
8383
} else if (term.trim() && !segments && transcription) {
84-
const matches = transcription.match(
85-
new RegExp(escapeRegExp(term), "gi"),
86-
)
84+
const matches = transcription.match(new RegExp(escapeRegExp(term), "gi"))
8785
setSearchResults(
8886
matches ? Array.from({ length: matches.length }, (_, i) => i) : [],
8987
)
@@ -292,15 +290,14 @@ export const EnhancedTranscript: React.FC<EnhancedTranscriptProps> = ({
292290
.split(new RegExp(`(${escapeRegExp(searchTerm)})`, "gi"))
293291
.map((part, i) =>
294292
part.toLowerCase() === searchTerm.toLowerCase() ? (
295-
// biome-ignore lint/suspicious/noArrayIndexKey: split parts have no stable identity
296293
<mark key={i} className="rounded bg-yellow-200 px-1">
297294
{part}
298295
</mark>
299296
) : (
300297
part
301298
),
302299
)
303-
: (transcription || "No transcript available")}
300+
: transcription || "No transcript available"}
304301
</div>
305302
</div>
306303
</div>

src/lib/firebase-proxy.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { toast } from "sonner"
2-
31
/**
42
* Utility functions for Firebase Storage and PDF generation
53
*/
@@ -31,44 +29,6 @@ export async function proxyFirebaseDownload(url: string): Promise<Blob> {
3129
}
3230
}
3331

34-
/**
35-
* Generate PDF using Printerz service
36-
*/
37-
export async function generatePdf(
38-
templateId: string,
39-
data: Record<string, unknown>,
40-
): Promise<Blob> {
41-
try {
42-
// Determine server URL based on environment
43-
const serverUrl = determineServerUrl()
44-
45-
console.log(
46-
`Generating PDF with template ${templateId} via ${serverUrl}/api/printerz/render`,
47-
)
48-
49-
const response = await fetch(`${serverUrl}/api/printerz/render`, {
50-
method: "POST",
51-
headers: {
52-
"Content-Type": "application/json",
53-
},
54-
body: JSON.stringify({
55-
templateId,
56-
printerzData: data,
57-
}),
58-
})
59-
60-
if (!response.ok) {
61-
toast.error("Failed to generate PDF")
62-
throw new Error(`PDF generation failed with status: ${response.status}`)
63-
}
64-
65-
return await response.blob()
66-
} catch (error) {
67-
console.error("Error generating PDF:", error)
68-
throw error
69-
}
70-
}
71-
7232
/**
7333
* Helper function to determine the correct server URL based on environment
7434
*/

0 commit comments

Comments
 (0)