Merge pull request #3 from emrysal/main

Fixed some minor bugs that caused console errors
pull/6/head
Bailey Pumfleet 2021-04-10 11:54:23 +01:00 committed by GitHub
commit 73ea3ca181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -4,15 +4,15 @@ import prisma from '../lib/prisma'
export default function User(props) {
const eventTypes = props.user.eventTypes.map(type =>
<Link href={props.user.username + '/' + type.id.toString()}>
<a>
<li key={type.id} className="px-6 py-4">
<li key={type.id}>
<Link href={'/' + props.user.username + '/' + type.id.toString()}>
<a className="block px-6 py-4">
<div className="inline-block w-3 h-3 rounded-full bg-blue-600 mr-2"></div>
<h2 className="inline-block font-medium">{type.title}</h2>
<p className="inline-block text-gray-400 ml-2">{type.description}</p>
</li>
</a>
</Link>
</a>
</Link>
</li>
);
return (
<div>

View File

@ -35,7 +35,7 @@ export default function Type(props) {
}
const calendar = days.map((day) =>
<button onClick={(e) => setSelectedDate(dayjs().month(selectedMonth).date(day).format("YYYY-MM-DD"))} disabled={selectedMonth < dayjs().format('MM') && dayjs().month(selectedMonth).format("D") > day} className={"text-center w-10 h-10 rounded-full mx-auto " + (dayjs().isSameOrBefore(dayjs().date(day).month(selectedMonth)) ? 'bg-blue-50 text-blue-600 font-medium' : 'text-gray-400 font-light') + (dayjs(selectedDate).month(selectedMonth).format("D") == day ? ' bg-blue-600 text-white-important' : '')}>
<button key={day} onClick={(e) => setSelectedDate(dayjs().month(selectedMonth).date(day).format("YYYY-MM-DD"))} disabled={selectedMonth < dayjs().format('MM') && dayjs().month(selectedMonth).format("D") > day} className={"text-center w-10 h-10 rounded-full mx-auto " + (dayjs().isSameOrBefore(dayjs().date(day).month(selectedMonth)) ? 'bg-blue-50 text-blue-600 font-medium' : 'text-gray-400 font-light') + (dayjs(selectedDate).month(selectedMonth).format("D") == day ? ' bg-blue-600 text-white-important' : '')}>
{day}
</button>
);
@ -84,7 +84,7 @@ export default function Type(props) {
// Display available times
const availableTimes = times.map((time) =>
<div>
<div key={time}>
<Link href={"/" + props.user.username + "/book?date=" + selectedDate + "T" + dayjs(time).format("HH:mm:ss") + "Z&type=" + props.eventType.id}>
<a key={time} className="block font-medium mb-4 text-blue-600 border border-blue-600 rounded hover:text-white hover:bg-blue-600 py-4">{dayjs(time).format("hh:mma")}</a>
</Link>
@ -133,12 +133,12 @@ export default function Type(props) {
{calendar}
</div>
</div>
<div className={"sm:pl-4 mt-8 sm:mt-0 text-center " + (selectedDate ? 'sm:w-1/3' : 'sm:w-1/2 hidden')}>
{selectedDate && <div className="sm:pl-4 mt-8 sm:mt-0 text-center sm:w-1/3">
<div className="text-gray-600 font-light text-xl mb-4 text-left">
<span className="w-1/2">{dayjs(selectedDate).format("dddd DD MMMM YYYY")}</span>
</div>
{!loading ? availableTimes : <div className="loader"></div>}
</div>
</div>}
</div>
</div>
</main>