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:
parent
19d1744138
commit
fb38c062ae
4 changed files with 18 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { ArrowRightIcon } from "@heroicons/react/outline";
|
import { ArrowRightIcon } from "@heroicons/react/outline";
|
||||||
|
import { BadgeCheckIcon } from "@heroicons/react/solid";
|
||||||
import { GetServerSidePropsContext } from "next";
|
import { GetServerSidePropsContext } from "next";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
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)
|
delete query.user; // So it doesn't display in the Link (and make tests fail)
|
||||||
|
|
||||||
const nameOrUsername = user.name || user.username || "";
|
const nameOrUsername = user.name || user.username || "";
|
||||||
|
|
||||||
const [evtsToVerify, setEvtsToVerify] = useState<EvtsToVerify>({});
|
const [evtsToVerify, setEvtsToVerify] = useState<EvtsToVerify>({});
|
||||||
|
|
||||||
return (
|
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">
|
<h1 className="mb-1 text-3xl font-bold font-cal text-neutral-900 dark:text-white">
|
||||||
{nameOrUsername}
|
{nameOrUsername}
|
||||||
|
{user.verified && (
|
||||||
|
<BadgeCheckIcon className="inline w-6 h-6 -mt-1 text-blue-500 dark:text-white" />
|
||||||
|
)}
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-neutral-500 dark:text-white">{user.bio}</p>
|
<p className="text-neutral-500 dark:text-white">{user.bio}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -139,6 +142,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||||
theme: true,
|
theme: true,
|
||||||
plan: true,
|
plan: true,
|
||||||
away: true,
|
away: true,
|
||||||
|
verified: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
@ -141,6 +141,7 @@ model User {
|
||||||
destinationCalendar DestinationCalendar?
|
destinationCalendar DestinationCalendar?
|
||||||
away Boolean @default(false)
|
away Boolean @default(false)
|
||||||
metadata Json?
|
metadata Json?
|
||||||
|
verified Boolean? @default(false)
|
||||||
|
|
||||||
@@map(name: "users")
|
@@map(name: "users")
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ export const _UserModel = z.object({
|
||||||
brandColor: z.string(),
|
brandColor: z.string(),
|
||||||
away: z.boolean(),
|
away: z.boolean(),
|
||||||
metadata: jsonSchema,
|
metadata: jsonSchema,
|
||||||
|
verified: z.boolean().nullish(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export interface CompleteUser extends z.infer<typeof _UserModel> {
|
export interface CompleteUser extends z.infer<typeof _UserModel> {
|
||||||
|
|
Loading…
Reference in a new issue