From fb38c062aee99ac7ffc43781f056b741e2792cbd Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Mon, 7 Feb 2022 17:16:20 +0000 Subject: [PATCH] added verified badge to profile (#1710) * added verified badge to profile * added verified to schema * made verified optional * generated missing migration * add if exists Co-authored-by: Jamie --- pages/[user].tsx | 6 +++++- .../20220205135022_add_verified_column/migration.sql | 11 +++++++++++ prisma/schema.prisma | 1 + prisma/zod/user.ts | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20220205135022_add_verified_column/migration.sql diff --git a/pages/[user].tsx b/pages/[user].tsx index 9506e63fa9..878143a64a 100644 --- a/pages/[user].tsx +++ b/pages/[user].tsx @@ -1,4 +1,5 @@ import { ArrowRightIcon } from "@heroicons/react/outline"; +import { BadgeCheckIcon } from "@heroicons/react/solid"; import { GetServerSidePropsContext } from "next"; import Link from "next/link"; import { useRouter } from "next/router"; @@ -33,7 +34,6 @@ export default function User(props: inferSSRProps) { delete query.user; // So it doesn't display in the Link (and make tests fail) const nameOrUsername = user.name || user.username || ""; - const [evtsToVerify, setEvtsToVerify] = useState({}); return ( @@ -56,6 +56,9 @@ export default function User(props: inferSSRProps) { />

{nameOrUsername} + {user.verified && ( + + )}

{user.bio}

@@ -139,6 +142,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) => theme: true, plan: true, away: true, + verified: true, }, }); diff --git a/prisma/migrations/20220205135022_add_verified_column/migration.sql b/prisma/migrations/20220205135022_add_verified_column/migration.sql new file mode 100644 index 0000000000..2010d1823b --- /dev/null +++ b/prisma/migrations/20220205135022_add_verified_column/migration.sql @@ -0,0 +1,11 @@ +/* + Warnings: + + - You are about to drop the column `smartContractAddress` on the `EventType` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "EventType" DROP COLUMN IF EXISTS "smartContractAddress"; + +-- AlterTable +ALTER TABLE "users" ADD COLUMN "verified" BOOLEAN DEFAULT false; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ebc4eea56a..bbc591f91c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -141,6 +141,7 @@ model User { destinationCalendar DestinationCalendar? away Boolean @default(false) metadata Json? + verified Boolean? @default(false) @@map(name: "users") } diff --git a/prisma/zod/user.ts b/prisma/zod/user.ts index 3ef144e960..aefd667151 100644 --- a/prisma/zod/user.ts +++ b/prisma/zod/user.ts @@ -59,6 +59,7 @@ export const _UserModel = z.object({ brandColor: z.string(), away: z.boolean(), metadata: jsonSchema, + verified: z.boolean().nullish(), }); export interface CompleteUser extends z.infer {