Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
Co-Authored-By: Bloxs <[email protected]>
  • Loading branch information
quick007 and Blocksnmore committed Mar 1, 2024
1 parent 7326d0e commit 18673ae
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 126 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ googlea82f3fcba9c8e379.html
_fresh/
/db
/static/output.css
/out
/out
.react-email
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"@react-email/components": "npm:@react-email/components"
},
"compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
"exclude": ["**/_fresh/*"]
"exclude": ["**/_fresh/*", "./.react-email/*"]
}
5 changes: 4 additions & 1 deletion emails/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export default function LoginEmail({ otp = "123456" }: { otp: string }) {
}}
>
<Body className="bg-white text-gray-800 text-center">
<Preview>Your authorization code for Events is {`{{OTP-PART-1}}{{OTP-PART-2}}`}</Preview>
<Preview>
Your authorization code for Events is{" "}
{`{{OTP-PART-1}}{{OTP-PART-2}}`}
</Preview>
<Container className="my-8">
<Img
src={`https://events.deno.dev/orange-logo.png`}
Expand Down
16 changes: 7 additions & 9 deletions islands/events/editing/showtimeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ const ShowtimeSelector = ({
};

return (

<SelectShowTime
all={true}
changeOpen={changeOpen}
showTime={defaultShowTime}
showTimes={showTimes}
setShowTime={setShowTime}
/>

<SelectShowTime
all={true}
changeOpen={changeOpen}
showTime={defaultShowTime}
showTimes={showTimes}
setShowTime={setShowTime}
/>
);
};

Expand Down
42 changes: 22 additions & 20 deletions islands/events/viewing/register/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ export default function EventRegister({
const toggles = useSignal<Record<string, boolean>>({
...additionalFields
.filter((field) => field.type == "toggle")
.reduce(
(acc, field) => {
acc[field.id] = false;
return acc;
},
{} as Record<string, boolean>,
),
.reduce((acc, field) => {
acc[field.id] = false;
return acc;
}, {} as Record<string, boolean>),
});

const perfEntries = performance.getEntriesByType("navigation");
Expand Down Expand Up @@ -74,13 +71,10 @@ export default function EventRegister({
email: email || "",
...additionalFields
.filter((field) => field.type != "toggle")
.reduce(
(acc, field) => {
acc[field.id] = field.type === "number" ? 0 : "";
return acc;
},
{} as Record<string, string | number>,
),
.reduce((acc, field) => {
acc[field.id] = field.type === "number" ? 0 : "";
return acc;
}, {} as Record<string, string | number>),
},
onSubmit: (form) => submitForm(form.formState!),
// TODO: add client side validation
Expand All @@ -89,11 +83,11 @@ export default function EventRegister({

const submitForm = (formState: FormState) => {
if (user) {
createTicket(formState)
createTicket(formState);
return;
}
page.value = 2
}
page.value = 2;
};

const createTicket = async (formState: FormState) => {
const formStates: { id: string; value: unknown }[] = [];
Expand Down Expand Up @@ -277,9 +271,17 @@ export default function EventRegister({
/>
</>
)}
{
page.value === 2 && <Login email={formState().email} showTime={showTime} showTimes={showTimes} ticketID={ticketID} tickets={tickets} createTicket={() => createTicket(formState())} error={error} />
}
{page.value === 2 && (
<Login
email={formState().email}
showTime={showTime}
showTimes={showTimes}
ticketID={ticketID}
tickets={tickets}
createTicket={() => createTicket(formState())}
error={error}
/>
)}
{page.value === 3 && (
// After user has acquired tickets
<>
Expand Down
6 changes: 5 additions & 1 deletion islands/events/viewing/register/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const Login = ({
}) => (
<>
<div class="flex my-4 items-center justify-center">
<LoginForm attending={false} emailInputted={email} createTicket={createTicket}/>
<LoginForm
attending={false}
emailInputted={email}
createTicket={createTicket}
/>
</div>
{error.value && (
<div class="flex flex-col items-center">
Expand Down
14 changes: 8 additions & 6 deletions islands/loginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ const LoginForm = ({

setError(undefined);
const passed =
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
.test(
email.value,
);
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(
email.value,
);
if (!passed) {
setError("Enter a valid email");
return;
Expand Down Expand Up @@ -173,7 +172,9 @@ const LoginForm = ({
{/* login code input */}
<div class="ml-1">
<p class="mt-2 mb-8 w-64 [@media(min-width:300px)]:w-72 text-center">
{emailInputted ? "To verify that you're you, please enter the code we emailed you below" : "We just emailed you a login code! Please enter it below."}
{emailInputted
? "To verify that you're you, please enter the code we emailed you below"
: "We just emailed you a login code! Please enter it below."}
</p>
<form onSubmit={login} noValidate>
<label class="flex flex-col">
Expand Down Expand Up @@ -210,7 +211,8 @@ const LoginForm = ({
pattern="[0-9]*"
value={code.value}
onInput={(e) =>
updateCode(e.currentTarget.value.replace(/e/gi, ""))}
updateCode(e.currentTarget.value.replace(/e/gi, ""))
}
ref={codeRef}
onBlur={() => setFocused(false)}
onFocus={() => setFocused(true)}
Expand Down
10 changes: 1 addition & 9 deletions routes/api/events/ticket/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { Handlers } from "$fresh/server.ts";
import {
Event,
getUser,
getUserAuthToken,
kv,
Plan,
Roles,
User,
} from "@/utils/db/kv.ts";
import { Event, getUser, kv, Roles } from "@/utils/db/kv.ts";
import * as Yup from "yup";
import { EventRegisterError } from "@/utils/event/register.ts";

Expand Down
2 changes: 1 addition & 1 deletion routes/events/(pages)/attending/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineLayout(
ticketID,
event,
time: showtime,
})
});
}

ctx.state.data = {
Expand Down
10 changes: 6 additions & 4 deletions routes/events/(pages)/attending/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ export default defineRoute((req, ctx: RouteContext<void, TicketContext>) => {
<p class="line-clamp-3 text-sm text-pretty text-center mt-2 mb-4">
{ticket.event.summary}
</p>
<a href={`/events/${ticket.eventID}/tickets/${ticket.ticketID}?s=${ticket.time.id}`}>
<CTA btnType="secondary" btnSize="sm" className="mt-auto">
View Ticket
</CTA>
<a
href={`/events/${ticket.eventID}/tickets/${ticket.ticketID}?s=${ticket.time.id}`}
>
<CTA btnType="secondary" btnSize="sm" className="mt-auto">
View Ticket
</CTA>
</a>
</div>
</div>
Expand Down
Loading

0 comments on commit 18673ae

Please sign in to comment.