From e40f07211f5f15dcb138e2520a76d13afd3c0cfd Mon Sep 17 00:00:00 2001
From: FifthWit <fifthwitbusiness@gmail.com>
Date: Thu, 30 Jan 2025 10:44:30 -0600
Subject: formatted with prettier

---
 frontend/src/components/Discussions.tsx | 70 ++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 35 deletions(-)

(limited to 'frontend/src/components/Discussions.tsx')

diff --git a/frontend/src/components/Discussions.tsx b/frontend/src/components/Discussions.tsx
index 62a9fc7..994cd8e 100644
--- a/frontend/src/components/Discussions.tsx
+++ b/frontend/src/components/Discussions.tsx
@@ -1,16 +1,16 @@
-import React from "react";
+import React from 'react';
 
 import {
   MapDiscussion,
   MapDiscussions,
   MapDiscussionsDetail,
-} from "@customTypes/Map";
-import { MapDiscussionContent } from "@customTypes/Content";
-import { time_ago } from "@utils/Time";
-import { API } from "@api/Api";
-import "@css/Maps.css";
-import { Link } from "react-router-dom";
-import useConfirm from "@hooks/UseConfirm";
+} from '@customTypes/Map';
+import { MapDiscussionContent } from '@customTypes/Content';
+import { time_ago } from '@utils/Time';
+import { API } from '@api/Api';
+import '@css/Maps.css';
+import { Link } from 'react-router-dom';
+import useConfirm from '@hooks/UseConfirm';
 
 interface DiscussionsProps {
   token?: string;
@@ -32,17 +32,17 @@ const Discussions: React.FC<DiscussionsProps> = ({
   const [discussionThread, setDiscussionThread] = React.useState<
     MapDiscussion | undefined
   >(undefined);
-  const [discussionSearch, setDiscussionSearch] = React.useState<string>("");
+  const [discussionSearch, setDiscussionSearch] = React.useState<string>('');
 
   const [createDiscussion, setCreateDiscussion] =
     React.useState<boolean>(false);
   const [createDiscussionContent, setCreateDiscussionContent] =
     React.useState<MapDiscussionContent>({
-      title: "",
-      content: "",
+      title: '',
+      content: '',
     });
   const [createDiscussionCommentContent, setCreateDiscussionCommentContent] =
-    React.useState<string>("");
+    React.useState<string>('');
 
   const _open_map_discussion = async (discussion_id: number) => {
     const mapDiscussion = await API.get_map_discussion(mapID, discussion_id);
@@ -72,7 +72,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
   const _delete_map_discussion = async (discussion: MapDiscussionsDetail) => {
     if (
       await confirm(
-        "Delete Map Discussion",
+        'Delete Map Discussion',
         `Are you sure you want to remove post: ${discussion.title}?`
       )
     ) {
@@ -90,8 +90,8 @@ const Discussions: React.FC<DiscussionsProps> = ({
         <input
           type="text"
           value={discussionSearch}
-          placeholder={"Search for posts..."}
-          onChange={(e) => setDiscussionSearch(e.target.value)}
+          placeholder={'Search for posts...'}
+          onChange={e => setDiscussionSearch(e.target.value)}
         />
         <div>
           <button onClick={() => setCreateDiscussion(true)}>New Post</button>
@@ -104,11 +104,11 @@ const Discussions: React.FC<DiscussionsProps> = ({
           <div id="discussion-create">
             <span>Create Post</span>
             <button onClick={() => setCreateDiscussion(false)}>X</button>
-            <div style={{ gridColumn: "1 / span 2" }}>
+            <div style={{ gridColumn: '1 / span 2' }}>
               <input
                 id="discussion-create-title"
                 placeholder="Title..."
-                onChange={(e) =>
+                onChange={e =>
                   setCreateDiscussionContent({
                     ...createDiscussionContent,
                     title: e.target.value,
@@ -118,7 +118,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
               <input
                 id="discussion-create-content"
                 placeholder="Enter the content..."
-                onChange={(e) =>
+                onChange={e =>
                   setCreateDiscussionContent({
                     ...createDiscussionContent,
                     content: e.target.value,
@@ -126,7 +126,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
                 }
               />
             </div>
-            <div style={{ placeItems: "end", gridColumn: "1 / span 2" }}>
+            <div style={{ placeItems: 'end', gridColumn: '1 / span 2' }}>
               <button
                 id="discussion-create-button"
                 onClick={() => _create_map_discussion()}
@@ -157,8 +157,8 @@ const Discussions: React.FC<DiscussionsProps> = ({
                   {time_ago(
                     new Date(
                       discussionThread.discussion.created_at
-                        .replace("T", " ")
-                        .replace("Z", "")
+                        .replace('T', ' ')
+                        .replace('Z', '')
                     )
                   )}
                 </span>
@@ -170,7 +170,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
                       (a, b) =>
                         new Date(a.date).getTime() - new Date(b.date).getTime()
                     )
-                    .map((e) => (
+                    .map(e => (
                       <>
                         <Link to={`/users/${e.user.steam_id}`}>
                           <img src={e.user.avatar_link} alt="" />
@@ -180,7 +180,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
                           <span>
                             {time_ago(
                               new Date(
-                                e.date.replace("T", " ").replace("Z", "")
+                                e.date.replace('T', ' ').replace('Z', '')
                               )
                             )}
                           </span>
@@ -188,29 +188,29 @@ const Discussions: React.FC<DiscussionsProps> = ({
                         </div>
                       </>
                     ))
-                : ""}
+                : ''}
             </div>
             <div id="discussion-send">
               <input
                 type="text"
                 value={createDiscussionCommentContent}
-                placeholder={"Message"}
-                onKeyDown={(e) =>
-                  e.key === "Enter" &&
+                placeholder={'Message'}
+                onKeyDown={e =>
+                  e.key === 'Enter' &&
                   _create_map_discussion_comment(discussionThread.discussion.id)
                 }
-                onChange={(e) =>
+                onChange={e =>
                   setCreateDiscussionCommentContent(e.target.value)
                 }
               />
               <div>
                 <button
                   onClick={() => {
-                    if (createDiscussionCommentContent !== "") {
+                    if (createDiscussionCommentContent !== '') {
                       _create_map_discussion_comment(
                         discussionThread.discussion.id
                       );
-                      setCreateDiscussionCommentContent("");
+                      setCreateDiscussionCommentContent('');
                     }
                   }}
                 >
@@ -222,7 +222,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
         ) : data ? (
           <>
             {data.discussions
-              .filter((f) => f.title.includes(discussionSearch))
+              .filter(f => f.title.includes(discussionSearch))
               .sort(
                 (a, b) =>
                   new Date(b.updated_at).getTime() -
@@ -234,7 +234,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
                     <span>{e.title}</span>
                     {isModerator ? (
                       <button
-                        onClick={(m) => {
+                        onClick={m => {
                           m.stopPropagation();
                           _delete_map_discussion(e);
                         }}
@@ -248,10 +248,10 @@ const Discussions: React.FC<DiscussionsProps> = ({
                       <b>{e.creator.user_name}:</b> {e.content}
                     </span>
                     <span>
-                      Last Updated:{" "}
+                      Last Updated:{' '}
                       {time_ago(
                         new Date(
-                          e.updated_at.replace("T", " ").replace("Z", "")
+                          e.updated_at.replace('T', ' ').replace('Z', '')
                         )
                       )}
                     </span>
@@ -260,7 +260,7 @@ const Discussions: React.FC<DiscussionsProps> = ({
               ))}
           </>
         ) : (
-          <span style={{ textAlign: "center", display: "block" }}>
+          <span style={{ textAlign: 'center', display: 'block' }}>
             No Discussions...
           </span>
         )
-- 
cgit v1.2.3

