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 <ijamespine@me.com>
This commit is contained in:
Peer Richelsen 2022-02-07 17:16:20 +00:00 committed by GitHub
parent 19d1744138
commit fb38c062ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View file

@ -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<typeof getServerSideProps>) {
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<EvtsToVerify>({});
return (
@ -56,6 +56,9 @@ export default function User(props: inferSSRProps<typeof getServerSideProps>) {
/>
<h1 className="mb-1 text-3xl font-bold font-cal text-neutral-900 dark:text-white">
{nameOrUsername}
{user.verified && (
<BadgeCheckIcon className="inline w-6 h-6 -mt-1 text-blue-500 dark:text-white" />
)}
</h1>
<p className="text-neutral-500 dark:text-white">{user.bio}</p>
</div>
@ -139,6 +142,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
theme: true,
plan: true,
away: true,
verified: true,
},
});

View file

@ -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;

View file

@ -141,6 +141,7 @@ model User {
destinationCalendar DestinationCalendar?
away Boolean @default(false)
metadata Json?
verified Boolean? @default(false)
@@map(name: "users")
}

View file

@ -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<typeof _UserModel> {