Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ckat-1 committed Nov 13, 2024
1 parent 7ee5682 commit 8d4a9dd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
8 changes: 3 additions & 5 deletions src/app/admin/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import AddAdmin from '@src/components/admin/AddAdmin';
export default function Page() {
return (
<div className="m-5 md:pl-72">
<h1 className="text-center text-4xl font-bold text-black">
Admin
</h1>
<AddAdmin/>
<h1 className="text-center text-4xl font-bold text-black">Admin</h1>
<AddAdmin />
</div>
);
}
}
6 changes: 3 additions & 3 deletions src/components/admin/AddAdmin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useState } from 'react';

type AdminState = {
name: string;
userId:string;
userId: string;
};

export default function AddAdmin() {
Expand All @@ -29,7 +29,7 @@ export default function AddAdmin() {
passUser={(user) =>
setPerson({
name: user.name,
userId:user.id, // Set selected role when user is selected
userId: user.id, // Set selected role when user is selected
})
}
/>
Expand All @@ -40,7 +40,7 @@ export default function AddAdmin() {
onClick={() => {
if (!toAdd) return;
mutate({
userId:toAdd.userId
userId: toAdd.userId,
});
}}
disabled={!toAdd || !toAdd.name}
Expand Down
5 changes: 2 additions & 3 deletions src/server/api/routers/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { userMetadataToClubs } from '@src/server/db/schema/users';
import { type DateRange } from 'react-day-picker';
import { admin, carousel } from '@src/server/db/schema/admin';


function isDateRange(value: unknown): value is DateRange {
return Boolean(value && typeof value === 'object' && 'from' in value);
}
Expand Down Expand Up @@ -67,7 +66,7 @@ export const adminRouter = createTRPCRouter({
),
);
}),
addAdmin: adminProcedure
addAdmin: adminProcedure
.input(updateAdmin)
.mutation(async ({ ctx, input }) => {
// Check if the user is already an admin
Expand All @@ -77,7 +76,7 @@ export const adminRouter = createTRPCRouter({
});
if (!exists) {
await ctx.db.insert(admin).values({
userId: input.userId
userId: input.userId,
});
}
return;
Expand Down
5 changes: 1 addition & 4 deletions src/server/db/schema/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ export const clubRoleEnum = pgEnum('member_type', [
'Member',
]);

export const adminRoleEnum = pgEnum('admin_type', [
'Admin',
'Not Admin',
]);
export const adminRoleEnum = pgEnum('admin_type', ['Admin', 'Not Admin']);

export const users = pgTable('user', {
id: text('id').notNull().primaryKey(),
Expand Down
3 changes: 1 addition & 2 deletions src/utils/formSchemas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { z } from 'zod';
import { contactSchema } from './contact';

Expand Down Expand Up @@ -65,4 +64,4 @@ export const editAdminSchema = z.object({
position: z.enum(['Admin']),
})
.array(),
});
});

0 comments on commit 8d4a9dd

Please sign in to comment.