Skip to content

Commit

Permalink
run: formatting check
Browse files Browse the repository at this point in the history
  • Loading branch information
nl32 committed Apr 24, 2024
1 parent eee5488 commit b521676
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 58 deletions.
21 changes: 14 additions & 7 deletions src/app/event/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -52,7 +56,10 @@ export default async function EventsPage({ params }: Params) {
</section>
<section className="flex md:float-right md:my-auto">
{session && (
<RegisterButton eventId={event.id} isRegistered={isRegistered} />
<RegisterButton
eventId={event.id}
isRegistered={isRegistered}
/>
)}
</section>
</div>
Expand Down
16 changes: 8 additions & 8 deletions src/app/events/eventView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const EventView = ({ events, params }: Props) => {

return (
<div className="w-full px-6">
<div className="md:pr-7.5 flex flex-col pt-4 sm:flex-row sm:pb-12">
<div className="flex flex-col pt-4 sm:flex-row sm:pb-12 md:pr-7.5">
<h1 className="text-left text-2xl font-bold text-[#4D5E80]">Events</h1>
<div className="relative z-0 hidden flex-row gap-x-16 md:ml-auto md:flex">
<Link
className={`z-20 flex flex-row items-center gap-x-4 ${
view === 'list'
? ' -mr-7.5 px-7.5 rounded-full bg-white py-2.5'
? ' -mr-7.5 rounded-full bg-white px-7.5 py-2.5'
: ''
}`}
href={{
Expand All @@ -34,12 +34,12 @@ const EventView = ({ events, params }: Props) => {
<div className="h-7.5 w-7.5">
<ListIcon />
</div>
<p className="text-blue-primary text-sm font-bold">List view</p>
<p className="text-sm font-bold text-blue-primary">List view</p>
</Link>
<Link
className={`z-20 flex flex-row items-center gap-x-4 ${
view == 'grid'
? '-ml-7.5 px-7.5 rounded-full bg-white py-2.5'
? '-ml-7.5 rounded-full bg-white px-7.5 py-2.5'
: 'mr-7.5'
}`}
href={{
Expand All @@ -53,18 +53,18 @@ const EventView = ({ events, params }: Props) => {
<div className="h-7.5 w-7.5">
<GridIcon />
</div>
<p className="text-blue-primary text-sm font-bold">Grid view</p>
<p className="text-sm font-bold text-blue-primary">Grid view</p>
</Link>
</div>
</div>
<div className="sm:space-x-7.5 container flex w-full flex-col overflow-x-clip sm:flex-row">
<div className="container flex w-full flex-col overflow-x-clip sm:flex-row sm:space-x-7.5">
<EventSidebar />
<div
data-view={view}
className={
view === 'list'
? 'space-y-7.5 group flex flex-col pt-10 sm:justify-start'
: 'gap-y-7.5 group flex flex-wrap justify-center gap-x-10 pt-10 sm:justify-start'
? 'group flex flex-col space-y-7.5 pt-10 sm:justify-start'
: 'group flex flex-wrap justify-center gap-x-10 gap-y-7.5 pt-10 sm:justify-start'
}
>
{events.map((event) => {
Expand Down
1 change: 0 additions & 1 deletion src/app/feedback/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,3 @@ const Form = () => {
};

export default Form;

1 change: 0 additions & 1 deletion src/app/feedback/FormPopUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ const FormPopUp: React.FC<formPopUpProps> = ({ onClose, isOpen }) => {
};

export default FormPopUp;

9 changes: 3 additions & 6 deletions src/app/feedback/page.tsx
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -16,15 +15,13 @@ export const metadata: Metadata = {
},
};


const Feedback = () => {

return (
<main className="h-full md:pl-72 ">
<Header />

<div className="flex h-full w-full flex-row mb-20 " >
<section className='bg-white m-auto justift-center items-center text-center py-6 px-10 shadow-lg rounded-lg mt-3'>
<div className="mb-20 flex h-full w-full flex-row ">
<section className="justift-center m-auto mt-3 items-center rounded-lg bg-white px-10 py-6 text-center shadow-lg">
<Form />
</section>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/EventLikeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const EventLikeButton = ({ eventId, liked }: buttonProps) => {
}}
>
{liked ? (
<CheckIcon fill = "fill-slate-800"/>
<CheckIcon fill="fill-slate-800" />
) : (
<PlusIcon fill = "fill-slate-800"/>
<PlusIcon fill="fill-slate-800" />
)}
</button>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/RegisterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ const RegisterButton: FC<RegisterButtonProps> = ({ eventId, isRegistered }) => {
};

export default RegisterButton;

38 changes: 19 additions & 19 deletions src/server/api/routers/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
} )
})
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;
});
}),
});
24 changes: 12 additions & 12 deletions src/server/db/schema/forms.ts
Original file line number Diff line number Diff line change
@@ -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(),
})
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(),
});
2 changes: 1 addition & 1 deletion src/utils/formSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ export const feedbackFormSchema = z.object({
dislikes: z.string().default(''),
features: z.string().default(''),
submit_on: z.date().default(new Date()),
})
});

0 comments on commit b521676

Please sign in to comment.