-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a48b30
commit 2e184fb
Showing
9 changed files
with
166 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
<div> | ||
<label | ||
for="dxfFiles" | ||
class="flex flex-col items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer hover:border-gray-400 transition duration-300 ease-in-out focus:outline-none focus:ring-2 focus:ring-black" | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
class="w-12 h-12 text-black" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
stroke-width="2" | ||
> | ||
<path | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
d="M12 4v16m8-8H4" | ||
/> | ||
</svg> | ||
<span class="mt-2 text-l text-black"> | ||
Drag & drop or click to upload DXF files | ||
</span> | ||
</label> | ||
<input | ||
type="file" | ||
id="dxfFiles" | ||
name="dxf" | ||
accept=".dxf" | ||
multiple | ||
@change="onDXFChange" | ||
class="hidden" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "DxfUpload", | ||
methods: { | ||
onDXFChange(event) { | ||
const files = Array.from(event.target.files); | ||
this.$emit("files", files); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,5 @@ | ||
<template> | ||
<div class="container mx-auto p-4"> | ||
<div | ||
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6" | ||
> | ||
<div v-if="pending" class="col-span-full text-center text-gray-500"> | ||
Loading projects... | ||
</div> | ||
|
||
<UploadProjectCard /> | ||
|
||
<ProjectGridItem | ||
v-for="project in data.projects" | ||
:key="project.slug" | ||
:imageSrc="project.imageUrl" | ||
:imageAlt="project.projectName" | ||
:text="project.projectName" | ||
/> | ||
</div> | ||
</div> | ||
<h2>index page</h2> | ||
</template> | ||
|
||
<script setup> | ||
import { useFetch } from "#app"; | ||
const { data, pending } = useFetch("/api/projects"); | ||
</script> | ||
|
||
<style scoped></style> | ||
<script></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<div class="container mx-auto p-4"> | ||
<h2 class="text-3xl font-semibold text-center text-black">Project</h2> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useRoute } from "vue-router"; | ||
import { useFetch } from "#app"; | ||
const route = useRoute(); | ||
const slug = route.params.slug; | ||
console.log(slug); | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<div class="container mx-auto p-4"> | ||
<div | ||
class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6" | ||
> | ||
<div v-if="pending" class="col-span-full text-center text-gray-500"> | ||
Loading projects... | ||
</div> | ||
|
||
<UploadProjectCard /> | ||
|
||
<ProjectGridItem | ||
v-for="project in data.projects" | ||
:key="project.slug" | ||
:imageSrc="project.imageUrl" | ||
:imageAlt="project.projectName" | ||
:text="project.projectName" | ||
/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useFetch } from "#app"; | ||
const { data, pending } = useFetch("/api/projects"); | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { connectDB } from "~~/server/db/mongo"; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const slug = getRouterParam(event, "slug"); | ||
|
||
const db = await connectDB(); | ||
const project = await db.collection("projects_v2").findOne({ slug: slug }); | ||
|
||
if (!project) { | ||
return { statusCode: 404, body: { error: "Project not found" } }; | ||
} | ||
|
||
const response = { | ||
projectName: project.projectName, | ||
}; | ||
|
||
event.node.res.setHeader("Content-Type", "image/jpeg"); | ||
return project.image.buffer; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { connectDB } from "~~/server/db/mongo"; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const slug = getRouterParam(event, "slug"); | ||
|
||
const db = await connectDB(); | ||
const project = await db.collection("projects_v2").findOne({ slug: slug }); | ||
|
||
if (!project) { | ||
return { statusCode: 404, body: { error: "Project not found" } }; | ||
} | ||
|
||
event.node.res.setHeader("Content-Type", "image/jpeg"); | ||
return project.image.buffer; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters