From 0f7fb11f4e7e510efa7944ff32062cc224a6f6c4 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 4 Jan 2024 22:01:50 +0000 Subject: [PATCH] Removed unused modals & kept import conssistency with @ --- components/modals/connect-twitch-modal.tsx | 139 ------------------ components/modals/tts-badge-filter-modal.tsx | 109 -------------- components/modals/tts-cheers-filter-modal.tsx | 0 .../modals/tts-subscription-filter-modal.tsx | 0 .../modals/tts-username-filter-modal.tsx | 0 components/navigation/adminprofile.tsx | 4 +- components/navigation/settings.tsx | 4 +- 7 files changed, 4 insertions(+), 252 deletions(-) delete mode 100644 components/modals/connect-twitch-modal.tsx delete mode 100644 components/modals/tts-badge-filter-modal.tsx delete mode 100644 components/modals/tts-cheers-filter-modal.tsx delete mode 100644 components/modals/tts-subscription-filter-modal.tsx delete mode 100644 components/modals/tts-username-filter-modal.tsx diff --git a/components/modals/connect-twitch-modal.tsx b/components/modals/connect-twitch-modal.tsx deleted file mode 100644 index 62261d7..0000000 --- a/components/modals/connect-twitch-modal.tsx +++ /dev/null @@ -1,139 +0,0 @@ -"use client"; - -import axios from "axios" -import { db } from "@/lib/db"; -import { Button } from "@/components/ui/button"; -import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; -import { Input } from "@/components/ui/input"; - -import * as z from "zod"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { useEffect, useState } from "react"; -import { useRouter } from "next/navigation"; -import { cn } from "@/lib/utils"; - - -const formSchema = z.object({ - id: z.string().trim().min(12, { - message: "Client ID should be at least 12 characters." - }), - secret: z.string().trim().min(12, { - message: "Client secret should be at least 12 characters." - }) -}); - -export const ConnectTwitchModal = () => { - const [isMounted, setIsMounted] = useState(false); - const [twitchError, setTwitchError] = useState("") - - useEffect(() => { - setIsMounted(true); - }, []); - - const router = useRouter(); - const form = useForm({ - resolver: zodResolver(formSchema), - defaultValues: { - id: "", - secret: "" - } - }); - - const isLoading = form.formState.isSubmitting; - - if (!isMounted) { - return null; - } - - const onSubmit = async (values: z.infer) => { - setTwitchError(""); - - try { - const response = await axios.post("/api/settings/connections/twitch", values); - console.log(response.data); - } catch (error) { - setTwitchError("Invalid client id and client secret combination."); - console.log("[CONNECTIONS/TWITCH/POST]", error); - return; - } - - form.reset(); - router.refresh(); - window.location.reload(); - } - - return ( - - - - - - - Connect Your Twitch Account - Provide permission to access your twitch account & read chat. - -
0 && "block px-5 py-2 bg-[#FF0000] text-center items-center justify-center")}> - {twitchError} -
-
- -
- ( - - - Client ID - - - - - - - )} - /> -
- -
- ( - - - Client secret - - - - - - - )} - /> - - - - -
-
- -
-
- ); -} \ No newline at end of file diff --git a/components/modals/tts-badge-filter-modal.tsx b/components/modals/tts-badge-filter-modal.tsx deleted file mode 100644 index 249b129..0000000 --- a/components/modals/tts-badge-filter-modal.tsx +++ /dev/null @@ -1,109 +0,0 @@ -"use client"; - -import axios from "axios" -import { Button } from "@/components/ui/button"; -import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; -import { Input } from "@/components/ui/input"; - -import * as z from "zod"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; -import { useEffect, useState } from "react"; -import { useRouter } from "next/navigation"; -import { Info } from "lucide-react"; -import { Toggle } from "../ui/toggle"; -import { TtsBadgeFilter, TwitchConnection } from "@prisma/client"; - -const formSchema = z.object({ - whitelist: z.string().trim().array(), - blacklist: z.string().trim().array() -}); - -export const TTSBadgeFilterModal = () => { - const [isMounted, setIsMounted] = useState(false); - - useEffect(() => { - setIsMounted(true); - }, []); - - const router = useRouter(); - const form = useForm({ - resolver: zodResolver(formSchema), - defaultValues: { - whitelist: z.string().trim().array(), - blacklist: z.string().trim().array() - } - }); - - const isLoading = form.formState.isSubmitting; - - const onSubmit = async (values: z.infer) => { - let response = null; - - // try { - // response = await axios.post("/api/settings/tts/filter/badges", values); - // } catch (error) { - // console.log("[CONNECTIONS/TWITCH/POST]", error); - // return; - // } - - form.reset(); - router.refresh(); - window.location.reload(); - } - - if (!isMounted) { - return null; - } - - const badges: TtsBadgeFilter[] = [] //(await axios.get("/api/settings/tts/filter/badges")).data - - return ( - - - - - - - TTS Badge Filter - Limit messages spoken by TTS by badges. - -
- - {badges.map((badge) => ( -
- { - return ( - - - {badge.badgeId} - - - ) - }} - /> -
- ))} - - - -
- -
-
- ); -} \ No newline at end of file diff --git a/components/modals/tts-cheers-filter-modal.tsx b/components/modals/tts-cheers-filter-modal.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/components/modals/tts-subscription-filter-modal.tsx b/components/modals/tts-subscription-filter-modal.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/components/modals/tts-username-filter-modal.tsx b/components/modals/tts-username-filter-modal.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/components/navigation/adminprofile.tsx b/components/navigation/adminprofile.tsx index cd84269..beee0f8 100644 --- a/components/navigation/adminprofile.tsx +++ b/components/navigation/adminprofile.tsx @@ -6,10 +6,10 @@ import { useEffect, useState } from "react"; import { useSession } from "next-auth/react"; import { cn } from "@/lib/utils"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover" -import { Button } from "../ui/button"; +import { Button } from "@/components/ui/button"; import { Check, ChevronsUpDown } from "lucide-react"; import { User } from "@prisma/client"; -import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from "../ui/command"; +import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from "@/components/ui/command"; const AdminProfile = () => { diff --git a/components/navigation/settings.tsx b/components/navigation/settings.tsx index 3d4c3af..065b840 100644 --- a/components/navigation/settings.tsx +++ b/components/navigation/settings.tsx @@ -1,8 +1,8 @@ import Link from "next/link"; -import { Button } from "../ui/button"; +import { Button } from "@/components/ui/button"; import UserProfile from "./userprofile"; import AdminProfile from "./adminprofile"; -import RoleGate from "../auth/role-gate"; +import RoleGate from "@/components/auth/role-gate"; const SettingsNavigation = async () => { return (