SLIGHT change to the role...

This commit is contained in:
Atridad Lahiji 2023-07-29 13:18:14 -06:00
parent f1806ef4a2
commit c402732f0a
No known key found for this signature in database
GPG key ID: 7CB8245F56BC3880
6 changed files with 80 additions and 54 deletions

View file

@ -1,7 +1,7 @@
enum RoleValue {
USER
ADMIN
MATT
VIP
}
generator client {

View file

@ -5,6 +5,7 @@ import { AiOutlineClear } from "react-icons/ai";
import { FaShieldAlt } from "react-icons/fa";
import { IoTrashBinOutline } from "react-icons/io5";
import { SiGithub, SiGoogle } from "react-icons/si";
import { GiStarFormation } from "react-icons/gi";
import { api } from "~/utils/api";
import type { Role } from "~/utils/types";
import { getServerAuthSession } from "../../server/auth";
@ -279,6 +280,23 @@ const AdminBody: React.FC = () => {
/>
)}
</button>
<button className="m-2">
{user.role === "VIP" ? (
<GiStarFormation
className="text-xl inline-block text-secondary"
onClick={() =>
void setUserRoleHandler(user.id, "USER")
}
/>
) : (
<GiStarFormation
className="text-xl inline-block"
onClick={() =>
void setUserRoleHandler(user.id, "VIP")
}
/>
)}
</button>
<button
className="m-2"
onClick={() =>

View file

@ -8,6 +8,7 @@ import Link from "next/link";
import { useEffect, useState } from "react";
import { FaShieldAlt } from "react-icons/fa";
import { getServerAuthSession } from "~/server/auth";
import { GiStarFormation } from "react-icons/gi";
export const getServerSideProps: GetServerSideProps = async (ctx) => {
const session = await getServerAuthSession(ctx);
@ -61,6 +62,9 @@ const HomePageBody: React.FC = () => {
{sessionData?.user.role === "ADMIN" && (
<FaShieldAlt className="inline-block text-primary" />
)}
{sessionData?.user.role === "VIP" && (
<GiStarFormation className="inline-block text-secondary" />
)}
</h1>
<div className="tabs tabs-boxed border-2 border-cyan-500 mb-4">
<a

View file

@ -311,10 +311,10 @@ const RoomBody: React.FC = ({}) => {
<FaShieldAlt className="inline-block text-primary" />
</div>
)}{" "}
{presenceItem.data.role === "MATT" && (
{presenceItem.data.role === "VIP" && (
<div
className="tooltip tooltip-secondary"
data-tip="Matt"
data-tip="VIP"
>
<GiStarFormation className="inline-block text-secondary" />
</div>

View file

@ -153,7 +153,11 @@ export const userRouter = createTRPCRouter({
.input(
z.object({
userId: z.string(),
role: z.union([z.literal("ADMIN"), z.literal("USER")]),
role: z.union([
z.literal("ADMIN"),
z.literal("USER"),
z.literal("VIP"),
]),
})
)
.mutation(async ({ ctx, input }) => {

View file

@ -10,7 +10,7 @@ export type EventType = BetterEnum<typeof EventTypes>;
const RoleValues = {
ADMIN: "ADMIN",
USER: "USER",
MATT: "MATT",
VIP: "VIP",
} as const;
export type Role = BetterEnum<typeof RoleValues>;