Redesign profile screen

pull/417/head^2
Bailey Pumfleet 2021-08-05 13:41:20 +01:00
parent 0572d5653e
commit d7f39e9ed6
1 changed files with 33 additions and 17 deletions

View File

@ -4,50 +4,65 @@ import Link from "next/link";
import prisma, { whereAndSelect } from "@lib/prisma"; import prisma, { whereAndSelect } from "@lib/prisma";
import Avatar from "../components/Avatar"; import Avatar from "../components/Avatar";
import Theme from "@components/Theme"; import Theme from "@components/Theme";
import { ClockIcon, InformationCircleIcon, UserIcon } from "@heroicons/react/solid";
import React from "react";
export default function User(props): User { export default function User(props): User {
const { isReady } = Theme(props.user.theme); const { isReady } = Theme(props.user.theme);
const eventTypes = props.eventTypes.map((type) => ( const eventTypes = props.eventTypes.map((type) => (
<li <div
key={type.id} key={type.id}
className="dark:bg-gray-800 dark:opacity-90 dark:hover:opacity-100 dark:hover:bg-gray-800 bg-white hover:bg-gray-50 "> className="dark:bg-gray-800 dark:opacity-90 dark:hover:opacity-100 dark:hover:bg-gray-800 bg-white hover:bg-gray-50 border border-neutral-200 hover:border-black rounded-sm">
<Link href={`/${props.user.username}/${type.slug}`}> <Link href={`/${props.user.username}/${type.slug}`}>
<a className="block px-6 py-4"> <a className="block px-6 py-4">
<div <h2 className="font-semibold text-neutral-900 dark:text-white">{type.title}</h2>
className="inline-block w-3 h-3 rounded-full mr-2" <div className="mt-2 flex space-x-4">
style={{ backgroundColor: getRandomColorCode() }}></div> <div className="flex items-center text-sm text-neutral-500">
<h2 className="inline-block font-medium dark:text-white">{type.title}</h2> <ClockIcon className="flex-shrink-0 mr-1.5 h-5 w-5 text-neutral-400" aria-hidden="true" />
<p className="inline-block text-gray-400 dark:text-gray-100 ml-2">{type.description}</p> <p>{type.length}m</p>
</div>
<div className="flex items-center text-sm text-neutral-500">
<UserIcon className="flex-shrink-0 mr-1.5 h-5 w-5 text-neutral-400" aria-hidden="true" />
<p>1-on-1</p>
</div>
<div className="flex items-center text-sm text-neutral-500">
<InformationCircleIcon
className="flex-shrink-0 mr-1.5 h-5 w-5 text-neutral-400"
aria-hidden="true"
/>
<p>{type.description.substring(0, 100)}</p>
</div>
</div>
</a> </a>
</Link> </Link>
</li> </div>
)); ));
return ( return (
isReady && ( isReady && (
<div> <div className="bg-neutral-50 h-screen">
<Head> <Head>
<title>{props.user.name || props.user.username} | Calendso</title> <title>{props.user.name || props.user.username} | Calendso</title>
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="/favicon.ico" />
</Head> </Head>
<main className="max-w-2xl mx-auto my-24"> <main className="max-w-3xl mx-auto py-24">
<div className="mb-8 text-center"> <div className="mb-8 text-center">
<Avatar user={props.user} className="mx-auto w-24 h-24 rounded-full mb-4" /> <Avatar user={props.user} className="mx-auto w-24 h-24 rounded-full mb-4" />
<h1 className="text-3xl font-semibold text-gray-800 dark:text-white mb-1"> <h1 className="text-3xl font-bold text-neutral-900 dark:text-white mb-1">
{props.user.name || props.user.username} {props.user.name || props.user.username}
</h1> </h1>
<p className="text-gray-600 dark:text-white">{props.user.bio}</p> <p className="text-neutral-500 dark:text-white">{props.user.bio}</p>
</div> </div>
<div className="shadow overflow-hidden rounded-md"> <div className="space-y-4">{eventTypes}</div>
<ul className="divide-y divide-gray-200 dark:divide-gray-900">{eventTypes}</ul> {eventTypes.length == 0 && (
{eventTypes.length == 0 && ( <div className="shadow overflow-hidden rounded-sm">
<div className="p-8 text-center text-gray-400 dark:text-white"> <div className="p-8 text-center text-gray-400 dark:text-white">
<h2 className="font-semibold text-3xl text-gray-600">Uh oh!</h2> <h2 className="font-semibold text-3xl text-gray-600">Uh oh!</h2>
<p className="max-w-md mx-auto">This user hasn&apos;t set up any event types yet.</p> <p className="max-w-md mx-auto">This user hasn&apos;t set up any event types yet.</p>
</div> </div>
)} </div>
</div> )}
</main> </main>
</div> </div>
) )
@ -76,6 +91,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
select: { select: {
slug: true, slug: true,
title: true, title: true,
length: true,
description: true, description: true,
}, },
}); });