-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* * Create app router directory structure * Added pages and root layout * Temp made all components client as 1st migration step * Renamed conflicting pages from pages router to *2 Ran locally and checked all pages load. migrate all linked pages to app router * Create a SC route for products (#602) * Uploaded hardware db to vercel postgres * Created producs-sc page with SC Co-authored-by: Luke Munro <[email protected]> * added vercel tracing target * added vercel tracing target * updated sentry import to nextjs * removed withProfiler from about page * Reconfigure layout (#606) * Migrate layout to server * fix a bunch of crap (#607) * upgrade to next 15 * commented out session storage * commented out crasher * Moved some files and implemented naming conventions * moved some css around to fix styling * more refactor * accidently removed dynamic export * trying to disable vercel cache --------- Co-authored-by: Luke Munro <[email protected]> Co-authored-by: Luca Forstner <[email protected]> Co-authored-by: Aidan Landen <[email protected]> --------- Co-authored-by: Luke Munro <[email protected]> Co-authored-by: Aidan Landen <[email protected]> Co-authored-by: Luca Forstner <[email protected]> Co-authored-by: Aidan Landen <[email protected]>
- Loading branch information
1 parent
4b4d2c4
commit 6353b7c
Showing
41 changed files
with
4,229 additions
and
4,365 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 |
---|---|---|
|
@@ -8,6 +8,7 @@ next/node_modules | |
express/node_modules | ||
/.pnp | ||
.pnp.js | ||
.vercel | ||
|
||
# testing | ||
/coverage | ||
|
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 @@ | ||
.vercel |
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
'use client' // Error boundaries must be Client Components | ||
|
||
export default function GlobalError({ error, reset }) { | ||
return ( | ||
// global-error must include html and body tags | ||
<html> | ||
<body> | ||
<h2>Something went wrong!</h2> | ||
<button onClick={() => reset()}>Try again</button> | ||
</body> | ||
</html> | ||
) | ||
} |
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,66 @@ | ||
import { sql } from "@vercel/postgres"; | ||
|
||
import { PrismaClient } from '@prisma/client'; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
// export type Product = { | ||
// id: number; | ||
// description: string; | ||
// descriptionfull: string; | ||
// price: number; | ||
// img: string; | ||
// imgcropped: string; | ||
// reviews: Review[] | []; | ||
// } | ||
|
||
// export type Review = { | ||
// id: number; | ||
// productid: number; | ||
// rating: number; | ||
// customerid: string; | ||
// description: string; | ||
// created: string; | ||
// } | ||
|
||
|
||
export default async function getProducts() { | ||
try { | ||
console.log("Fetching products..."); | ||
// Artificial slowdown for demoing | ||
await new Promise((resolve) => setTimeout(resolve, 2000)); | ||
|
||
const products = await prisma.products.findMany(); | ||
// const products = data.rows; | ||
|
||
for (let i = 0; i < products.length; ++i) { | ||
|
||
const product_reviews = await prisma.reviews.findMany({ | ||
where: { id: i }, | ||
}); | ||
|
||
products[i].reviews = product_reviews; | ||
} | ||
console.log("products: ", products); | ||
return products; | ||
} catch (error) { | ||
console.error("Database Error:", error) | ||
// do sentry stuff | ||
} | ||
|
||
|
||
async function getReview(i) { | ||
try { | ||
const data = await sql`SELECT * from reviews WHERE productId=${i}`; | ||
console.log(data.rows); | ||
return data.rows; | ||
} catch (error) { | ||
console.error("Db error", error); | ||
} | ||
} | ||
} | ||
|
||
export async function getProductsPrisma() { | ||
const products = await prisma.products.findMany(); | ||
console.log("prisma", products); | ||
} |
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
Oops, something went wrong.