From 508a3d16a31f3eecf7a7f22a6f0f62e28e9d443b Mon Sep 17 00:00:00 2001 From: axgu <86838870+axgu@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:28:38 -0500 Subject: [PATCH 1/6] change value selection to general/high --- prisma/schema.prisma | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c5bb059..0ea5f91 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -81,8 +81,7 @@ enum Status { } enum Value { - LOW - MEDIUM + GENERAL HIGH } From e6ef240cf4bcebf50d995892358e885747e8e57b Mon Sep 17 00:00:00 2001 From: axgu <86838870+axgu@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:34:23 -0500 Subject: [PATCH 2/6] change value buttons to general/high instead 2 --- src/env/schema.mjs | 3 ++- src/server/trpc/router/account.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/env/schema.mjs b/src/env/schema.mjs index 1b14661..b234a66 100644 --- a/src/env/schema.mjs +++ b/src/env/schema.mjs @@ -28,5 +28,6 @@ export const clientSchema = z.object({ */ export const clientEnv = { // NEXT_PUBLIC_BAR: process.env.NEXT_PUBLIC_BAR, - NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY + NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: + process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }; diff --git a/src/server/trpc/router/account.ts b/src/server/trpc/router/account.ts index a34964d..ee22581 100644 --- a/src/server/trpc/router/account.ts +++ b/src/server/trpc/router/account.ts @@ -6,5 +6,5 @@ export default router({ ctx.prisma.account.delete({ where: { clerkId: input } }) - ), + ) }); From 0137cf2eb3692a2f5aef01ba79a879479a920519 Mon Sep 17 00:00:00 2001 From: axgu <86838870+axgu@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:15:22 -0400 Subject: [PATCH 3/6] fix value error --- src/lib/schemas.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts index 4ead0cd..7c38019 100644 --- a/src/lib/schemas.ts +++ b/src/lib/schemas.ts @@ -17,7 +17,10 @@ export const ItemSchema = z.object({ shortDescription: z.string().min(3), categories: z.array(z.nativeEnum(Category)), color: z.nativeEnum(Color), - value: z.nativeEnum(Value), + value: z.nativeEnum(Value, { + required_error: 'Required', + invalid_type_error: 'Required' + }), identifiable: z.boolean(), itemLocation: z.string().min(3), retrieveLocation: z.nativeEnum(Location), From c5cfd1c61d681e3aad97acd1ab8bfd3401dd4dae Mon Sep 17 00:00:00 2001 From: axgu <86838870+axgu@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:26:59 -0400 Subject: [PATCH 4/6] sort categories alphabetically --- prisma/schema.prisma | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0ea5f91..c110b64 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -35,16 +35,16 @@ enum Location { } enum Category { + BEVERAGE_CONTAINER CLOTHING CHARGER - UMBRELLA + EARBUDS_HEADPHONES_CASES GLASSES_CASES JEWELRY_WATCHES - EARBUDS_HEADPHONES_CASES + KEYS PHONES_LAPTOPS_TABLETS - BEVERAGE_CONTAINER STATIONARY - KEYS + UMBRELLA OTHER } From 697c934820ba3d5b3e3d45d47651e08ceaa67611 Mon Sep 17 00:00:00 2001 From: axgu <86838870+axgu@users.noreply.github.com> Date: Sat, 16 Mar 2024 16:41:50 -0400 Subject: [PATCH 5/6] sort categories alphabetically --- prisma/schema.prisma | 2 +- src/components/Form/Listbox.tsx | 1 + src/types/index.ts | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c110b64..13489c7 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -36,8 +36,8 @@ enum Location { enum Category { BEVERAGE_CONTAINER - CLOTHING CHARGER + CLOTHING EARBUDS_HEADPHONES_CASES GLASSES_CASES JEWELRY_WATCHES diff --git a/src/components/Form/Listbox.tsx b/src/components/Form/Listbox.tsx index 0047a39..41e7f24 100644 --- a/src/components/Form/Listbox.tsx +++ b/src/components/Form/Listbox.tsx @@ -63,6 +63,7 @@ export default function MyListbox({ ? field.value?.length > 0 ? field.value .map((value: T) => displayValue(value)) + .sort() .join(', ') : placeholder : field.value diff --git a/src/types/index.ts b/src/types/index.ts index b6d12da..f06540c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -39,15 +39,15 @@ export const Colors: Record = { OTHER: 'Other' }; export const Categories: Record = { - CLOTHING: 'Clothing', + BEVERAGE_CONTAINER: 'Beverage Container', CHARGER: 'Charger', - UMBRELLA: 'Umbrellas', + CLOTHING: 'Clothing', + EARBUDS_HEADPHONES_CASES: 'Earbuds/Headphones/Case', GLASSES_CASES: 'Glasses/Sunglasses/Cases', JEWELRY_WATCHES: 'Jewelry/Watches', - EARBUDS_HEADPHONES_CASES: 'Earbuds/Headphones/Case', + KEYS: 'Keys', PHONES_LAPTOPS_TABLETS: 'Phones/Laptops/Tablets', - BEVERAGE_CONTAINER: 'Beverage Container', STATIONARY: 'Stationary', - KEYS: 'Keys', + UMBRELLA: 'Umbrellas', OTHER: 'Other' }; From b930652f8714ce81873d31c9756b6948dd5538e2 Mon Sep 17 00:00:00 2001 From: axgu Date: Mon, 3 Jun 2024 15:54:37 -0400 Subject: [PATCH 6/6] sort display and categories alphabetically --- src/pages/manage/items/create.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/manage/items/create.tsx b/src/pages/manage/items/create.tsx index 0bb7ef6..6da5f84 100644 --- a/src/pages/manage/items/create.tsx +++ b/src/pages/manage/items/create.tsx @@ -137,7 +137,15 @@ const CreateItem: NextPageWithLayout = () => { { + if (a === 'OTHER') { + return 1; + } + if (b === 'OTHER') { + return -1; + } + return a.localeCompare(b); + })} displayValue={(prop) => Categories[prop]} keyValue={(prop) => prop} name="categories"