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

fix: routes to non-existend events #99

Merged
merged 1 commit into from
Oct 9, 2023
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thatconference.com",
"version": "5.0.9",
"version": "5.0.10",
"description": "THATConference.com website",
"main": "index.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { error } from '@sveltejs/kit';
import eventsApi from '$dataSources/api.that.tech/events/queries';

export async function load({ params, fetch }) {
Expand All @@ -6,8 +7,11 @@ export async function load({ params, fetch }) {

const { queryEventWithSpeakersBySlug } = eventsApi(fetch);

const eventRecord = await queryEventWithSpeakersBySlug(eventSlug);
if (!eventRecord) throw error(404, 'Event not found');

return {
eventSlug,
event: await queryEventWithSpeakersBySlug(eventSlug)
event: eventRecord
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
</div>
</div>
<div class="mt-4 flex items-baseline text-6xl font-extrabold">
{#if eventTickets['CLAIMABLE_TICKET'].price === 0}
{#if eventTickets['CLAIMABLE_TICKET']?.price === 0}
Free
{:else}
${eventTickets['CLAIMABLE_TICKET'].price}
${eventTickets['CLAIMABLE_TICKET']?.price ?? 15}
<span class="ml-1 text-2xl font-medium text-gray-500"> USD </span>
{/if}
</div>
Expand Down Expand Up @@ -107,7 +107,7 @@

<StandardButton
on:click={() =>
dispatch('claim-ticket', { product: { id: eventTickets['CLAIMABLE_TICKET'].id } })}>
dispatch('claim-ticket', { product: { id: eventTickets['CLAIMABLE_TICKET']?.id } })}>
Claim Your Ticket
</StandardButton>
</div>
Expand All @@ -133,7 +133,7 @@
<p class="text-lg text-gray-500">
{dayjs(event.startDate).format('dddd, MMMM D, YYYY - h:mm A z')}
</p>
<p class="mt-6 text-lg text-gray-500">
<p class="mt-6 text-lg text-gray-500">
{eventTickets['VIRTUAL_CAMPER'].description}
</p>
</div>
Expand Down Expand Up @@ -175,7 +175,7 @@
</div>
</div>

<div class="relative mt-12 lg:mt-24">
<div class="relative mt-12 lg:mt-24">
<div class="flex flex-col">
<h3 class="text-2xl font-extrabold tracking-tight text-thatBlue-800 sm:text-3xl">
Built to support the practitioners
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</h1>

<h2
class="mt-1 text-4xl font-extrabold tracking-tight text-white sm:mt-2 sm:text-6xl lg:mt-3 xl:text-6xl ">
class="mt-1 text-4xl font-extrabold tracking-tight text-white sm:mt-2 sm:text-6xl lg:mt-3 xl:text-6xl">
{dayjs(event.startDate).format('MMMM D, YYYY')}
</h2>
</div>
Expand All @@ -60,15 +60,15 @@
<div class="col-span-3 mt-6 flex flex-col items-center space-y-6 font-extrabold">
<div>
<div class="transform transition duration-500 ease-in-out hover:scale-105">
<a href={`/activities/${event.slug}`}>
<a href={`https://that.us/activities/${event.slug}`}>
<span
class="rounded-md bg-thatOrange-400 px-4 py-2 text-lg uppercase leading-5 tracking-wide text-white transition duration-500 ease-in-out hover:bg-thatOrange-500"
>View Event Schedule</span>
>View Event Schedule on THAT.us</span>
</a>
</div>
</div>

<p class="text-lg lowercase italic tracking-tight text-white ">
<p class="text-lg lowercase italic tracking-tight text-white">
all dates/times are represented in your time zone.
</p>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/routes/(that conferences)/+layout.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { error } from '@sveltejs/kit';
import eventsApi from '$dataSources/api.that.tech/events/queries';

export const trailingSlash = 'always';
Expand All @@ -18,6 +19,8 @@ export async function load({ params, url }) {
const { queryEventWithSpeakersBySlug } = eventsApi();
const event = await queryEventWithSpeakersBySlug(eventSlug);

if (!event) throw error(404, 'Event not found');

return {
eventName,
event
Expand Down