SLIGHT change to the role...
This commit is contained in:
parent
f1806ef4a2
commit
c402732f0a
6 changed files with 80 additions and 54 deletions
|
@ -1,7 +1,7 @@
|
|||
enum RoleValue {
|
||||
USER
|
||||
ADMIN
|
||||
MATT
|
||||
VIP
|
||||
}
|
||||
|
||||
generator client {
|
||||
|
|
|
@ -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={() =>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 }) => {
|
||||
|
|
|
@ -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>;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue