Commit b75b0df2 authored by Grant's avatar Grant
Browse files

format & fix react warnings

parent 9e56bb52
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -21,10 +21,7 @@ export const HeaderRight = () => {
    <div className="box flex flex-col gap-2">
      <User />
      <div className="flex gap-2">
        <Button 
          onClick={() => setSettingsSidebar(true)}
          variant="faded"
        >
        <Button onPress={() => setSettingsSidebar(true)} variant="faded">
          <FontAwesomeIcon icon={faGear} />
          <p>Settings</p>
        </Button>
+22 −17
Original line number Diff line number Diff line
import "@theme-toggles/react/css/Classic.css"
import { Classic } from "@theme-toggles/react"
import "@theme-toggles/react/css/Classic.css";
import { Classic } from "@theme-toggles/react";

import { useTheme } from "next-themes";
import { useEffect, useState } from "react";
import { Button } from "@nextui-org/react";

export function ThemeSwitcher() {
  const [mounted, setMounted] = useState(false)
  const { theme, setTheme } = useTheme()
  const [isToggled, setToggle] = useState(false)
  const [mounted, setMounted] = useState(false);
  const { theme, setTheme } = useTheme();
  const [isToggled, setToggle] = useState(false);

  useEffect(() => {
    setMounted(true)
    setToggle(theme === 'dark')
  }, [])
    setMounted(true);
    setToggle(theme === "dark");
  }, []);

  useEffect(() => {
    if (isToggled) {
      setTheme('dark')
      setTheme("dark");
    } else {
      setTheme('light')
      setTheme("light");
    }
  }, [isToggled])
  }, [isToggled]);

  if(!mounted) return null
  if (!mounted) return null;

  return (
    <Button onClick={() => { setToggle(!isToggled) }} variant="faded">
    <Button
      onPress={() => {
        setToggle(!isToggled);
      }}
      variant="faded"
    >
      <Classic toggled={isToggled} placeholder={undefined} />
      <p>{theme === 'dark' ? "Dark" : "Light"}</p>
      <p>{theme === "dark" ? "Dark" : "Light"}</p>
    </Button>
  )
};
 No newline at end of file
  );
}
+10 −8
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ export const PixelWhoisSidebar = () => {
      <section>{whois?.user && <UserCard user={whois.user} />}</section>
      <section>
        <table className="w-full">
          <tbody>
            <tr>
              <th>Placed At</th>
              <td>{whois?.pixel.createdAt?.toString()}</td>
@@ -114,6 +115,7 @@ export const PixelWhoisSidebar = () => {
              <th>Covered Pixels</th>
              <td>{whois?.otherPixels}</td>
            </tr>
          </tbody>
        </table>
      </section>
    </div>