SLIGHT change to the role...
This commit is contained in:
parent
e3aebb08f5
commit
1bb292ce4e
6 changed files with 80 additions and 54 deletions
|
@ -1,7 +1,7 @@
|
||||||
enum RoleValue {
|
enum RoleValue {
|
||||||
USER
|
USER
|
||||||
ADMIN
|
ADMIN
|
||||||
MATT
|
VIP
|
||||||
}
|
}
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { AiOutlineClear } from "react-icons/ai";
|
||||||
import { FaShieldAlt } from "react-icons/fa";
|
import { FaShieldAlt } from "react-icons/fa";
|
||||||
import { IoTrashBinOutline } from "react-icons/io5";
|
import { IoTrashBinOutline } from "react-icons/io5";
|
||||||
import { SiGithub, SiGoogle } from "react-icons/si";
|
import { SiGithub, SiGoogle } from "react-icons/si";
|
||||||
|
import { GiStarFormation } from "react-icons/gi";
|
||||||
import { api } from "~/utils/api";
|
import { api } from "~/utils/api";
|
||||||
import type { Role } from "~/utils/types";
|
import type { Role } from "~/utils/types";
|
||||||
import { getServerAuthSession } from "../../server/auth";
|
import { getServerAuthSession } from "../../server/auth";
|
||||||
|
@ -279,6 +280,23 @@ const AdminBody: React.FC = () => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</button>
|
</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
|
<button
|
||||||
className="m-2"
|
className="m-2"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
|
|
|
@ -8,6 +8,7 @@ import Link from "next/link";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { FaShieldAlt } from "react-icons/fa";
|
import { FaShieldAlt } from "react-icons/fa";
|
||||||
import { getServerAuthSession } from "~/server/auth";
|
import { getServerAuthSession } from "~/server/auth";
|
||||||
|
import { GiStarFormation } from "react-icons/gi";
|
||||||
|
|
||||||
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
export const getServerSideProps: GetServerSideProps = async (ctx) => {
|
||||||
const session = await getServerAuthSession(ctx);
|
const session = await getServerAuthSession(ctx);
|
||||||
|
@ -61,6 +62,9 @@ const HomePageBody: React.FC = () => {
|
||||||
{sessionData?.user.role === "ADMIN" && (
|
{sessionData?.user.role === "ADMIN" && (
|
||||||
<FaShieldAlt className="inline-block text-primary" />
|
<FaShieldAlt className="inline-block text-primary" />
|
||||||
)}
|
)}
|
||||||
|
{sessionData?.user.role === "VIP" && (
|
||||||
|
<GiStarFormation className="inline-block text-secondary" />
|
||||||
|
)}
|
||||||
</h1>
|
</h1>
|
||||||
<div className="tabs tabs-boxed border-2 border-cyan-500 mb-4">
|
<div className="tabs tabs-boxed border-2 border-cyan-500 mb-4">
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -311,10 +311,10 @@ const RoomBody: React.FC = ({}) => {
|
||||||
<FaShieldAlt className="inline-block text-primary" />
|
<FaShieldAlt className="inline-block text-primary" />
|
||||||
</div>
|
</div>
|
||||||
)}{" "}
|
)}{" "}
|
||||||
{presenceItem.data.role === "MATT" && (
|
{presenceItem.data.role === "VIP" && (
|
||||||
<div
|
<div
|
||||||
className="tooltip tooltip-secondary"
|
className="tooltip tooltip-secondary"
|
||||||
data-tip="Matt"
|
data-tip="VIP"
|
||||||
>
|
>
|
||||||
<GiStarFormation className="inline-block text-secondary" />
|
<GiStarFormation className="inline-block text-secondary" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -153,7 +153,11 @@ export const userRouter = createTRPCRouter({
|
||||||
.input(
|
.input(
|
||||||
z.object({
|
z.object({
|
||||||
userId: z.string(),
|
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 }) => {
|
.mutation(async ({ ctx, input }) => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ export type EventType = BetterEnum<typeof EventTypes>;
|
||||||
const RoleValues = {
|
const RoleValues = {
|
||||||
ADMIN: "ADMIN",
|
ADMIN: "ADMIN",
|
||||||
USER: "USER",
|
USER: "USER",
|
||||||
MATT: "MATT",
|
VIP: "VIP",
|
||||||
} as const;
|
} as const;
|
||||||
export type Role = BetterEnum<typeof RoleValues>;
|
export type Role = BetterEnum<typeof RoleValues>;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue