organize imports
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { IconSun, IconMoon } from "@tabler/icons-react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { IconMoon, IconSun } from "@tabler/icons-react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function ThemeToggle() {
|
||||
const [darkTheme, setDarkTheme] = useState(true);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import type { CustomSquares } from "@/types";
|
||||
import { Game } from "@chessu/types";
|
||||
import { Chessboard } from "react-chessboard";
|
||||
import { useEffect, useReducer, useState, useRef } from "react";
|
||||
import {
|
||||
IconChevronLeft,
|
||||
IconChevronRight,
|
||||
IconCopy,
|
||||
IconPlayerSkipBack,
|
||||
IconPlayerSkipForward
|
||||
IconPlayerSkipForward,
|
||||
IconRotateClockwise2
|
||||
} from "@tabler/icons-react";
|
||||
import type { Square } from "chess.js";
|
||||
import { Chess } from "chess.js";
|
||||
import type { CustomSquares } from "@/types";
|
||||
import { IconRotateClockwise2 } from "@tabler/icons-react";
|
||||
import { useEffect, useReducer, useRef, useState } from "react";
|
||||
import { Chessboard } from "react-chessboard";
|
||||
|
||||
export default function ArchivedGame({ game }: { game: Game }) {
|
||||
const [boardWidth, setBoardWidth] = useState(480);
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
import { SessionContext } from "@/context/session";
|
||||
import { login, logout, register, setGuestSession } from "@/lib/auth";
|
||||
import Link from "next/link";
|
||||
import type { FormEvent } from "react";
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import Link from "next/link";
|
||||
|
||||
import { IconSettings2, IconUserCircle } from "@tabler/icons-react";
|
||||
import Guest from "./Guest";
|
||||
import Login from "./Login";
|
||||
import Register from "./Register";
|
||||
import { IconSettings2, IconUserCircle } from "@tabler/icons-react";
|
||||
|
||||
export default function AuthModal() {
|
||||
const session = useContext(SessionContext);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useContext } from "react";
|
||||
import { SessionContext } from "@/context/session";
|
||||
import GamePage from "./GamePage";
|
||||
import type { Game } from "@chessu/types";
|
||||
import { useContext } from "react";
|
||||
|
||||
import GamePage from "./GamePage";
|
||||
|
||||
export default function GameAuthWrapper({ initialLobby }: { initialLobby: Game }) {
|
||||
const session = useContext(SessionContext);
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
|
||||
import type { FormEvent, KeyboardEvent } from "react";
|
||||
import Link from "next/link";
|
||||
|
||||
import { SessionContext } from "@/context/session";
|
||||
import { useContext, useEffect, useReducer, useRef, useState } from "react";
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Action, CustomSquares, Lobby, Message } from "@/types";
|
||||
import type { Game, User } from "@chessu/types";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
import type { Socket } from "socket.io-client";
|
||||
|
||||
import { syncPgn, syncSide } from "./utils";
|
||||
|
||||
export function initSocket(
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { FormEvent } from "react";
|
||||
import { useState, useContext } from "react";
|
||||
import { useContext, useState } from "react";
|
||||
|
||||
import { SessionContext } from "@/context/session";
|
||||
import { createGame } from "@/lib/game";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function CreateGame() {
|
||||
const session = useContext(SessionContext);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import type { FormEvent } from "react";
|
||||
import { useState, useContext } from "react";
|
||||
import { useContext, useState } from "react";
|
||||
|
||||
import { SessionContext } from "@/context/session";
|
||||
import { fetchActiveGame } from "@/lib/game";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function JoinGame() {
|
||||
const session = useContext(SessionContext);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { IconCopy } from "@tabler/icons-react";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function CopyLink({ name }: { name: string }) {
|
||||
const [copiedLink, setCopiedLink] = useState(false);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import type { User } from "@chessu/types";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { SessionContext } from "./session";
|
||||
import { fetchSession } from "@/lib/auth";
|
||||
import { SessionContext } from "./session";
|
||||
|
||||
export default function ContextProvider({ children }: { children: React.ReactNode }) {
|
||||
const [user, setUser] = useState<User | null>({});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { User } from "@chessu/types";
|
||||
|
||||
import { createContext, Dispatch, SetStateAction } from "react";
|
||||
|
||||
export const SessionContext = createContext<{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { User } from "@chessu/types";
|
||||
import { API_URL } from "@/config";
|
||||
import type { User } from "@chessu/types";
|
||||
|
||||
export const fetchSession = async () => {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Game } from "@chessu/types";
|
||||
import { API_URL } from "@/config";
|
||||
import type { Game } from "@chessu/types";
|
||||
|
||||
export const createGame = async (side: string, unlisted: boolean) => {
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { API_URL } from "@/config";
|
||||
import type { User, Game } from "@chessu/types";
|
||||
import type { Game, User } from "@chessu/types";
|
||||
|
||||
export const fetchProfileData = async (name: string) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user