Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
quick007 committed Mar 14, 2024
1 parent 4ef635b commit 0f4feed
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 32 deletions.
12 changes: 11 additions & 1 deletion components/faq/questions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ import { ComponentChildren } from "preact";
export const faqs: FAQ[] = [
{
q: "How do I contact Events?",
a: ( <>You can contact us at <a href="mailto:[email protected]" class="underline font-medium">[email protected]</a></> )
a: (
<>
You can contact us at{" "}
<a
href="mailto:[email protected]"
class="underline font-medium"
>
[email protected]
</a>
</>
),
},
{
q: "How can I get alpha access?",
Expand Down
2 changes: 1 addition & 1 deletion components/layout/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const Footer = ({ includeWave = true }: { includeWave?: boolean }) => {
// imo looks bad with 4 links, we'll put the faq on the homepage
{
name: "Faq",
link: "/faq"
link: "/faq",
},
{
name: "Privacy",
Expand Down
7 changes: 5 additions & 2 deletions emails/event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,15 @@ export default function LoginEmail() {
</Button>
<a
href="{{EVENT-LINK}}"
rel="_blank"
rel="_blank"
className="ml-3 rounded-md font-semibold peer z-10 hover:brightness-95 transition hover:focus:ring-1 hover:focus:brightness-100 disabled:brightness-90 disabled:cursor-not-allowed bg-gray-300 ring-gray-400/50 text-gray-800 px-4 py-2"
>
View Event
</a>
<p className="mt-8 text-sm">Buttons not working? Copy and paste this in your browser: {`{{TICKET-LINK}}`}</p>
<p className="mt-8 text-sm">
Buttons not working? Copy and paste this in your browser:{" "}
{`{{TICKET-LINK}}`}
</p>
</Container>
</Body>
</Tailwind>
Expand Down
2 changes: 1 addition & 1 deletion islands/components/pieces/acceptCookies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Cookies = () => {
);
}

return null;
return null;
};

export default Cookies;
8 changes: 6 additions & 2 deletions islands/events/viewing/contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ export const Contact = ({ email }: { email: string }) => {
Are you looking for Events support or an organizer contact email?
It's simple and easy to contact Events, the ticketing platform
used to make this event. Create a ticket by emailing Events at{" "}
<a href="mailto:[email protected]" class="underline font-medium">
<a
href="mailto:[email protected]"
class="underline font-medium"
>
[email protected]
</a>.
</a>
.
</p>
<p class="mt-4 text-pretty">
Still want to contact the organizer? Agree to our terms below to
Expand Down
8 changes: 5 additions & 3 deletions islands/loginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ const LoginForm = ({
attending,
emailInputted,
createTicket,
redirectTo,
}: {
attending: boolean;
emailInputted?: string;
createTicket?: () => void;
redirectTo?: string | null;
}) => {
const email = useSignal("");
const code = useSignal("");
Expand Down Expand Up @@ -107,9 +109,9 @@ const LoginForm = ({

if (!emailInputted) {
setTimeout(() => {
window.location.href = `/events/${
attending ? "attending" : "organizing"
}`;
window.location.href = redirectTo
? redirectTo
: `/events/${attending ? "attending" : "organizing"}`;
}, 300);
} else {
createTicket!();
Expand Down
3 changes: 1 addition & 2 deletions routes/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export default defineLayout(async (req, { Component }) => {
<Navbar /*f-client-nav*/ user={user} />
{/* <Partial name="navbar"> */}
<div className="flex flex-col grow">
{!getCookies(req.headers)["accepted-privacy"] &&
<Cookies />}
{!getCookies(req.headers)["accepted-privacy"] && <Cookies />}
<Component />
</div>
{/* </Partial> */}
Expand Down
9 changes: 6 additions & 3 deletions routes/api/events/ticket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ export const handler: Handlers = {
if (
user.tickets
.map((t) => t.substring(0, t.lastIndexOf("_")))
.includes(`${eventID}_${showtimeID}`)
//&& !showtime.multiPurchase
.includes(`${eventID}_${showtimeID}`)
//&& !showtime.multiPurchase
) {
return new Response(
JSON.stringify({
Expand Down Expand Up @@ -333,7 +333,10 @@ export const handler: Handlers = {

const emailHTML = ticketHTML
.replace("{{TICKETS}}", tickets.toString())
.replaceAll("{{QR-VALUE}}", `https://events.deno.dev/api/qr?ticket=${eventID}_${showtimeID}_${ticketID}`)
.replaceAll(
"{{QR-VALUE}}",
`https://events.deno.dev/api/qr?ticket=${eventID}_${showtimeID}_${ticketID}`,
)
.replace(
"{{TICKET-LINK}}",
`${url.protocol}//${url.host}/events/${eventID}/tickets/${ticketID}?s=${showtimeID}`,
Expand Down
10 changes: 5 additions & 5 deletions routes/api/qr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isTicketUUID } from "@/utils/db/misc.ts";
import qr from "npm:qrcode";

export const handler: Handlers = {
async GET(req, _ctx) {
async GET(req, _ctx) {
const url = new URL(req.url);
const search = url.searchParams;
const ticket = search.get("ticket");
Expand All @@ -18,13 +18,13 @@ export const handler: Handlers = {
if (isTicketUUID(ticket)) {
const qrcode = await qr.toBuffer(ticket, {
color: {
light: "#f3f4f6"
}
})
light: "#f3f4f6",
},
});

return new Response(qrcode, {
headers: {
"Content-Type": "image/png",
"Content-Type": "image/png",
},
});
}
Expand Down
17 changes: 14 additions & 3 deletions routes/events/[id]/(no-layout)/tickets/[tixid].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ export default defineRoute(
const queryValue = url.searchParams.get("s");

if (!user) {
return badEventRequest;
return (
<div class="flex flex-col items-center justify-center min-h-screen text-center ">
<h1 class="font-bold px-2">
You need to log in to view this ticket
</h1>
<p class="mt-2 text-sm">We require users to login to ensure they're not using someone elses ticket.</p>
<a href={`/login?eventID=${eventID}&ticketID=${ticketID}`}>
<CTA btnType="cta" className="mt-10" btnSize="sm">
Log In
</CTA>
</a>
</div>
);
}

const sid = getShowtimeID(user?.data, eventID, ticketID);
Expand Down Expand Up @@ -131,8 +143,7 @@ export default defineRoute(
<Footer includeWave={false} />
</div>
{/* Print buttons and whatnot */}
{!getCookies(req.headers)["accepted-privacy"] &&
<Cookies />}
{!getCookies(req.headers)["accepted-privacy"] && <Cookies />}
</>
);
},
Expand Down
6 changes: 0 additions & 6 deletions routes/events/[id]/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ import {
EventContext,
} from "@/routes/events/[id]/_layout.tsx";
import EventHeader from "@/components/layout/eventEditNavbar.tsx";
import Button from "@/components/buttons/button.tsx";
import Select from "@/islands/components/pickers/select.tsx";
import UserMinus from "$tabler/user-minus.tsx";
import Dropdown from "@/islands/components/pickers/dropdown.tsx";
import DotsVertical from "$tabler/dots-vertical.tsx";
import { Trashcan } from "@/islands/components/dropinUI/trash.tsx";
import Invite from "@/islands/events/teams/invite.tsx";
import ManageUser from "@/islands/events/teams/manage.tsx";
import Crown from "$tabler/crown.tsx";
Expand Down
5 changes: 4 additions & 1 deletion routes/events/[id]/tickets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export default defineRoute(
</div>
<TicketsFilters query={query} sort={sort} />

<h2 class="font-medium text-sm mb-0.5 mt-8 flex">Tickets <div class="rounded px-1 bg-gray-100 ml-2">{tickets.length}</div></h2>
<h2 class="font-medium text-sm mb-0.5 mt-8 flex">
Tickets{" "}
<div class="rounded px-1 bg-gray-100 ml-2">{tickets.length}</div>
</h2>
{tickets.length === 0 ? (
<>
<div class="flex flex-col items-center justify-center grow py-2 text-center">
Expand Down
4 changes: 3 additions & 1 deletion routes/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export default defineRoute((req, ctx) => {
const user = (ctx.data as unknown as { user: User | undefined }).user;
const url = new URL(req.url);
const attending = url.searchParams.get("attending");
const eventID = url.searchParams.get("eventID");
const ticketID = url.searchParams.get("ticketID");

// DENO_DEPLOYMENT_ID will be set on prod, not local
// 👍
Expand All @@ -45,7 +47,7 @@ export default defineRoute((req, ctx) => {
<div className="flex flex-col grow items-center">
<h1 class="text-center text-4xl font-bold">Login</h1>
<div className="my-auto flex flex-col gap-4 pb-36 pt-6">
<LoginForm attending={Boolean(attending)} />
<LoginForm attending={Boolean(attending)} redirectTo={eventID && ticketID && `/events/${eventID}/tickets/${ticketID}`} />
</div>
</div>
</>
Expand Down
2 changes: 1 addition & 1 deletion utils/imagekit/URL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getURL = (width: number, path: string) =>
transformation: [
{
width: width.toString(),
quality: "85",
quality: "95",
format: fmt,
},
],
Expand Down

0 comments on commit 0f4feed

Please sign in to comment.