From bbab44277bf825fd7e31a616a79fb06eae2b29c3 Mon Sep 17 00:00:00 2001 From: night0721 Date: Wed, 17 Nov 2021 05:52:23 +0800 Subject: [PATCH] formatted code --- .gitignore | 2 + chakra_config/theme.js | 14 +- components/AuthButton.js | 78 +- components/CTA.js | 49 +- components/Card.js | 58 +- components/Sidebar/Sidebar.js | 341 +- components/StatCard.js | 117 +- components/Testimonials/Testimonials.js | 310 +- next.config.js | 2 +- package.json | 13 +- pages/404.js | 16 +- pages/_app.js | 49 +- pages/api/auth/[...nextauth].js | 26 +- pages/api/hello.js | 5 - pages/controlpanel/commands.js | 164 +- pages/controlpanel/index.js | 117 +- pages/index.js | 113 +- yarn.lock | 4911 ----------------------- 18 files changed, 784 insertions(+), 5601 deletions(-) delete mode 100644 pages/api/hello.js delete mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index 74b7586..9f5aeb6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ # dependencies /node_modules +package-lock.json +yarn.lock /.pnp .pnp.js diff --git a/chakra_config/theme.js b/chakra_config/theme.js index 6bb045e..d389c5f 100644 --- a/chakra_config/theme.js +++ b/chakra_config/theme.js @@ -1,9 +1,7 @@ -import { extendTheme, ThemeConfig } from "@chakra-ui/react" -// 2. Add your color mode config +import { extendTheme, ThemeConfig } from "@chakra-ui/react"; const config = { - initialColorMode: "dark", - useSystemColorMode: false, -} -// 3. extend the theme -const theme = extendTheme({ config }) -export default theme \ No newline at end of file + initialColorMode: "dark", + useSystemColorMode: false, +}; +const theme = extendTheme({ config }); +export default theme; diff --git a/components/AuthButton.js b/components/AuthButton.js index e6e6433..b40db18 100644 --- a/components/AuthButton.js +++ b/components/AuthButton.js @@ -1,39 +1,47 @@ -import { signIn, signOut, useSession } from 'next-auth/client' -import {Button} from '@chakra-ui/react' +import { signIn, signOut, useSession } from "next-auth/client"; +import { Button } from "@chakra-ui/react"; export default function Page() { - const [session, loading] = useSession() + const [session, loading] = useSession(); - return <> - {!session && <> - - } - {session && <> - - } + return ( + <> + {!session && ( + <> + + + )} + {session && ( + <> + + + )} -} \ No newline at end of file + ); +} diff --git a/components/CTA.js b/components/CTA.js index b25875a..bb36201 100644 --- a/components/CTA.js +++ b/components/CTA.js @@ -1,24 +1,31 @@ -import { Box, Button, Heading, Text } from '@chakra-ui/react' -import * as React from 'react' +import { Box, Button, Heading, Text } from "@chakra-ui/react"; +import * as React from "react"; export const CTA = () => ( - - - - Convinced? - - - Start using Cath.exe in your servers now - - - + + + + Convinced? + + + Start using Cath.exe in your servers now + + -) + +); diff --git a/components/Card.js b/components/Card.js index 9011aa9..25c8bbc 100644 --- a/components/Card.js +++ b/components/Card.js @@ -1,28 +1,40 @@ -import React from 'react' -import Link from 'next/link' -import {Text, Flex, Button} from '@chakra-ui/react' -import {motion} from 'framer-motion' +import React from "react"; +import Link from "next/link"; +import { Text, Flex, Button } from "@chakra-ui/react"; +import { motion } from "framer-motion"; -const MotionFlex = motion(Flex) +const MotionFlex = motion(Flex); const item = { - hidden: { y: 20, opacity: 0 }, - visible: { - y: 0, - opacity: 1 - } + hidden: { y: 20, opacity: 0 }, + visible: { + y: 0, + opacity: 1, + }, +}; + +function Card({ title, desc, link }) { + return ( + + + {title} + + {desc} + + + + + ); } -function Card({title, desc, link}) { - return ( - - - {title} - {desc} - - - - ) -} - -export default Card +export default Card; diff --git a/components/Sidebar/Sidebar.js b/components/Sidebar/Sidebar.js index 6c2a092..f7c8e90 100644 --- a/components/Sidebar/Sidebar.js +++ b/components/Sidebar/Sidebar.js @@ -1,187 +1,180 @@ import { - Avatar, - Box, - Collapse, - Drawer, - DrawerContent, - DrawerOverlay, - Flex, - Icon, - IconButton, - Input, - InputGroup, - InputLeftElement, - Text, - useColorModeValue, - useDisclosure, + Avatar, + Box, + Collapse, + Drawer, + DrawerContent, + DrawerOverlay, + Flex, + Icon, + IconButton, + Input, + InputGroup, + InputLeftElement, + Text, + useColorModeValue, + useDisclosure, } from "@chakra-ui/react"; import { FaBell } from "react-icons/fa"; import { AiFillGift } from "react-icons/ai"; import { FiMenu, FiSearch } from "react-icons/fi"; import { HiCode } from "react-icons/hi"; import { MdKeyboardArrowRight, MdHome } from "react-icons/md"; -import AuthButton from '../AuthButton' -import Link from 'next/link' +import AuthButton from "../AuthButton"; +import Link from "next/link"; import React from "react"; -import {session} from 'next-auth/client' +import { session } from "next-auth/client"; -export default function Sidebar({children}) { - const sidebar = useDisclosure(); - const integrations = useDisclosure(); +export default function Sidebar({ children }) { + const sidebar = useDisclosure(); + const integrations = useDisclosure(); - const NavItem = (props) => { - const { icon, children, ...rest } = props; - return ( - - {icon && ( - - )} - {children} - - ); - }; - - const SidebarContent = (props) => ( - - - - - Cath.exe - - - - - - Home - - - Control Panel - - - - - - Main - - - - - Commands - - - - Coming Soon - - - - ); + const NavItem = props => { + const { icon, children, ...rest } = props; return ( - - - - - - - - - - - } - size="sm" - /> - - - - - - - - - - - {children} - - - + + {icon && ( + + )} + {children} + ); + }; + + const SidebarContent = props => ( + + + + + Cath.exe + + + + + + Home + + + Control Panel + + + + + + Main + + + + + Commands + + + + Coming Soon + + + + ); + return ( + + + + + + + + + + + } + size="sm" + /> + + + + + + + + + + {children} + + + + ); } diff --git a/components/StatCard.js b/components/StatCard.js index 1322a82..d458d8c 100644 --- a/components/StatCard.js +++ b/components/StatCard.js @@ -1,60 +1,81 @@ import { - Stat, - StatLabel, - StatNumber, - StatHelpText, - StatArrow, - StatGroup, -} from "@chakra-ui/react" + Stat, + StatLabel, + StatNumber, + StatHelpText, + StatArrow, + StatGroup, +} from "@chakra-ui/react"; -import React from 'react' -import { motion } from 'framer-motion' +import React from "react"; +import { motion } from "framer-motion"; const container = { - hidden: { opacity: 1, scale: 0 }, - visible: { - opacity: 1, - scale: 1, - transition: { - delayChildren: 0.4, - staggerChildren: 0.3 - } - } -} + hidden: { opacity: 1, scale: 0 }, + visible: { + opacity: 1, + scale: 1, + transition: { + delayChildren: 0.4, + staggerChildren: 0.3, + }, + }, +}; const item = { - hidden: { y: 20, opacity: 0 }, - visible: { - y: 0, - opacity: 1 - } -} + hidden: { y: 20, opacity: 0 }, + visible: { + y: 0, + opacity: 1, + }, +}; -const MotionStatGroup = motion(StatGroup) -const MotionStat = motion(Stat) +const MotionStatGroup = motion(StatGroup); +const MotionStat = motion(Stat); function StatCard() { - return ( - - - User Growth - 77 - - - 11.36% - - + return ( + + + User Growth + 77 + + + 11.36% + + - - Activity - 45 messages - - - 9.05% - - - - ) + + Activity + 45 messages + + + 9.05% + + + + ); } -export default StatCard \ No newline at end of file +export default StatCard; diff --git a/components/Testimonials/Testimonials.js b/components/Testimonials/Testimonials.js index 04f0054..723b234 100644 --- a/components/Testimonials/Testimonials.js +++ b/components/Testimonials/Testimonials.js @@ -1,169 +1,167 @@ import { - Avatar, - Box, - chakra, - Container, - Flex, - Icon, - SimpleGrid, - useColorModeValue, -} from '@chakra-ui/react'; + Avatar, + Box, + chakra, + Container, + Flex, + Icon, + SimpleGrid, + useColorModeValue, +} from "@chakra-ui/react"; const testimonials = [ - { - name: 'John Doe', - role: 'Chief Marketing Officer', - content: - 'Remarkable', - avatar: - 'https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', - }, - { - name: 'John Doe', - role: 'Chief Marketing Officer', - content: - 'Remarkable', - avatar: - 'https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', - }, - { - name: 'John Doe', - role: 'Chief Marketing Officer', - content: - 'Remarkable', - avatar: - 'https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', - }, - { - name: 'John Doe', - role: 'Chief Marketing Officer', - content: - 'Remarkable', - avatar: - 'https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80', - }, + { + name: "John Doe", + role: "Chief Marketing Officer", + content: "Remarkable", + avatar: + "https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80", + }, + { + name: "John Doe", + role: "Chief Marketing Officer", + content: "Remarkable", + avatar: + "https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80", + }, + { + name: "John Doe", + role: "Chief Marketing Officer", + content: "Remarkable", + avatar: + "https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80", + }, + { + name: "John Doe", + role: "Chief Marketing Officer", + content: "Remarkable", + avatar: + "https://images.unsplash.com/photo-1603415526960-f7e0328c63b1?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=334&q=80", + }, ]; const backgrounds = [ - `url("data:image/svg+xml, %3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'560\' height=\'185\' viewBox=\'0 0 560 185\' fill=\'none\'%3E%3Cellipse cx=\'102.633\' cy=\'61.0737\' rx=\'102.633\' ry=\'61.0737\' fill=\'%23ED64A6\' /%3E%3Cellipse cx=\'399.573\' cy=\'123.926\' rx=\'102.633\' ry=\'61.0737\' fill=\'%23F56565\' /%3E%3Cellipse cx=\'366.192\' cy=\'73.2292\' rx=\'193.808\' ry=\'73.2292\' fill=\'%2338B2AC\' /%3E%3Cellipse cx=\'222.705\' cy=\'110.585\' rx=\'193.808\' ry=\'73.2292\' fill=\'%23ED8936\' /%3E%3C/svg%3E")`, - `url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='185' viewBox='0 0 560 185' fill='none'%3E%3Cellipse cx='457.367' cy='123.926' rx='102.633' ry='61.0737' transform='rotate(-180 457.367 123.926)' fill='%23ED8936'/%3E%3Cellipse cx='160.427' cy='61.0737' rx='102.633' ry='61.0737' transform='rotate(-180 160.427 61.0737)' fill='%2348BB78'/%3E%3Cellipse cx='193.808' cy='111.771' rx='193.808' ry='73.2292' transform='rotate(-180 193.808 111.771)' fill='%230BC5EA'/%3E%3Cellipse cx='337.295' cy='74.415' rx='193.808' ry='73.2292' transform='rotate(-180 337.295 74.415)' fill='%23ED64A6'/%3E%3C/svg%3E")`, - `url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='185' viewBox='0 0 560 185' fill='none'%3E%3Cellipse cx='102.633' cy='61.0737' rx='102.633' ry='61.0737' fill='%23ED8936'/%3E%3Cellipse cx='399.573' cy='123.926' rx='102.633' ry='61.0737' fill='%2348BB78'/%3E%3Cellipse cx='366.192' cy='73.2292' rx='193.808' ry='73.2292' fill='%230BC5EA'/%3E%3Cellipse cx='222.705' cy='110.585' rx='193.808' ry='73.2292' fill='%23ED64A6'/%3E%3C/svg%3E")`, - `url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='185' viewBox='0 0 560 185' fill='none'%3E%3Cellipse cx='457.367' cy='123.926' rx='102.633' ry='61.0737' transform='rotate(-180 457.367 123.926)' fill='%23ECC94B'/%3E%3Cellipse cx='160.427' cy='61.0737' rx='102.633' ry='61.0737' transform='rotate(-180 160.427 61.0737)' fill='%239F7AEA'/%3E%3Cellipse cx='193.808' cy='111.771' rx='193.808' ry='73.2292' transform='rotate(-180 193.808 111.771)' fill='%234299E1'/%3E%3Cellipse cx='337.295' cy='74.415' rx='193.808' ry='73.2292' transform='rotate(-180 337.295 74.415)' fill='%2348BB78'/%3E%3C/svg%3E")`, + `url("data:image/svg+xml, %3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'560\' height=\'185\' viewBox=\'0 0 560 185\' fill=\'none\'%3E%3Cellipse cx=\'102.633\' cy=\'61.0737\' rx=\'102.633\' ry=\'61.0737\' fill=\'%23ED64A6\' /%3E%3Cellipse cx=\'399.573\' cy=\'123.926\' rx=\'102.633\' ry=\'61.0737\' fill=\'%23F56565\' /%3E%3Cellipse cx=\'366.192\' cy=\'73.2292\' rx=\'193.808\' ry=\'73.2292\' fill=\'%2338B2AC\' /%3E%3Cellipse cx=\'222.705\' cy=\'110.585\' rx=\'193.808\' ry=\'73.2292\' fill=\'%23ED8936\' /%3E%3C/svg%3E")`, + `url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='185' viewBox='0 0 560 185' fill='none'%3E%3Cellipse cx='457.367' cy='123.926' rx='102.633' ry='61.0737' transform='rotate(-180 457.367 123.926)' fill='%23ED8936'/%3E%3Cellipse cx='160.427' cy='61.0737' rx='102.633' ry='61.0737' transform='rotate(-180 160.427 61.0737)' fill='%2348BB78'/%3E%3Cellipse cx='193.808' cy='111.771' rx='193.808' ry='73.2292' transform='rotate(-180 193.808 111.771)' fill='%230BC5EA'/%3E%3Cellipse cx='337.295' cy='74.415' rx='193.808' ry='73.2292' transform='rotate(-180 337.295 74.415)' fill='%23ED64A6'/%3E%3C/svg%3E")`, + `url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='185' viewBox='0 0 560 185' fill='none'%3E%3Cellipse cx='102.633' cy='61.0737' rx='102.633' ry='61.0737' fill='%23ED8936'/%3E%3Cellipse cx='399.573' cy='123.926' rx='102.633' ry='61.0737' fill='%2348BB78'/%3E%3Cellipse cx='366.192' cy='73.2292' rx='193.808' ry='73.2292' fill='%230BC5EA'/%3E%3Cellipse cx='222.705' cy='110.585' rx='193.808' ry='73.2292' fill='%23ED64A6'/%3E%3C/svg%3E")`, + `url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='185' viewBox='0 0 560 185' fill='none'%3E%3Cellipse cx='457.367' cy='123.926' rx='102.633' ry='61.0737' transform='rotate(-180 457.367 123.926)' fill='%23ECC94B'/%3E%3Cellipse cx='160.427' cy='61.0737' rx='102.633' ry='61.0737' transform='rotate(-180 160.427 61.0737)' fill='%239F7AEA'/%3E%3Cellipse cx='193.808' cy='111.771' rx='193.808' ry='73.2292' transform='rotate(-180 193.808 111.771)' fill='%234299E1'/%3E%3Cellipse cx='337.295' cy='74.415' rx='193.808' ry='73.2292' transform='rotate(-180 337.295 74.415)' fill='%2348BB78'/%3E%3C/svg%3E")`, ]; function TestmonialCard(props) { - const { name, role, content, avatar, index } = props; - return ( - - - - {content} - - - {name} - - {' '} - - {role} - - - - - - ); + const { name, role, content, avatar, index } = props; + return ( + + + + {content} + + + {name} + + {" "} + - {role} + + + + + + ); } export default function GridBlurredBackdrop() { - return ( - - - - Users love Cath - - - You're in good company - - - See why over{' '} - - 110000+ - {' '} - users use Cath in their servers - - - - {testimonials.map((cardInfo, index) => ( - - ))} - - - ); + return ( + + + + Users love Cath + + + You're in good company + + + See why over{" "} + + 110000+ + {" "} + users use Cath in their servers + + + + {testimonials.map((cardInfo, index) => ( + + ))} + + + ); } diff --git a/next.config.js b/next.config.js index 0d60710..da1bb77 100644 --- a/next.config.js +++ b/next.config.js @@ -1,3 +1,3 @@ module.exports = { reactStrictMode: true, -} +}; diff --git a/package.json b/package.json index dd07380..ad6b5dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "cath-dashboard", "version": "0.1.0", - "private": true, "scripts": { "dev": "next dev", "build": "next build", @@ -15,17 +14,17 @@ "@emotion/styled": "^11", "@material-ui/core": "^4.11.4", "@material-ui/icons": "^4.11.2", - "axios": "^0.21.1", + "axios": "^0.24.0", "framer-motion": "^4", - "mongodb": "^3.6.9", - "next": "11.0.0", + "mongodb": "^4.1.4", + "next": "^12.0.4", "next-auth": "^3.27.0", - "react": "17.0.2", - "react-dom": "17.0.2", + "react": "^17.0.2", + "react-dom": "^17.0.2", "react-icons": "^4.2.0" }, "devDependencies": { - "eslint": "7.29.0", + "eslint": "^8.2.0", "eslint-config-next": "11.0.0" } } diff --git a/pages/404.js b/pages/404.js index 49ce7ae..824b3f7 100644 --- a/pages/404.js +++ b/pages/404.js @@ -1,12 +1,12 @@ -import Head from 'next/head' +import Head from "next/head"; export default function Custom404() { - return ( + return ( <> - - 404 - -

404 - Page Not Found

+ + 404 + +

404 - Page Not Found

- ) -} \ No newline at end of file + ); +} diff --git a/pages/_app.js b/pages/_app.js index 265209d..bba2dd2 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -1,15 +1,14 @@ -import '../styles/globals.css' -import Head from 'next/head' -import { Provider, useSession } from 'next-auth/client' -import { ChakraProvider } from "@chakra-ui/react" -import Header from '../components/Nav/Header' -import theme from '../chakra_config/theme' -import { ColorModeScript } from "@chakra-ui/react" -import Sidebar from '../components/Sidebar/Sidebar' +import "../styles/globals.css"; +import Head from "next/head"; +import { Provider, useSession } from "next-auth/client"; +import { ChakraProvider } from "@chakra-ui/react"; +import Header from "../components/Nav/Header"; +import theme from "../chakra_config/theme"; +import { ColorModeScript } from "@chakra-ui/react"; +import Sidebar from "../components/Sidebar/Sidebar"; function MyApp({ Component, pageProps }) { - - const [session, loading] = useSession() + const [session, loading] = useSession(); return ( @@ -19,20 +18,24 @@ function MyApp({ Component, pageProps }) { - {!session && -
- -
-
} - {session && <> -
-
- -
- } + {!session && ( + +
+ +
+
+ )} + {session && ( + <> +
+
+ +
+ + )} - ) + ); } -export default MyApp \ No newline at end of file +export default MyApp; diff --git a/pages/api/auth/[...nextauth].js b/pages/api/auth/[...nextauth].js index f63573d..0a49a76 100644 --- a/pages/api/auth/[...nextauth].js +++ b/pages/api/auth/[...nextauth].js @@ -1,16 +1,16 @@ -import NextAuth from 'next-auth' -import Providers from 'next-auth/providers' +import NextAuth from "next-auth"; +import Providers from "next-auth/providers"; export default NextAuth({ - // Configure one or more authentication providers - providers: [ - Providers.Discord({ - clientId: process.env.DISCORD_ID, - clientSecret: process.env.DISCORD_SECRET - }), - // ...add more providers here - ], + // Configure one or more authentication providers + providers: [ + Providers.Discord({ + clientId: process.env.DISCORD_ID, + clientSecret: process.env.DISCORD_SECRET, + }), + // ...add more providers here + ], - // A database is optional, but required to persist accounts in a database - database: process.env.DATABASE_URL, -}) \ No newline at end of file + // A database is optional, but required to persist accounts in a database + database: process.env.DATABASE_URL, +}); diff --git a/pages/api/hello.js b/pages/api/hello.js deleted file mode 100644 index df63de8..0000000 --- a/pages/api/hello.js +++ /dev/null @@ -1,5 +0,0 @@ -// Next.js API route support: https://nextjs.org/docs/api-routes/introduction - -export default function handler(req, res) { - res.status(200).json({ name: 'John Doe' }) -} diff --git a/pages/controlpanel/commands.js b/pages/controlpanel/commands.js index 2cce5e4..906dfa2 100644 --- a/pages/controlpanel/commands.js +++ b/pages/controlpanel/commands.js @@ -1,98 +1,104 @@ -import React from 'react'; +import React from "react"; import { - Table, - Thead, - Tbody, - Tr, - Th, - Td, - TableCaption, - Switch, - Text -} from "@chakra-ui/react" -import Head from 'next/head' -import { useSession } from 'next-auth/client' -import axios from 'axios' -import { FaBullseye } from 'react-icons/fa'; - + Table, + Thead, + Tbody, + Tr, + Th, + Td, + TableCaption, + Switch, + Text, +} from "@chakra-ui/react"; +import Head from "next/head"; +import { useSession } from "next-auth/client"; +import axios from "axios"; +import { FaBullseye } from "react-icons/fa"; function Controller({ initialState }) { - const [online, setOnline] = React.useState(initialState) + const [online, setOnline] = React.useState(initialState); - return ( - { setOnline(!online) }} - /> - ) + return ( + { + setOnline(!online); + }} + /> + ); } function processOnline(status) { - console.log(status) - if (status == 'online') { return true } - if (status == 'offline') { return false } - if (status == 'maintenance') { return false } + console.log(status); + if (status == "online") { + return true; + } + if (status == "offline") { + return false; + } + if (status == "maintenance") { + return false; + } } function Commands() { - const [session, loading] = useSession() + const [session, loading] = useSession(); + const [categories, setCategories] = React.useState([ + { name: "Help", commands: [{ name: "Help", online: true }] }, + ]); - const [categories, setCategories] = React.useState( - [ - { name: 'Help', commands: [ - {name: 'Help', online: true} - ] }, - ] - ) + React.useEffect(() => { + axios + .get("https://api.cath.gq/api/v1/client/commands") + .then(res => setCategories(res.data)); + }, []); - React.useEffect(() => { - axios.get('https://cath.night0721.repl.co/api/commands') - .then(res => setCategories(res.data)) - }, []) - - - return ( + return ( + <> + {session && ( <> - {session && + + Cath Commands + + + Command Controls + + + + + + + + {categories.map((category, idx) => ( <> - - Cath Commands - -
CommandEnabled
- Command Controls - - - - - - - - {categories.map((category, idx) => ( - <> - {category.name} - {category.commands.map((command, commandIdx) => ( - - - - - ))} - - ))} - -
CommandEnabled
{command.name} - -
+ {category.name} + {category.commands.map((command, commandIdx) => ( + + {command.name} + + + + + ))} - } {!session && <> -

Seems like you're not logged in. Log in to get started!

- - } + ))} + + - ); + )}{" "} + {!session && ( + <> +

Seems like you're not logged in. Log in to get started!

+ + )} + + ); } -export default Commands \ No newline at end of file +export default Commands; diff --git a/pages/controlpanel/index.js b/pages/controlpanel/index.js index 55eb1bf..c3ec7ab 100644 --- a/pages/controlpanel/index.js +++ b/pages/controlpanel/index.js @@ -1,58 +1,81 @@ -import React from 'react' -import Card from '../../components/Card' -import Head from 'next/head' -import { useSession } from 'next-auth/client' -import { Flex, Text, Spacer } from "@chakra-ui/react" -import {motion} from 'framer-motion' +import React from "react"; +import Card from "../../components/Card"; +import Head from "next/head"; +import { useSession } from "next-auth/client"; +import { Flex, Text, Spacer } from "@chakra-ui/react"; +import { motion } from "framer-motion"; const container = { - hidden: { opacity: 1, scale: 0 }, - visible: { - opacity: 1, - scale: 1, - transition: { - delayChildren: 0.3, - staggerChildren: 0.2 - } - } -} + hidden: { opacity: 1, scale: 0 }, + visible: { + opacity: 1, + scale: 1, + transition: { + delayChildren: 0.3, + staggerChildren: 0.2, + }, + }, +}; const item = { - hidden: { y: 20, opacity: 0 }, - visible: { - y: 0, - opacity: 1 - } -} + hidden: { y: 20, opacity: 0 }, + visible: { + y: 0, + opacity: 1, + }, +}; function Index() { + const [session, loading] = useSession(); - const [session, loading] = useSession() - - return ( + return ( + <> + {!session && ( <> - {!session && <> -

Seems like you're not logged in. Log in to get started!

- - } - {session && <> - - Cath Control Panel - - Control Panel - - - - - - - - - - - } +

Seems like you're not logged in. Log in to get started!

- ) + )} + {session && ( + <> + + Cath Control Panel + + + Control Panel + + + + + + + + + + + + )} + + ); } -export default Index \ No newline at end of file +export default Index; diff --git a/pages/index.js b/pages/index.js index 07eaab9..6ef0da7 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,17 +1,16 @@ -import Card from '../components/Card' -import { useSession } from 'next-auth/client' -import { Text } from "@chakra-ui/react" -import Hero from '../components/Hero/Hero' -import { CTA } from '../components/CTA' -import { Features } from '../components/Features/Features' -import { Footer } from '../components/Footer/Footer' -import { motion } from 'framer-motion' -import StatCard from '../components/StatCard' -import Testimonials from '../components/Testimonials/Testimonials' -import AuthButton from '../components/AuthButton' +import Card from "../components/Card"; +import { useSession } from "next-auth/client"; +import { Text } from "@chakra-ui/react"; +import Hero from "../components/Hero/Hero"; +import { CTA } from "../components/CTA"; +import { Features } from "../components/Features/Features"; +import { Footer } from "../components/Footer/Footer"; +import { motion } from "framer-motion"; +import StatCard from "../components/StatCard"; +import Testimonials from "../components/Testimonials/Testimonials"; +import AuthButton from "../components/AuthButton"; export default function Home() { - const container = { hidden: { opacity: 1, scale: 0 }, visible: { @@ -19,38 +18,68 @@ export default function Home() { scale: 1, transition: { delayChildren: 0.4, - staggerChildren: 0.3 - } - } - } + staggerChildren: 0.3, + }, + }, + }; - - const [session, loading] = useSession() + const [session, loading] = useSession(); return ( - <> - {!session && <> - - - - -