From b5216767f4c74c5b8c65d31427eb6d4504da24c4 Mon Sep 17 00:00:00 2001 From: Ethan Bickel Date: Wed, 24 Apr 2024 16:09:23 -0500 Subject: [PATCH] run: formatting check --- src/app/event/[id]/page.tsx | 21 +++++++++++------ src/app/events/eventView.tsx | 16 ++++++------- src/app/feedback/Form.tsx | 1 - src/app/feedback/FormPopUp.tsx | 1 - src/app/feedback/page.tsx | 9 +++---- src/components/EventLikeButton.tsx | 4 ++-- src/components/RegisterButton.tsx | 1 - src/server/api/routers/form.ts | 38 +++++++++++++++--------------- src/server/db/schema/forms.ts | 24 +++++++++---------- src/utils/formSchemas.ts | 2 +- 10 files changed, 59 insertions(+), 58 deletions(-) diff --git a/src/app/event/[id]/page.tsx b/src/app/event/[id]/page.tsx index cdaf902c..405c6452 100644 --- a/src/app/event/[id]/page.tsx +++ b/src/app/event/[id]/page.tsx @@ -23,12 +23,16 @@ export default async function EventsPage({ params }: Params) { const { club, ...event } = res; - const isRegistered = (session && await db.query.userMetadataToEvents.findFirst({ - where: (userMetadataToEvents) => and( - eq(userMetadataToEvents.eventId, event.id), - eq(userMetadataToEvents.userId, session.user.id) - ) - }) !== undefined) || false; + const isRegistered = + (session && + (await db.query.userMetadataToEvents.findFirst({ + where: (userMetadataToEvents) => + and( + eq(userMetadataToEvents.eventId, event.id), + eq(userMetadataToEvents.userId, session.user.id), + ), + })) !== undefined) || + false; const clubDescription = ['Club', 'Location', 'Multi-Day']; const clubDetails = [club.name, event.location, 'No']; @@ -52,7 +56,10 @@ export default async function EventsPage({ params }: Params) {
{session && ( - + )}
diff --git a/src/app/events/eventView.tsx b/src/app/events/eventView.tsx index 86d97c5a..dfaed368 100644 --- a/src/app/events/eventView.tsx +++ b/src/app/events/eventView.tsx @@ -14,13 +14,13 @@ const EventView = ({ events, params }: Props) => { return (
-
+

Events

{
-

List view

+

List view

{
-

Grid view

+

Grid view

-
+
{events.map((event) => { diff --git a/src/app/feedback/Form.tsx b/src/app/feedback/Form.tsx index 9dc02c4f..65f075c6 100644 --- a/src/app/feedback/Form.tsx +++ b/src/app/feedback/Form.tsx @@ -126,4 +126,3 @@ const Form = () => { }; export default Form; - diff --git a/src/app/feedback/FormPopUp.tsx b/src/app/feedback/FormPopUp.tsx index 44040b46..6b882ac8 100644 --- a/src/app/feedback/FormPopUp.tsx +++ b/src/app/feedback/FormPopUp.tsx @@ -43,4 +43,3 @@ const FormPopUp: React.FC = ({ onClose, isOpen }) => { }; export default FormPopUp; - diff --git a/src/app/feedback/page.tsx b/src/app/feedback/page.tsx index 62a9e111..38feaa5d 100644 --- a/src/app/feedback/page.tsx +++ b/src/app/feedback/page.tsx @@ -1,8 +1,7 @@ import React from 'react'; import Header from '@src/components/BaseHeader'; import { type Metadata } from 'next'; -import Form from '@src/app/feedback/Form'; - +import Form from '@src/app/feedback/Form'; export const metadata: Metadata = { title: 'Feedback - Jupiter', @@ -16,15 +15,13 @@ export const metadata: Metadata = { }, }; - const Feedback = () => { - return (
-
-
+
+
diff --git a/src/components/EventLikeButton.tsx b/src/components/EventLikeButton.tsx index 5edd118b..59588782 100644 --- a/src/components/EventLikeButton.tsx +++ b/src/components/EventLikeButton.tsx @@ -29,9 +29,9 @@ const EventLikeButton = ({ eventId, liked }: buttonProps) => { }} > {liked ? ( - + ) : ( - + )} ); diff --git a/src/components/RegisterButton.tsx b/src/components/RegisterButton.tsx index 905cafb0..58b9b5fb 100644 --- a/src/components/RegisterButton.tsx +++ b/src/components/RegisterButton.tsx @@ -38,4 +38,3 @@ const RegisterButton: FC = ({ eventId, isRegistered }) => { }; export default RegisterButton; - diff --git a/src/server/api/routers/form.ts b/src/server/api/routers/form.ts index 457f6d5d..af42934d 100644 --- a/src/server/api/routers/form.ts +++ b/src/server/api/routers/form.ts @@ -2,24 +2,24 @@ import { createTRPCRouter, publicProcedure } from '../trpc'; import { forms } from '@src/server/db/schema/forms'; import { feedbackFormSchema } from '@src/utils/formSchemas'; - export const formRouter = createTRPCRouter({ - sendForm: publicProcedure. - input(feedbackFormSchema). - mutation( async ( {input, ctx}) => { - const { rating, likes, dislikes, features, submit_on } = input; + sendForm: publicProcedure + .input(feedbackFormSchema) + .mutation(async ({ input, ctx }) => { + const { rating, likes, dislikes, features, submit_on } = input; - await ctx.db - .insert(forms) - .values({ - rating: rating, - likes : likes, - dislikes: dislikes, - features: features, - submit_on: submit_on, - }).catch ((e) => { - console.error(e); - throw e; - }) - } ) - }) \ No newline at end of file + await ctx.db + .insert(forms) + .values({ + rating: rating, + likes: likes, + dislikes: dislikes, + features: features, + submit_on: submit_on, + }) + .catch((e) => { + console.error(e); + throw e; + }); + }), +}); diff --git a/src/server/db/schema/forms.ts b/src/server/db/schema/forms.ts index dd5fd9da..cdfd092c 100644 --- a/src/server/db/schema/forms.ts +++ b/src/server/db/schema/forms.ts @@ -1,13 +1,13 @@ -import { sql } from "drizzle-orm"; -import { pgTable, text, timestamp, integer } from "drizzle-orm/pg-core" +import { sql } from 'drizzle-orm'; +import { pgTable, text, timestamp, integer } from 'drizzle-orm/pg-core'; -export const forms = pgTable("feedback_form", { - id: text("id") - .default(sql`nanoid(20)`) - .primaryKey(), - rating: integer('rating').notNull(), - likes: text('likes').default(''), - dislikes: text('dislikes').default(''), - features: text('features').default(''), - submit_on: timestamp('submit_on', { withTimezone: true }).notNull(), -}) \ No newline at end of file +export const forms = pgTable('feedback_form', { + id: text('id') + .default(sql`nanoid(20)`) + .primaryKey(), + rating: integer('rating').notNull(), + likes: text('likes').default(''), + dislikes: text('dislikes').default(''), + features: text('features').default(''), + submit_on: timestamp('submit_on', { withTimezone: true }).notNull(), +}); diff --git a/src/utils/formSchemas.ts b/src/utils/formSchemas.ts index c58c9a0b..7c008671 100644 --- a/src/utils/formSchemas.ts +++ b/src/utils/formSchemas.ts @@ -48,4 +48,4 @@ export const feedbackFormSchema = z.object({ dislikes: z.string().default(''), features: z.string().default(''), submit_on: z.date().default(new Date()), -}) \ No newline at end of file +});