From ca71b8ed2dd33cbdb8bbed056e434d0b356c8fc9 Mon Sep 17 00:00:00 2001 From: SwiichyCode Date: Sat, 23 Mar 2024 15:41:34 +0100 Subject: [PATCH] . --- package-lock.json | 54 ++++++------- package.json | 2 +- prettier.config.js | 1 - prisma/schema.prisma | 17 +---- src/app/admin/payments/[id]/page.tsx | 11 ++- .../components/OrderStatusSelect/index.tsx | 40 ++++++++++ .../Admin/components/common/AdminLogo.tsx | 8 +- .../Admin/components/layouts/Sidebar.tsx | 4 +- src/features/Admin/types/payment.type.ts | 76 ++++++++++--------- src/server/db.ts | 8 +- 10 files changed, 130 insertions(+), 91 deletions(-) create mode 100644 src/features/Admin/components/OrderStatusSelect/index.tsx diff --git a/package-lock.json b/package-lock.json index 54d439a..9623f06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "lucide-react": "^0.304.0", "next": "^14.0.4", "next-auth": "^4.24.5", - "next-safe-action": "^6.0.1", + "next-safe-action": "^6.0.2", "react": "18.2.0", "react-beautiful-dnd": "^13.1.1", "react-dom": "18.2.0", @@ -9193,11 +9193,11 @@ } }, "node_modules/next-safe-action": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/next-safe-action/-/next-safe-action-6.0.1.tgz", - "integrity": "sha512-iXkjorrUrz3sHMo1MVdBx5WzcCGktrBe+XqMfBav++eegXMdOkZB2+LqUTPXmaidv0lo+/fSRLOcNmr/S9IqTw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/next-safe-action/-/next-safe-action-6.0.2.tgz", + "integrity": "sha512-czJrcw4Ov6obePv/AwUki+Z90xxFH6Gx9V5cBN/TU/cuEggxj151kTggo0h1fAiYqZEOxw5PRbDvutvm9/exaw==", "dependencies": { - "@decs/typeschema": "^0.12.1" + "@decs/typeschema": "^0.12.2" }, "engines": { "node": ">=18.17" @@ -9211,34 +9211,31 @@ } }, "node_modules/next-safe-action/node_modules/@decs/typeschema": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/@decs/typeschema/-/typeschema-0.12.1.tgz", - "integrity": "sha512-PhoCbaJ6T+9EfvUkemgYVnNfLmLoP2+Aa5yvQ3sIzH4fmIgDEFPGSRPuaTO04c99sqLeKuhHEY+WLzNubGABOA==", - "peerDependencies": { - "@deepkit/type": "^1.0.1-alpha.97", - "@effect/data": "^0.18.6", - "@effect/schema": "^0.36.5", - "@sinclair/typebox": "^0.31.15", + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@decs/typeschema/-/typeschema-0.12.2.tgz", + "integrity": "sha512-PA8uAH/Xfsa5X2UNNSnb5i6vB8qWZywp4+d2U8kNMCO7qwirYRPbFCHwIfWBJyURh4rULn3Ey+VBADLcK2xxaQ==", + "peerDependencies": { + "@deepkit/type": "^1.0.1-alpha.113", + "@effect/schema": "^0.60.6", + "@sinclair/typebox": "^0.32.11", "ajv": "^8.12.0", - "arktype": "^1.0.21-alpha", - "fp-ts": "^2.16.1", - "io-ts": "^2.2.20", - "joi": "^17.10.2", + "arktype": "^1.0.29-alpha", + "effect": "^2.1.2", + "fp-ts": "^2.16.2", + "io-ts": "^2.2.21", + "joi": "^17.12.0", "ow": "^0.28.2", "runtypes": "^6.7.0", "superstruct": "^1.0.3", - "valibot": "^0.17.0", - "vite": "^4.4.10", - "yup": "^1.2.0", - "zod": "^3.22.2" + "valibot": "^0.26.0", + "vite": "^5.0.12", + "yup": "^1.3.3", + "zod": "^3.22.4" }, "peerDependenciesMeta": { "@deepkit/type": { "optional": true }, - "@effect/data": { - "optional": true - }, "@effect/schema": { "optional": true }, @@ -9251,6 +9248,9 @@ "arktype": { "optional": true }, + "effect": { + "optional": true + }, "fp-ts": { "optional": true }, @@ -9284,9 +9284,9 @@ } }, "node_modules/next-safe-action/node_modules/@sinclair/typebox": { - "version": "0.31.28", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.31.28.tgz", - "integrity": "sha512-/s55Jujywdw/Jpan+vsy6JZs1z2ZTGxTmbZTPiuSL2wz9mfzA2gN1zzaqmvfi4pq+uOt7Du85fkiwv5ymW84aQ==", + "version": "0.32.13", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.32.13.tgz", + "integrity": "sha512-6gfhrgov2RWxPIlGyFcCVn1DejhmQvObIiBIx/Qx3FRnxlLS/RuoyDxK1hhhVU+S5+1Xmul32QALLErVfinyxw==", "optional": true, "peer": true }, diff --git a/package.json b/package.json index 44ae18a..383084a 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "lucide-react": "^0.304.0", "next": "^14.0.4", "next-auth": "^4.24.5", - "next-safe-action": "^6.0.1", + "next-safe-action": "^6.0.2", "react": "18.2.0", "react-beautiful-dnd": "^13.1.1", "react-dom": "18.2.0", diff --git a/prettier.config.js b/prettier.config.js index 5a4b9ec..7f09d1c 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -10,7 +10,6 @@ const config = { semi: true, importOrder: [ '', - '^@/(.*)$', // Absolute imports '^[./].*(?PaymentPage +
+ +
); } diff --git a/src/features/Admin/components/OrderStatusSelect/index.tsx b/src/features/Admin/components/OrderStatusSelect/index.tsx new file mode 100644 index 0000000..13820c5 --- /dev/null +++ b/src/features/Admin/components/OrderStatusSelect/index.tsx @@ -0,0 +1,40 @@ +import { + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select'; +import { OrderStatus } from '@prisma/client'; + +const orderStatus = [ + { label: 'Pending', value: 'PENDING' }, + { label: 'Processing', value: 'PROCESSING' }, + { label: 'Shipped', value: 'SHIPPED' }, + { label: 'Delivered', value: 'DELIVERED' }, + { label: 'Canceled', value: 'CANCELED' }, +]; + +type Props = { + status: OrderStatus | undefined; +}; + +export const OrderStatusSelect = ({ status }: Props) => { + return ( + + ); +}; diff --git a/src/features/Admin/components/common/AdminLogo.tsx b/src/features/Admin/components/common/AdminLogo.tsx index 0bee2ea..b7f35ca 100644 --- a/src/features/Admin/components/common/AdminLogo.tsx +++ b/src/features/Admin/components/common/AdminLogo.tsx @@ -1,11 +1,11 @@ -import Link from "next/link"; -import Image from "next/image"; -import { ADMIN_URL } from "@/constants/urls"; +import { SHOP_URL } from '@/constants/urls'; +import Image from 'next/image'; +import Link from 'next/link'; export const AdminLogo = () => { return (
- + { return ( diff --git a/src/features/Admin/types/payment.type.ts b/src/features/Admin/types/payment.type.ts index 5ed3726..c045c81 100644 --- a/src/features/Admin/types/payment.type.ts +++ b/src/features/Admin/types/payment.type.ts @@ -1,35 +1,43 @@ export type PaymentMethodOptionsType = - | "acss_debit" - | "affirm" - | "afterpay_clearpay" - | "alipay" - | "au_becs_debit" - | "bacs_debit" - | "bancontact" - | "blik" - | "boleto" - | "card" - | "card_present" - | "cashapp" - | "customer_balance" - | "eps" - | "fpx" - | "giropay" - | "grabpay" - | "ideal" - | "interac_present" - | "klarna" - | "konbini" - | "link" - | "oxxo" - | "p24" - | "paynow" - | "paypal" - | "pix" - | "promptpay" - | "revolut_pay" - | "sepa_debit" - | "sofort" - | "us_bank_account" - | "wechat_pay" - | "zip"; + | 'acss_debit' + | 'affirm' + | 'afterpay_clearpay' + | 'alipay' + | 'au_becs_debit' + | 'bacs_debit' + | 'bancontact' + | 'blik' + | 'boleto' + | 'card' + | 'card_present' + | 'cashapp' + | 'customer_balance' + | 'eps' + | 'fpx' + | 'giropay' + | 'grabpay' + | 'ideal' + | 'interac_present' + | 'klarna' + | 'konbini' + | 'link' + | 'oxxo' + | 'p24' + | 'paynow' + | 'paypal' + | 'pix' + | 'promptpay' + | 'revolut_pay' + | 'sepa_debit' + | 'sofort' + | 'us_bank_account' + | 'wechat_pay' + | 'zip'; + +export enum OrderStatus { + PENDING = 'pending', + PROCESSING = 'processing', + SHIPPED = 'shipped', + DELIVERED = 'delivered', + CANCELED = 'canceled', +} diff --git a/src/server/db.ts b/src/server/db.ts index 1706769..b8fc2c6 100644 --- a/src/server/db.ts +++ b/src/server/db.ts @@ -1,6 +1,6 @@ -import { PrismaClient } from "@prisma/client"; +import { PrismaClient } from '@prisma/client'; -import { env } from "@/env"; +import { env } from '@/env'; const globalForPrisma = globalThis as unknown as { prisma: PrismaClient | undefined; @@ -9,7 +9,7 @@ const globalForPrisma = globalThis as unknown as { export const db = globalForPrisma.prisma ?? new PrismaClient({ - log: env.NODE_ENV === "development" ? ["error", "warn"] : ["error"], + log: env.NODE_ENV === 'development' ? ['error', 'warn'] : ['error'], }); -if (env.NODE_ENV !== "production") globalForPrisma.prisma = db; +if (env.NODE_ENV !== 'production') globalForPrisma.prisma = db;