Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some minor bugs that caused console errors #3

Merged
merged 1 commit into from
Apr 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pages/[user].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
8 changes: 4 additions & 4 deletions pages/[user]/[type].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down