Skip to content

Commit 64d4c6e

Browse files
remove unnessary code
1 parent afa8ae9 commit 64d4c6e

File tree

6 files changed

+6
-96
lines changed

6 files changed

+6
-96
lines changed

app/api/upload/route.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export async function POST(req: Request) {
4141
(err, result) => {
4242
if (err || !result) return reject(err);
4343
resolve(result);
44-
}
44+
},
4545
);
4646
uploadStream.end(buffer);
47-
}
47+
},
4848
);
4949

5050
const svgString = await cloudinaryToSVG(cloudinaryResponse.secure_url);
@@ -55,14 +55,14 @@ export async function POST(req: Request) {
5555
svg: svgString,
5656
success: true,
5757
},
58-
{ status: 201 }
58+
{ status: 201 },
5959
);
6060
} catch (err: unknown) {
6161
console.error("Upload error:", err);
6262
const errorMessage = (err as Error)?.message || "Internal Server Error";
6363
return NextResponse.json(
6464
{ success: false, error: errorMessage },
65-
{ status: 500 }
65+
{ status: 500 },
6666
);
6767
}
6868
}

app/api/users/route.ts

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

app/api/works/route.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export async function GET(request: NextRequest) {
1010

1111
const supabase = await createClient();
1212

13-
// Get the current user
1413
const {
1514
data: { user },
1615
error: authError,
@@ -20,7 +19,6 @@ export async function GET(request: NextRequest) {
2019
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
2120
}
2221

23-
// Fetch works for the current user
2422
const { data: works, error: worksError } = await supabase
2523
.from("works")
2624
.select("*")
@@ -36,7 +34,6 @@ export async function GET(request: NextRequest) {
3634
);
3735
}
3836

39-
// Get total count for pagination
4037
const { count, error: countError } = await supabase
4138
.from("works")
4239
.select("*", { count: "exact", head: true })

app/generate/page.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export default function UploadPage() {
166166
updateProgress(100);
167167

168168
if (data.success && data.svg) {
169-
setSvgResult(fixSvg(data.svg));
169+
setSvgResult(data.svg);
170170
} else {
171171
setError(data.error || "Failed to convert image to SVG");
172172
}
@@ -215,32 +215,6 @@ export default function UploadPage() {
215215
URL.revokeObjectURL(url);
216216
};
217217

218-
const fixSvg = (svg: string) => {
219-
// get width/height
220-
const widthMatch = svg.match(/width="(\d+)"/);
221-
const heightMatch = svg.match(/height="(\d+)"/);
222-
223-
if (widthMatch && heightMatch) {
224-
const width = widthMatch[1];
225-
const height = heightMatch[1];
226-
227-
// make width/height to 100%
228-
svg = svg
229-
.replace(/width="[^"]*"/, 'width="100%"')
230-
.replace(/height="[^"]*"/, 'height="100%"');
231-
232-
// add viewBox if missing
233-
if (!/viewBox=/.test(svg)) {
234-
svg = svg.replace(
235-
/<svg([^>]*)>/,
236-
`<svg$1 viewBox="0 0 ${width} ${height}">`,
237-
);
238-
}
239-
}
240-
241-
return svg;
242-
};
243-
244218
return (
245219
<section className="relative overflow-hidden bg-zinc-50 dark:bg-neutral-900/80 min-h-screen py-12 px-4">
246220
{/* Accent Corner Lines */}

components/Collections/WorkCard.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@ export function WorkCard({ work, onDownload, onView }: WorkCardProps) {
6060
/>
6161
<div className="absolute inset-0 bg-gradient-to-b from-transparent to-black/2 opacity-0 group-hover:opacity-30 transition-opacity" />
6262

63-
{/* Status badges */}
64-
<div className="absolute top-3 left-3 flex gap-2">
65-
{work.svg_data && (
66-
<Badge className="text-xs bg-emerald-100 dark:bg-violet-900/30 text-emerald-700 dark:text-violet-300 border-0 px-2 py-1">
67-
<Code className="mr-1 h-3 w-3" />
68-
Ready
69-
</Badge>
70-
)}
71-
</div>
72-
7363
{/* Action buttons - visible on hover */}
7464
<div className="absolute top-3 right-3 flex gap-2 opacity-0 group-hover:opacity-100 transition-all duration-200">
7565
<Button

components/Collections/WorkViewer.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,6 @@ export function WorkViewer({
6565
}
6666
};
6767

68-
const fixSvg = (svg: string) => {
69-
// get width/height
70-
const widthMatch = svg.match(/width="(\d+)"/);
71-
const heightMatch = svg.match(/height="(\d+)"/);
72-
73-
if (widthMatch && heightMatch) {
74-
const width = widthMatch[1];
75-
const height = heightMatch[1];
76-
77-
// make width/height to 100%
78-
svg = svg
79-
.replace(/width="[^"]*"/, 'width="100%"')
80-
.replace(/height="[^"]*"/, 'height="100%"');
81-
82-
// add viewBox if missing
83-
if (!/viewBox=/.test(svg)) {
84-
svg = svg.replace(
85-
/<svg([^>]*)>/,
86-
`<svg$1 viewBox="0 0 ${width} ${height}">`,
87-
);
88-
}
89-
}
90-
91-
return svg;
92-
};
93-
9468
return (
9569
<AnimatePresence>
9670
{isOpen && (
@@ -187,7 +161,7 @@ export function WorkViewer({
187161
<div
188162
className="w-full h-full p-2 flex items-center justify-center"
189163
dangerouslySetInnerHTML={{
190-
__html: fixSvg(work.svg_data),
164+
__html: work.svg_data,
191165
}}
192166
/>
193167
) : (

0 commit comments

Comments
 (0)