import { BugReport } from "@mui/icons-material";
import { Box, IconButton, TextField, Typography } from "@mui/material";
import { useRouter } from "next/router";
import { useState } from "react";
import { SettingsItem } from "../components/HeaderBar/Settings/SettingsItem";
import { useSettings } from "../contexts/SettingsContext";

export default function Testing() {
  // contexts
  const router = useRouter();
  const { settings, settingsLoading, updateSettings, resetSettings } = useSettings();

  // states
  const [text, setText] = useState("");
  const [color, setColor] = useState("#000000");

  return (
    <Box>
      <IconButton
        onClick={() => {
          router.push("/");
        }}
      >
        <BugReport />
      </IconButton>
      <button
        onClick={() => {
          resetSettings();
        }}
      >
        reset settings
      </button>
      <button>update settings</button>
      <button
        onClick={() => {
          console.log(settings);
        }}
      >
        log settings
      </button>
      <button
        onClick={() => {
          console.log(settings.background.background_image_path);
        }}
      >
        testing
      </button>

      <Typography>{text}</Typography>
      <SettingsItem
        defaultText="#8ab4f8"
        description="Accent color"
        input={
          <TextField
            name="accent_color"
            onChange={(e) => {
              setColor(e.target.value);
            }}
            sx={{
              width: "100%",
            }}
            size="small"
            type="color"
            value={color}
            variant="standard"
          />
        }
      />
    </Box>
  );
}
