Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- name: Setup Biome
uses: biomejs/setup-biome@v2
with:
version: latest
version: 2.1.1
- name: Run Biome
run: biome ci .
14 changes: 12 additions & 2 deletions components/ordercontainer/PackageOrder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ import type { IAddOrder } from "../../types/helper";
import CartItem from "../../types/models/CartItem";
import ProductCard from "../productcard/ProductCard";

type DisplayPackage = {
name: string;
id: string;
default_price: string;
description: string;
price: number;
features: { name: string }[];
updated: string | number;
};

type Props = {
displayPackages: any;
displayPackages: DisplayPackage[];
smallScreen: boolean;
};

Expand All @@ -25,7 +35,7 @@ const PackageOrder = ({ displayPackages, smallScreen }: Props) => {
<Box display="flex" flexDir="column" gap="1rem">
<Heading textAlign="center">Choose a Package</Heading>
<Box display="grid" gridTemplateColumns={smallScreen ? "1fr" : "1fr 1fr"}>
{displayPackages?.map((displayPackage: any) => {
{displayPackages?.map((displayPackage: DisplayPackage) => {
const { name, id, default_price, description, price, features } =
displayPackage;
return (
Expand Down
4 changes: 3 additions & 1 deletion lib/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export const authenticateGoogle = () => {
return auth;
};
//adapted from https://gist.github.com/iaincollins/43302ea047d4a77e6605350598d160c1
export const appendToSpreadSheet = async (toAppend: any[][]) => {
export const appendToSpreadSheet = async (
toAppend: (string | number | boolean | null | undefined)[][],
) => {
const auth = authenticateGoogle();
const sheets = google.sheets("v4");

Expand Down
2 changes: 1 addition & 1 deletion lib/nodemailer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "node:path";
import nodemailer from "nodemailer";
import path from "path";
import pug from "pug";

const transporter = nodemailer.createTransport({
Expand Down
10 changes: 6 additions & 4 deletions lib/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ export const createSession = async (
}),
...(coupon === undefined && { allow_promotion_codes: true }),

success_url: `${process.env
.STRIPE_SUCCESS_URL!}?session_id={CHECKOUT_SESSION_ID}`,
success_url: `${
process.env.STRIPE_SUCCESS_URL
}?session_id={CHECKOUT_SESSION_ID}`,
customer_email: email,
cancel_url: `${process.env
.STRIPE_CANCEL_URL!}?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${
process.env.STRIPE_CANCEL_URL
}?session_id={CHECKOUT_SESSION_ID}`,
metadata: {
orderId: orderId,
[CUSTOMER_FRIENDLY_STRIPE_ITEMS_KEY]: JSON.stringify(
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/bankTransfer.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ p Price: #{price}
p If you wish to continue with your order please transfer #{price} to 02-0112-0140104-04 with the reference #{orderId}. Please put Ryan Guo as the Payee Name.

p Afterwards, please pick a time to pick up your order here:
a(href="https://calendly.com/ryanguo02/printing-pick-up") https://calendly.com/ryanguo02/printing-pickup
a(href="https://calendly.com/ryanguo02/printing-pickup") https://calendly.com/ryanguo02/printing-pickup
p If you have any issues or queries, please email us at
a(href="mailto:primalprintingnz@gmail.com") primalprintingnz@gmail.com
| or text us on 02108678038
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/creditCard.pug
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ p for the items
p #{items}

p The next step is to pick a collection time for your order using this link:
a(href="https://calendly.com/ryanguo02/printing-pick-up") https://calendly.com/ryanguo02/printing-pickup
a(href="https://calendly.com/ryanguo02/printing-pickup") https://calendly.com/ryanguo02/printing-pickup

p If you have any issues, email us at
a(href="mailto:primalprintingnz@gmail.com") primalprintingnz@gmail.com
Expand Down
8 changes: 4 additions & 4 deletions pages/api/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import type { NextApiRequest, NextApiResponse } from "next";
import { z } from "zod";
import { findPrice, getPackages } from "../../lib/stripe";

const ProductsSchema = z.object({}); // No specific input expected for this handler
const _ProductsSchema = z.object({}); // No specific input expected for this handler

export default async function handler(
_req: NextApiRequest,
res: NextApiResponse,
) {
try {
const packages = await getPackages();

await Promise.all(
packages.data.map(async (pack) => {
if (!pack.default_price) {
throw new Error("Package default price is missing");
}
const price = await findPrice(pack.default_price.toString());
(pack as any).price = price; // Temporarily cast to any to add price property
(pack as unknown as { price: number | null }).price = await findPrice(
pack.default_price.toString(),
);
}),
);

Expand Down
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ By Students, For Students🚀💯"
return (
<Text
key={item._id}
// biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
// biome-ignore lint/security/noDangerouslySetInnerHtml: need to do this to allow for newlines in the text from the database
dangerouslySetInnerHTML={{
__html: item.Text,
}}
Expand Down