From fd8fc812dff161e3837de9d9c923f8c4d3400f5a Mon Sep 17 00:00:00 2001 From: Kevin Thomas Date: Tue, 26 Nov 2024 22:15:33 -0800 Subject: [PATCH] chore: restructured frontend component structure --- .../assets/pieces/white black king.svg | 0 src/components/Analysis/AnalysisGameList.tsx | 7 +- .../BlunderMeter.tsx | 0 .../HorizontalEvaluationBar.tsx | 0 .../{MovePlot => Analysis}/MovePlot.tsx | 2 +- .../PositionEvaluationContainer.tsx | 1 + src/components/Analysis/Tournament.tsx | 4 +- src/components/Analysis/UserGameList.tsx | 4 +- .../VerticalEvaluationBar.tsx | 0 src/components/Analysis/index.ts | 9 ++- src/components/AuthenticatedWrapper/index.ts | 1 - src/components/BlunderMeter/index.ts | 1 - .../BoardController.tsx | 0 .../{GameBoard => Board}/GameBoard.tsx | 7 +- .../{GameClock => Board}/GameClock.tsx | 2 +- .../GameplayInterface.tsx | 17 +++-- .../MovesContainer.tsx | 0 .../PromotionOverlay.tsx | 1 - src/components/Board/index.ts | 6 ++ src/components/BoardController/index.ts | 1 - src/components/Compose/index.ts | 1 - .../AuthenticatedWrapper.tsx | 1 + src/components/{Compose => Core}/Compose.tsx | 3 +- .../{ErrorBoundary => Core}/ErrorBoundary.tsx | 0 src/components/{Footer => Core}/Footer.tsx | 0 src/components/{Header => Core}/Header.tsx | 4 +- src/components/{Loading => Core}/Loading.tsx | 0 .../{Markdown => Core}/Markdown.tsx | 0 .../{ThemeButton => Core}/ThemeButton.tsx | 0 src/components/Core/index.ts | 11 +++- src/components/ErrorBoundary/index.ts | 1 - src/components/Feedback/index.ts | 1 - src/components/Footer/index.ts | 1 - src/components/GameBoard/index.ts | 1 - src/components/GameClock/index.ts | 1 - src/components/GameplayInterface/index.ts | 1 - src/components/Header/index.ts | 1 - .../{AboutMaia => Home}/AboutMaia.tsx | 0 .../{HomeHero => Home}/HomeHero.tsx | 0 .../{AboutMaia => Home}/example_board.png | Bin src/components/Home/index.ts | 2 + .../maia-diagram_transparent.png | Bin .../maia_transfer_val_accs.svg | 0 .../{AboutMaia => Home}/people/ashton.jpeg | Bin .../{AboutMaia => Home}/people/dmitriy.jpg | Bin .../{AboutMaia => Home}/people/isaac.jpg | Bin .../{AboutMaia => Home}/people/jon.jpg | Bin .../{AboutMaia => Home}/people/joseph.jpg | Bin .../{AboutMaia => Home}/people/kevin.jpg | Bin .../{AboutMaia => Home}/people/reid.jpg | Bin .../{AboutMaia => Home}/people/russell.jpg | Bin .../{AboutMaia => Home}/people/sid.jpeg | Bin src/components/{AboutMaia => Home}/plots.js | 0 .../HorizontalEvaluationBar/index.tsx | 1 - .../LeaderboardColumn.tsx | 0 src/components/Leaderboard/index.ts | 1 + src/components/Loading/index.ts | 1 - src/components/Markdown/index.ts | 1 - .../{Core => Misc}/ContinueAgainstMaia.tsx | 0 src/components/{Core => Misc}/ExportGame.tsx | 2 +- src/components/{Core => Misc}/GameInfo.tsx | 2 +- .../InstructionsModal.tsx | 3 +- .../ModalContainer.tsx | 0 .../PlaySetupModal.tsx | 23 +++++-- .../{StatsDisplay => Misc}/StatsDisplay.tsx | 0 src/components/Misc/index.ts | 7 ++ src/components/MovePlot/index.tsx | 1 - src/components/MovesContainer/index.ts | 1 - .../HandBrainPlayControls.tsx | 0 .../{PlayControls => Play}/PlayControls.tsx | 0 .../{HandBrainPlayControls => Play}/index.ts | 1 + src/components/PlayControls/index.ts | 1 - .../PositionEvaluationContainer/index.ts | 1 - .../{UserProfile => Profile}/GameList.tsx | 4 +- .../ProfileColumn.tsx | 0 .../{UserProfile => Profile}/UserProfile.tsx | 9 +-- .../assets/Maia Logo.png | Bin .../assets/train_icon.svg | 0 src/components/Profile/index.ts | 3 + src/components/PromotionOverlay/index.ts | 1 - src/components/StatsDisplay/index.ts | 1 - src/components/ThemeButton/index.tsx | 1 - .../{Feedback => Training}/Feedback.tsx | 0 .../{Train => Training}/PuzzleLog.tsx | 0 .../{Train/index.tsx => Training/index.ts} | 1 + .../{TuringGames => Turing}/TuringGames.tsx | 1 - .../TuringSubmission.tsx | 0 .../{TuringSubmission => Turing}/index.ts | 1 + src/components/TuringGames/index.ts | 1 - src/components/UserProfile/index.ts | 3 - src/components/VerticalBar/VerticalBar.tsx | 1 - .../VerticalEvaluationBar/index.tsx | 1 - src/components/index.ts | 30 +++------ .../modals/InstructionsModal/index.ts | 1 - src/components/modals/ModalContainer/index.ts | 1 - src/components/modals/PlaySetupModal/bK.svg | 1 - src/components/modals/PlaySetupModal/index.ts | 1 - src/components/modals/PlaySetupModal/wK.svg | 1 - src/components/modals/index.ts | 2 - src/contexts/ModalContext/ModalContext.ts | 6 +- .../PlayControllerContext.ts | 1 + src/contexts/ThemeContext/ThemeContext.ts | 1 + .../TuringControllerContext.ts | 1 + .../useGameController/useGameController.ts | 1 + src/pages/_app.tsx | 3 +- src/pages/analysis/[...id].tsx | 11 ++-- src/pages/index.tsx | 3 +- src/pages/leaderboard.tsx | 2 +- src/pages/play/hb.tsx | 8 ++- src/pages/play/maia.tsx | 4 +- src/pages/train.tsx | 11 ++-- src/pages/turing.tsx | 5 +- .../ModalContextProvider.tsx | 3 +- src/types/analysis/index.ts | 8 --- src/types/index.ts | 60 ------------------ 115 files changed, 133 insertions(+), 198 deletions(-) rename src/components/modals/PlaySetupModal/wbK.svg => public/assets/pieces/white black king.svg (100%) rename src/components/{BlunderMeter => Analysis}/BlunderMeter.tsx (100%) rename src/components/{HorizontalEvaluationBar => Analysis}/HorizontalEvaluationBar.tsx (100%) rename src/components/{MovePlot => Analysis}/MovePlot.tsx (100%) rename src/components/{PositionEvaluationContainer => Analysis}/PositionEvaluationContainer.tsx (99%) rename src/components/{VerticalEvaluationBar => Analysis}/VerticalEvaluationBar.tsx (100%) delete mode 100644 src/components/AuthenticatedWrapper/index.ts delete mode 100644 src/components/BlunderMeter/index.ts rename src/components/{BoardController => Board}/BoardController.tsx (100%) rename src/components/{GameBoard => Board}/GameBoard.tsx (99%) rename src/components/{GameClock => Board}/GameClock.tsx (100%) rename src/components/{GameplayInterface => Board}/GameplayInterface.tsx (96%) rename src/components/{MovesContainer => Board}/MovesContainer.tsx (100%) rename src/components/{PromotionOverlay => Board}/PromotionOverlay.tsx (97%) create mode 100644 src/components/Board/index.ts delete mode 100644 src/components/BoardController/index.ts delete mode 100644 src/components/Compose/index.ts rename src/components/{AuthenticatedWrapper => Core}/AuthenticatedWrapper.tsx (99%) rename src/components/{Compose => Core}/Compose.tsx (88%) rename src/components/{ErrorBoundary => Core}/ErrorBoundary.tsx (100%) rename src/components/{Footer => Core}/Footer.tsx (100%) rename src/components/{Header => Core}/Header.tsx (99%) rename src/components/{Loading => Core}/Loading.tsx (100%) rename src/components/{Markdown => Core}/Markdown.tsx (100%) rename src/components/{ThemeButton => Core}/ThemeButton.tsx (100%) delete mode 100644 src/components/ErrorBoundary/index.ts delete mode 100644 src/components/Feedback/index.ts delete mode 100644 src/components/Footer/index.ts delete mode 100644 src/components/GameBoard/index.ts delete mode 100644 src/components/GameClock/index.ts delete mode 100644 src/components/GameplayInterface/index.ts delete mode 100644 src/components/Header/index.ts rename src/components/{AboutMaia => Home}/AboutMaia.tsx (100%) rename src/components/{HomeHero => Home}/HomeHero.tsx (100%) rename src/components/{AboutMaia => Home}/example_board.png (100%) create mode 100644 src/components/Home/index.ts rename src/components/{AboutMaia => Home}/maia-diagram_transparent.png (100%) rename src/components/{AboutMaia => Home}/maia_transfer_val_accs.svg (100%) rename src/components/{AboutMaia => Home}/people/ashton.jpeg (100%) rename src/components/{AboutMaia => Home}/people/dmitriy.jpg (100%) rename src/components/{AboutMaia => Home}/people/isaac.jpg (100%) rename src/components/{AboutMaia => Home}/people/jon.jpg (100%) rename src/components/{AboutMaia => Home}/people/joseph.jpg (100%) rename src/components/{AboutMaia => Home}/people/kevin.jpg (100%) rename src/components/{AboutMaia => Home}/people/reid.jpg (100%) rename src/components/{AboutMaia => Home}/people/russell.jpg (100%) rename src/components/{AboutMaia => Home}/people/sid.jpeg (100%) rename src/components/{AboutMaia => Home}/plots.js (100%) delete mode 100644 src/components/HorizontalEvaluationBar/index.tsx rename src/components/{LeaderboardColumn => Leaderboard}/LeaderboardColumn.tsx (100%) create mode 100644 src/components/Leaderboard/index.ts delete mode 100644 src/components/Loading/index.ts delete mode 100644 src/components/Markdown/index.ts rename src/components/{Core => Misc}/ContinueAgainstMaia.tsx (100%) rename src/components/{Core => Misc}/ExportGame.tsx (100%) rename src/components/{Core => Misc}/GameInfo.tsx (93%) rename src/components/{modals/InstructionsModal => Misc}/InstructionsModal.tsx (98%) rename src/components/{modals/ModalContainer => Misc}/ModalContainer.tsx (100%) rename src/components/{modals/PlaySetupModal => Misc}/PlaySetupModal.tsx (94%) rename src/components/{StatsDisplay => Misc}/StatsDisplay.tsx (100%) create mode 100644 src/components/Misc/index.ts delete mode 100644 src/components/MovePlot/index.tsx delete mode 100644 src/components/MovesContainer/index.ts rename src/components/{HandBrainPlayControls => Play}/HandBrainPlayControls.tsx (100%) rename src/components/{PlayControls => Play}/PlayControls.tsx (100%) rename src/components/{HandBrainPlayControls => Play}/index.ts (56%) delete mode 100644 src/components/PlayControls/index.ts delete mode 100644 src/components/PositionEvaluationContainer/index.ts rename src/components/{UserProfile => Profile}/GameList.tsx (99%) rename src/components/{ProfileColumn => Profile}/ProfileColumn.tsx (100%) rename src/components/{UserProfile => Profile}/UserProfile.tsx (97%) rename src/components/{UserProfile => Profile}/assets/Maia Logo.png (100%) rename src/components/{UserProfile => Profile}/assets/train_icon.svg (100%) create mode 100644 src/components/Profile/index.ts delete mode 100644 src/components/PromotionOverlay/index.ts delete mode 100644 src/components/StatsDisplay/index.ts delete mode 100644 src/components/ThemeButton/index.tsx rename src/components/{Feedback => Training}/Feedback.tsx (100%) rename src/components/{Train => Training}/PuzzleLog.tsx (100%) rename src/components/{Train/index.tsx => Training/index.ts} (50%) rename src/components/{TuringGames => Turing}/TuringGames.tsx (95%) rename src/components/{TuringSubmission => Turing}/TuringSubmission.tsx (100%) rename src/components/{TuringSubmission => Turing}/index.ts (53%) delete mode 100644 src/components/TuringGames/index.ts delete mode 100644 src/components/UserProfile/index.ts delete mode 100644 src/components/VerticalBar/VerticalBar.tsx delete mode 100644 src/components/VerticalEvaluationBar/index.tsx delete mode 100644 src/components/modals/InstructionsModal/index.ts delete mode 100644 src/components/modals/ModalContainer/index.ts delete mode 100644 src/components/modals/PlaySetupModal/bK.svg delete mode 100644 src/components/modals/PlaySetupModal/index.ts delete mode 100644 src/components/modals/PlaySetupModal/wK.svg delete mode 100644 src/components/modals/index.ts diff --git a/src/components/modals/PlaySetupModal/wbK.svg b/public/assets/pieces/white black king.svg similarity index 100% rename from src/components/modals/PlaySetupModal/wbK.svg rename to public/assets/pieces/white black king.svg diff --git a/src/components/Analysis/AnalysisGameList.tsx b/src/components/Analysis/AnalysisGameList.tsx index 2a0cc26..8924372 100644 --- a/src/components/Analysis/AnalysisGameList.tsx +++ b/src/components/Analysis/AnalysisGameList.tsx @@ -9,9 +9,8 @@ import { } from 'react' import { motion } from 'framer-motion' -import Tournament from './Tournament' +import { Tournament, UserGameList } from 'src/components' import { AnalysisListContext, GameControllerContext } from 'src/contexts' -import UserGameList from './UserGameList' interface AnalysisGameListProps { currentId: string[] | null @@ -34,7 +33,7 @@ interface AnalysisGameListProps { ) => Promise } -const AnalysisGameList: React.FC = ({ +export const AnalysisGameList: React.FC = ({ currentId, currentMaiaModel, loadNewTournamentGame, @@ -181,5 +180,3 @@ const AnalysisGameList: React.FC = ({ ) : null } - -export default AnalysisGameList diff --git a/src/components/BlunderMeter/BlunderMeter.tsx b/src/components/Analysis/BlunderMeter.tsx similarity index 100% rename from src/components/BlunderMeter/BlunderMeter.tsx rename to src/components/Analysis/BlunderMeter.tsx diff --git a/src/components/HorizontalEvaluationBar/HorizontalEvaluationBar.tsx b/src/components/Analysis/HorizontalEvaluationBar.tsx similarity index 100% rename from src/components/HorizontalEvaluationBar/HorizontalEvaluationBar.tsx rename to src/components/Analysis/HorizontalEvaluationBar.tsx diff --git a/src/components/MovePlot/MovePlot.tsx b/src/components/Analysis/MovePlot.tsx similarity index 100% rename from src/components/MovePlot/MovePlot.tsx rename to src/components/Analysis/MovePlot.tsx index 2677ff2..45d6e5f 100644 --- a/src/components/MovePlot/MovePlot.tsx +++ b/src/components/Analysis/MovePlot.tsx @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable import/named */ import { - ResponsiveScatterPlot, ScatterPlotRawSerie, + ResponsiveScatterPlot, ScatterPlotTooltipProps, } from '@nivo/scatterplot' import { useCallback, useContext } from 'react' diff --git a/src/components/PositionEvaluationContainer/PositionEvaluationContainer.tsx b/src/components/Analysis/PositionEvaluationContainer.tsx similarity index 99% rename from src/components/PositionEvaluationContainer/PositionEvaluationContainer.tsx rename to src/components/Analysis/PositionEvaluationContainer.tsx index c4cd42f..cb5581b 100644 --- a/src/components/PositionEvaluationContainer/PositionEvaluationContainer.tsx +++ b/src/components/Analysis/PositionEvaluationContainer.tsx @@ -1,4 +1,5 @@ import React from 'react' + import { PositionEvaluation } from 'src/types' interface Props { diff --git a/src/components/Analysis/Tournament.tsx b/src/components/Analysis/Tournament.tsx index 4bb8516..69bd7a8 100644 --- a/src/components/Analysis/Tournament.tsx +++ b/src/components/Analysis/Tournament.tsx @@ -8,7 +8,7 @@ import { } from 'src/components/Icons/icons' import { AnalysisTournamentGame } from 'src/types' -export default function Tournament({ +export const Tournament = ({ id, index, currentId, @@ -37,7 +37,7 @@ export default function Tournament({ setCurrentMove: Dispatch>, ) => Promise setCurrentMove: Dispatch> -}) { +}) => { const games = analysisTournamentList.get(id) const [sectionId, title] = id.split('---') const opened = openIndex == index diff --git a/src/components/Analysis/UserGameList.tsx b/src/components/Analysis/UserGameList.tsx index b4dadfb..dd9a809 100644 --- a/src/components/Analysis/UserGameList.tsx +++ b/src/components/Analysis/UserGameList.tsx @@ -28,7 +28,7 @@ interface Props { currentMaiaModel: string } -export default function UserGameList({ +export const UserGameList = ({ currentId, selected, setSelected, @@ -41,7 +41,7 @@ export default function UserGameList({ loadNewLichessGames, loadNewUserGames, currentMaiaModel, -}: Props) { +}: Props) => { return (
diff --git a/src/components/VerticalEvaluationBar/VerticalEvaluationBar.tsx b/src/components/Analysis/VerticalEvaluationBar.tsx similarity index 100% rename from src/components/VerticalEvaluationBar/VerticalEvaluationBar.tsx rename to src/components/Analysis/VerticalEvaluationBar.tsx diff --git a/src/components/Analysis/index.ts b/src/components/Analysis/index.ts index 336ce12..5685d83 100644 --- a/src/components/Analysis/index.ts +++ b/src/components/Analysis/index.ts @@ -1 +1,8 @@ -export {} +export * from './MovePlot' +export * from './Tournament' +export * from './BlunderMeter' +export * from './UserGameList' +export * from './AnalysisGameList' +export * from './HorizontalEvaluationBar' +export * from './PositionEvaluationContainer' +export * from './VerticalEvaluationBar' diff --git a/src/components/AuthenticatedWrapper/index.ts b/src/components/AuthenticatedWrapper/index.ts deleted file mode 100644 index bf08ea6..0000000 --- a/src/components/AuthenticatedWrapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './AuthenticatedWrapper' diff --git a/src/components/BlunderMeter/index.ts b/src/components/BlunderMeter/index.ts deleted file mode 100644 index d7f0e26..0000000 --- a/src/components/BlunderMeter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './BlunderMeter' diff --git a/src/components/BoardController/BoardController.tsx b/src/components/Board/BoardController.tsx similarity index 100% rename from src/components/BoardController/BoardController.tsx rename to src/components/Board/BoardController.tsx diff --git a/src/components/GameBoard/GameBoard.tsx b/src/components/Board/GameBoard.tsx similarity index 99% rename from src/components/GameBoard/GameBoard.tsx rename to src/components/Board/GameBoard.tsx index 5c7b238..2a5a61a 100644 --- a/src/components/GameBoard/GameBoard.tsx +++ b/src/components/Board/GameBoard.tsx @@ -1,9 +1,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import Chessground from '@react-chess/chessground' -import type { DrawShape } from 'chessground/draw' import { useCallback, useContext } from 'react' -import { GameControllerContext } from 'src/contexts' +import type { DrawShape } from 'chessground/draw' +import Chessground from '@react-chess/chessground' + import { BaseGame, Check } from 'src/types' +import { GameControllerContext } from 'src/contexts' interface Props { game: BaseGame diff --git a/src/components/GameClock/GameClock.tsx b/src/components/Board/GameClock.tsx similarity index 100% rename from src/components/GameClock/GameClock.tsx rename to src/components/Board/GameClock.tsx index 2acf1ea..b922b8f 100644 --- a/src/components/GameClock/GameClock.tsx +++ b/src/components/Board/GameClock.tsx @@ -1,6 +1,6 @@ -import { Color } from 'src/types' import { useState, useEffect, useContext } from 'react' +import { Color } from 'src/types' import { AuthContext, ThemeContext } from 'src/contexts' import { PlayControllerContext } from 'src/contexts/PlayControllerContext' diff --git a/src/components/GameplayInterface/GameplayInterface.tsx b/src/components/Board/GameplayInterface.tsx similarity index 96% rename from src/components/GameplayInterface/GameplayInterface.tsx rename to src/components/Board/GameplayInterface.tsx index 318c17c..4cfcf2c 100644 --- a/src/components/GameplayInterface/GameplayInterface.tsx +++ b/src/components/Board/GameplayInterface.tsx @@ -4,17 +4,22 @@ import { useCallback, useContext, useEffect, useMemo, useState } from 'react' import { AuthContext, - GameControllerContext, ThemeContext, WindowSizeContext, + GameControllerContext, } from 'src/contexts' -import { GameBoard, MovesContainer, BoardController } from 'src/components' -import { GameInfo, ExportGame } from '../Core' -import { GameClock } from '../GameClock' +import { + GameInfo, + GameClock, + GameBoard, + ExportGame, + StatsDisplay, + MovesContainer, + BoardController, + PromotionOverlay, +} from 'src/components' import { useGameController } from 'src/hooks' -import { StatsDisplay } from '../StatsDisplay' import { useUnload } from 'src/hooks/useUnload' -import { PromotionOverlay } from 'src/components/PromotionOverlay' import { PlayControllerContext } from 'src/contexts/PlayControllerContext/PlayControllerContext' interface Props { diff --git a/src/components/MovesContainer/MovesContainer.tsx b/src/components/Board/MovesContainer.tsx similarity index 100% rename from src/components/MovesContainer/MovesContainer.tsx rename to src/components/Board/MovesContainer.tsx diff --git a/src/components/PromotionOverlay/PromotionOverlay.tsx b/src/components/Board/PromotionOverlay.tsx similarity index 97% rename from src/components/PromotionOverlay/PromotionOverlay.tsx rename to src/components/Board/PromotionOverlay.tsx index 9d2726e..ec3bc89 100644 --- a/src/components/PromotionOverlay/PromotionOverlay.tsx +++ b/src/components/Board/PromotionOverlay.tsx @@ -3,7 +3,6 @@ import { useContext } from 'react' import { Color } from 'src/types' import { GameControllerContext } from 'src/contexts' -import Chessground from '@react-chess/chessground' interface Props { player: Color diff --git a/src/components/Board/index.ts b/src/components/Board/index.ts new file mode 100644 index 0000000..04614b6 --- /dev/null +++ b/src/components/Board/index.ts @@ -0,0 +1,6 @@ +export * from './GameClock' +export * from './GameBoard' +export * from './MovesContainer' +export * from './BoardController' +export * from './PromotionOverlay' +export * from './GameplayInterface' diff --git a/src/components/BoardController/index.ts b/src/components/BoardController/index.ts deleted file mode 100644 index 7e9d0fc..0000000 --- a/src/components/BoardController/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './BoardController' diff --git a/src/components/Compose/index.ts b/src/components/Compose/index.ts deleted file mode 100644 index c524e8f..0000000 --- a/src/components/Compose/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Compose' diff --git a/src/components/AuthenticatedWrapper/AuthenticatedWrapper.tsx b/src/components/Core/AuthenticatedWrapper.tsx similarity index 99% rename from src/components/AuthenticatedWrapper/AuthenticatedWrapper.tsx rename to src/components/Core/AuthenticatedWrapper.tsx index c30d55e..8a71beb 100644 --- a/src/components/AuthenticatedWrapper/AuthenticatedWrapper.tsx +++ b/src/components/Core/AuthenticatedWrapper.tsx @@ -1,4 +1,5 @@ import { ReactNode, useContext } from 'react' + import { AuthContext } from 'src/contexts' interface Props { diff --git a/src/components/Compose/Compose.tsx b/src/components/Core/Compose.tsx similarity index 88% rename from src/components/Compose/Compose.tsx rename to src/components/Core/Compose.tsx index 461e67a..dcdc785 100644 --- a/src/components/Compose/Compose.tsx +++ b/src/components/Core/Compose.tsx @@ -1,5 +1,6 @@ import { ReactNode } from 'react' -import { ErrorBoundary } from '../ErrorBoundary' + +import { ErrorBoundary } from './ErrorBoundary' interface Props { components: (React.FC<{ children: ReactNode }> | typeof ErrorBoundary)[] diff --git a/src/components/ErrorBoundary/ErrorBoundary.tsx b/src/components/Core/ErrorBoundary.tsx similarity index 100% rename from src/components/ErrorBoundary/ErrorBoundary.tsx rename to src/components/Core/ErrorBoundary.tsx diff --git a/src/components/Footer/Footer.tsx b/src/components/Core/Footer.tsx similarity index 100% rename from src/components/Footer/Footer.tsx rename to src/components/Core/Footer.tsx diff --git a/src/components/Header/Header.tsx b/src/components/Core/Header.tsx similarity index 99% rename from src/components/Header/Header.tsx rename to src/components/Core/Header.tsx index 6727080..968010c 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Core/Header.tsx @@ -3,11 +3,11 @@ import Link from 'next/link' import Image from 'next/image' import { useRouter } from 'next/router' -import { MenuIcon, UserIcon, DiscordIcon } from 'src/components/Icons/icons' import { useCallback, useContext, useEffect, useState } from 'react' -import { ThemeButton } from '../ThemeButton' +import { ThemeButton } from 'src/components' import { AuthContext, ModalContext, WindowSizeContext } from 'src/contexts' +import { MenuIcon, UserIcon, DiscordIcon } from 'src/components/Icons/icons' export const Header: React.FC = () => { const [showMenu, setShowMenu] = useState(false) diff --git a/src/components/Loading/Loading.tsx b/src/components/Core/Loading.tsx similarity index 100% rename from src/components/Loading/Loading.tsx rename to src/components/Core/Loading.tsx diff --git a/src/components/Markdown/Markdown.tsx b/src/components/Core/Markdown.tsx similarity index 100% rename from src/components/Markdown/Markdown.tsx rename to src/components/Core/Markdown.tsx diff --git a/src/components/ThemeButton/ThemeButton.tsx b/src/components/Core/ThemeButton.tsx similarity index 100% rename from src/components/ThemeButton/ThemeButton.tsx rename to src/components/Core/ThemeButton.tsx diff --git a/src/components/Core/index.ts b/src/components/Core/index.ts index 19c7af0..53e7fe7 100644 --- a/src/components/Core/index.ts +++ b/src/components/Core/index.ts @@ -1,3 +1,8 @@ -export * from './GameInfo' -export * from './ExportGame' -export * from './ContinueAgainstMaia' +export * from './Header' +export * from './Footer' +export * from './Compose' +export * from './Loading' +export * from './Markdown' +export * from './ThemeButton' +export * from './ErrorBoundary' +export * from './AuthenticatedWrapper' diff --git a/src/components/ErrorBoundary/index.ts b/src/components/ErrorBoundary/index.ts deleted file mode 100644 index 2bca71d..0000000 --- a/src/components/ErrorBoundary/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ErrorBoundary' diff --git a/src/components/Feedback/index.ts b/src/components/Feedback/index.ts deleted file mode 100644 index 7ba2048..0000000 --- a/src/components/Feedback/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Feedback' diff --git a/src/components/Footer/index.ts b/src/components/Footer/index.ts deleted file mode 100644 index bd2c119..0000000 --- a/src/components/Footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Footer' diff --git a/src/components/GameBoard/index.ts b/src/components/GameBoard/index.ts deleted file mode 100644 index 1afbcfe..0000000 --- a/src/components/GameBoard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './GameBoard' diff --git a/src/components/GameClock/index.ts b/src/components/GameClock/index.ts deleted file mode 100644 index bdc64b3..0000000 --- a/src/components/GameClock/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './GameClock' diff --git a/src/components/GameplayInterface/index.ts b/src/components/GameplayInterface/index.ts deleted file mode 100644 index e61c207..0000000 --- a/src/components/GameplayInterface/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './GameplayInterface' diff --git a/src/components/Header/index.ts b/src/components/Header/index.ts deleted file mode 100644 index f887995..0000000 --- a/src/components/Header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Header' diff --git a/src/components/AboutMaia/AboutMaia.tsx b/src/components/Home/AboutMaia.tsx similarity index 100% rename from src/components/AboutMaia/AboutMaia.tsx rename to src/components/Home/AboutMaia.tsx diff --git a/src/components/HomeHero/HomeHero.tsx b/src/components/Home/HomeHero.tsx similarity index 100% rename from src/components/HomeHero/HomeHero.tsx rename to src/components/Home/HomeHero.tsx diff --git a/src/components/AboutMaia/example_board.png b/src/components/Home/example_board.png similarity index 100% rename from src/components/AboutMaia/example_board.png rename to src/components/Home/example_board.png diff --git a/src/components/Home/index.ts b/src/components/Home/index.ts new file mode 100644 index 0000000..3a3a64e --- /dev/null +++ b/src/components/Home/index.ts @@ -0,0 +1,2 @@ +export * from './HomeHero' +export * from './AboutMaia' diff --git a/src/components/AboutMaia/maia-diagram_transparent.png b/src/components/Home/maia-diagram_transparent.png similarity index 100% rename from src/components/AboutMaia/maia-diagram_transparent.png rename to src/components/Home/maia-diagram_transparent.png diff --git a/src/components/AboutMaia/maia_transfer_val_accs.svg b/src/components/Home/maia_transfer_val_accs.svg similarity index 100% rename from src/components/AboutMaia/maia_transfer_val_accs.svg rename to src/components/Home/maia_transfer_val_accs.svg diff --git a/src/components/AboutMaia/people/ashton.jpeg b/src/components/Home/people/ashton.jpeg similarity index 100% rename from src/components/AboutMaia/people/ashton.jpeg rename to src/components/Home/people/ashton.jpeg diff --git a/src/components/AboutMaia/people/dmitriy.jpg b/src/components/Home/people/dmitriy.jpg similarity index 100% rename from src/components/AboutMaia/people/dmitriy.jpg rename to src/components/Home/people/dmitriy.jpg diff --git a/src/components/AboutMaia/people/isaac.jpg b/src/components/Home/people/isaac.jpg similarity index 100% rename from src/components/AboutMaia/people/isaac.jpg rename to src/components/Home/people/isaac.jpg diff --git a/src/components/AboutMaia/people/jon.jpg b/src/components/Home/people/jon.jpg similarity index 100% rename from src/components/AboutMaia/people/jon.jpg rename to src/components/Home/people/jon.jpg diff --git a/src/components/AboutMaia/people/joseph.jpg b/src/components/Home/people/joseph.jpg similarity index 100% rename from src/components/AboutMaia/people/joseph.jpg rename to src/components/Home/people/joseph.jpg diff --git a/src/components/AboutMaia/people/kevin.jpg b/src/components/Home/people/kevin.jpg similarity index 100% rename from src/components/AboutMaia/people/kevin.jpg rename to src/components/Home/people/kevin.jpg diff --git a/src/components/AboutMaia/people/reid.jpg b/src/components/Home/people/reid.jpg similarity index 100% rename from src/components/AboutMaia/people/reid.jpg rename to src/components/Home/people/reid.jpg diff --git a/src/components/AboutMaia/people/russell.jpg b/src/components/Home/people/russell.jpg similarity index 100% rename from src/components/AboutMaia/people/russell.jpg rename to src/components/Home/people/russell.jpg diff --git a/src/components/AboutMaia/people/sid.jpeg b/src/components/Home/people/sid.jpeg similarity index 100% rename from src/components/AboutMaia/people/sid.jpeg rename to src/components/Home/people/sid.jpeg diff --git a/src/components/AboutMaia/plots.js b/src/components/Home/plots.js similarity index 100% rename from src/components/AboutMaia/plots.js rename to src/components/Home/plots.js diff --git a/src/components/HorizontalEvaluationBar/index.tsx b/src/components/HorizontalEvaluationBar/index.tsx deleted file mode 100644 index b3815d7..0000000 --- a/src/components/HorizontalEvaluationBar/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './HorizontalEvaluationBar' diff --git a/src/components/LeaderboardColumn/LeaderboardColumn.tsx b/src/components/Leaderboard/LeaderboardColumn.tsx similarity index 100% rename from src/components/LeaderboardColumn/LeaderboardColumn.tsx rename to src/components/Leaderboard/LeaderboardColumn.tsx diff --git a/src/components/Leaderboard/index.ts b/src/components/Leaderboard/index.ts new file mode 100644 index 0000000..0d02c41 --- /dev/null +++ b/src/components/Leaderboard/index.ts @@ -0,0 +1 @@ +export * from './LeaderboardColumn' diff --git a/src/components/Loading/index.ts b/src/components/Loading/index.ts deleted file mode 100644 index 8e9305d..0000000 --- a/src/components/Loading/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Loading' diff --git a/src/components/Markdown/index.ts b/src/components/Markdown/index.ts deleted file mode 100644 index eabd5a9..0000000 --- a/src/components/Markdown/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Markdown' diff --git a/src/components/Core/ContinueAgainstMaia.tsx b/src/components/Misc/ContinueAgainstMaia.tsx similarity index 100% rename from src/components/Core/ContinueAgainstMaia.tsx rename to src/components/Misc/ContinueAgainstMaia.tsx diff --git a/src/components/Core/ExportGame.tsx b/src/components/Misc/ExportGame.tsx similarity index 100% rename from src/components/Core/ExportGame.tsx rename to src/components/Misc/ExportGame.tsx index d65be5b..a6c02fe 100644 --- a/src/components/Core/ExportGame.tsx +++ b/src/components/Misc/ExportGame.tsx @@ -1,5 +1,5 @@ -import { useEffect, useState } from 'react' import { Chess } from 'chess.ts' +import { useEffect, useState } from 'react' import { Move } from 'src/types' diff --git a/src/components/Core/GameInfo.tsx b/src/components/Misc/GameInfo.tsx similarity index 93% rename from src/components/Core/GameInfo.tsx rename to src/components/Misc/GameInfo.tsx index 586e834..56aee11 100644 --- a/src/components/Core/GameInfo.tsx +++ b/src/components/Misc/GameInfo.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react' import { ModalContext } from 'src/contexts' -import { InstructionsType } from 'src/components/modals/InstructionsModal' +import { InstructionsType } from 'src/components' interface Props { icon: string diff --git a/src/components/modals/InstructionsModal/InstructionsModal.tsx b/src/components/Misc/InstructionsModal.tsx similarity index 98% rename from src/components/modals/InstructionsModal/InstructionsModal.tsx rename to src/components/Misc/InstructionsModal.tsx index 185ae3f..696ac37 100644 --- a/src/components/modals/InstructionsModal/InstructionsModal.tsx +++ b/src/components/Misc/InstructionsModal.tsx @@ -2,9 +2,8 @@ import { useContext } from 'react' import { AnimatePresence } from 'framer-motion' import { ModalContext } from 'src/contexts' -import { Markdown } from '../../Markdown' -import { ModalContainer } from '../ModalContainer' import { CloseIcon } from 'src/components/Icons/icons' +import { Markdown, ModalContainer } from 'src/components' export type InstructionsType = | 'againstMaia' diff --git a/src/components/modals/ModalContainer/ModalContainer.tsx b/src/components/Misc/ModalContainer.tsx similarity index 100% rename from src/components/modals/ModalContainer/ModalContainer.tsx rename to src/components/Misc/ModalContainer.tsx diff --git a/src/components/modals/PlaySetupModal/PlaySetupModal.tsx b/src/components/Misc/PlaySetupModal.tsx similarity index 94% rename from src/components/modals/PlaySetupModal/PlaySetupModal.tsx rename to src/components/Misc/PlaySetupModal.tsx index b26f7ba..cf6f489 100644 --- a/src/components/modals/PlaySetupModal/PlaySetupModal.tsx +++ b/src/components/Misc/PlaySetupModal.tsx @@ -10,11 +10,8 @@ import { TimeControlOptionNames, TimeControlOptions, } from 'src/types' -import bK from './bK.svg' -import wK from './wK.svg' -import wbK from './wbK.svg' import { ModalContext } from 'src/contexts' -import { ModalContainer } from '../ModalContainer' +import { ModalContainer } from './ModalContainer' import { CloseIcon } from 'src/components/Icons/icons' const maiaOptions = [ @@ -255,7 +252,11 @@ export const PlaySetupModal: React.FC = (props: Props) => { className="flex cursor-pointer select-none items-center justify-center rounded-sm border-none bg-background-2 p-2 text-center text-xl outline-none transition duration-200 hover:bg-human-4" >
- +
diff --git a/src/components/StatsDisplay/StatsDisplay.tsx b/src/components/Misc/StatsDisplay.tsx similarity index 100% rename from src/components/StatsDisplay/StatsDisplay.tsx rename to src/components/Misc/StatsDisplay.tsx diff --git a/src/components/Misc/index.ts b/src/components/Misc/index.ts new file mode 100644 index 0000000..391a5a8 --- /dev/null +++ b/src/components/Misc/index.ts @@ -0,0 +1,7 @@ +export * from './GameInfo' +export * from './ExportGame' +export * from './StatsDisplay' +export * from './PlaySetupModal' +export * from './ModalContainer' +export * from './InstructionsModal' +export * from './ContinueAgainstMaia' diff --git a/src/components/MovePlot/index.tsx b/src/components/MovePlot/index.tsx deleted file mode 100644 index 078d3bb..0000000 --- a/src/components/MovePlot/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './MovePlot' diff --git a/src/components/MovesContainer/index.ts b/src/components/MovesContainer/index.ts deleted file mode 100644 index 497ab97..0000000 --- a/src/components/MovesContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './MovesContainer' diff --git a/src/components/HandBrainPlayControls/HandBrainPlayControls.tsx b/src/components/Play/HandBrainPlayControls.tsx similarity index 100% rename from src/components/HandBrainPlayControls/HandBrainPlayControls.tsx rename to src/components/Play/HandBrainPlayControls.tsx diff --git a/src/components/PlayControls/PlayControls.tsx b/src/components/Play/PlayControls.tsx similarity index 100% rename from src/components/PlayControls/PlayControls.tsx rename to src/components/Play/PlayControls.tsx diff --git a/src/components/HandBrainPlayControls/index.ts b/src/components/Play/index.ts similarity index 56% rename from src/components/HandBrainPlayControls/index.ts rename to src/components/Play/index.ts index 131eaaa..e968a1e 100644 --- a/src/components/HandBrainPlayControls/index.ts +++ b/src/components/Play/index.ts @@ -1 +1,2 @@ +export * from './PlayControls' export * from './HandBrainPlayControls' diff --git a/src/components/PlayControls/index.ts b/src/components/PlayControls/index.ts deleted file mode 100644 index d37246f..0000000 --- a/src/components/PlayControls/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PlayControls' diff --git a/src/components/PositionEvaluationContainer/index.ts b/src/components/PositionEvaluationContainer/index.ts deleted file mode 100644 index 19aa9f6..0000000 --- a/src/components/PositionEvaluationContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PositionEvaluationContainer' diff --git a/src/components/UserProfile/GameList.tsx b/src/components/Profile/GameList.tsx similarity index 99% rename from src/components/UserProfile/GameList.tsx rename to src/components/Profile/GameList.tsx index 3426d4c..b827f1e 100644 --- a/src/components/UserProfile/GameList.tsx +++ b/src/components/Profile/GameList.tsx @@ -1,11 +1,11 @@ import { motion } from 'framer-motion' -import { AuthContext } from 'src/contexts' import React, { useState, useEffect, useContext } from 'react' +import { AuthContext } from 'src/contexts' import { AnalysisWebGame } from 'src/types' import { getLichessGames, getAnalysisGameList } from 'src/api' -export default function GameList() { +export const GameList = () => { const { user } = useContext(AuthContext) const [selected, setSelected] = useState<'play' | 'hand' | 'brain' | 'pgn'>( 'play', diff --git a/src/components/ProfileColumn/ProfileColumn.tsx b/src/components/Profile/ProfileColumn.tsx similarity index 100% rename from src/components/ProfileColumn/ProfileColumn.tsx rename to src/components/Profile/ProfileColumn.tsx diff --git a/src/components/UserProfile/UserProfile.tsx b/src/components/Profile/UserProfile.tsx similarity index 97% rename from src/components/UserProfile/UserProfile.tsx rename to src/components/Profile/UserProfile.tsx index f932982..0bd6808 100644 --- a/src/components/UserProfile/UserProfile.tsx +++ b/src/components/Profile/UserProfile.tsx @@ -1,7 +1,7 @@ /* eslint-disable prettier/prettier */ -/* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable import/named */ /* eslint-disable jsx-a11y/click-events-have-key-events */ +/* eslint-disable jsx-a11y/no-static-element-interactions */ import { useRouter } from 'next/router' import React, { useState, useEffect, useContext } from 'react' @@ -13,12 +13,11 @@ import { TuringIcon, RegularPlayIcon, } from '../Icons/icons' -import GameList from './GameList' import { getPlayerStats } from 'src/api' +import { GameList, ProfileColumn } from 'src/components' import { AuthContext, WindowSizeContext } from 'src/contexts' -import { ProfileColumn } from '../ProfileColumn/ProfileColumn' -const UserProfile: React.FC = () => { +export const UserProfile: React.FC = () => { const router = useRouter() const { user } = useContext(AuthContext) const { isMobile } = useContext(WindowSizeContext) @@ -222,5 +221,3 @@ const UserProfile: React.FC = () => { return <>{isMobile ? mobileLayout() : desktopLayout()} } - -export default UserProfile diff --git a/src/components/UserProfile/assets/Maia Logo.png b/src/components/Profile/assets/Maia Logo.png similarity index 100% rename from src/components/UserProfile/assets/Maia Logo.png rename to src/components/Profile/assets/Maia Logo.png diff --git a/src/components/UserProfile/assets/train_icon.svg b/src/components/Profile/assets/train_icon.svg similarity index 100% rename from src/components/UserProfile/assets/train_icon.svg rename to src/components/Profile/assets/train_icon.svg diff --git a/src/components/Profile/index.ts b/src/components/Profile/index.ts new file mode 100644 index 0000000..3aab4b5 --- /dev/null +++ b/src/components/Profile/index.ts @@ -0,0 +1,3 @@ +export * from './GameList' +export * from './UserProfile' +export * from './ProfileColumn' diff --git a/src/components/PromotionOverlay/index.ts b/src/components/PromotionOverlay/index.ts deleted file mode 100644 index ec69c73..0000000 --- a/src/components/PromotionOverlay/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PromotionOverlay' diff --git a/src/components/StatsDisplay/index.ts b/src/components/StatsDisplay/index.ts deleted file mode 100644 index c3c038b..0000000 --- a/src/components/StatsDisplay/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './StatsDisplay' diff --git a/src/components/ThemeButton/index.tsx b/src/components/ThemeButton/index.tsx deleted file mode 100644 index b29c704..0000000 --- a/src/components/ThemeButton/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './ThemeButton' diff --git a/src/components/Feedback/Feedback.tsx b/src/components/Training/Feedback.tsx similarity index 100% rename from src/components/Feedback/Feedback.tsx rename to src/components/Training/Feedback.tsx diff --git a/src/components/Train/PuzzleLog.tsx b/src/components/Training/PuzzleLog.tsx similarity index 100% rename from src/components/Train/PuzzleLog.tsx rename to src/components/Training/PuzzleLog.tsx diff --git a/src/components/Train/index.tsx b/src/components/Training/index.ts similarity index 50% rename from src/components/Train/index.tsx rename to src/components/Training/index.ts index a292142..84660a7 100644 --- a/src/components/Train/index.tsx +++ b/src/components/Training/index.ts @@ -1 +1,2 @@ +export * from './Feedback' export * from './PuzzleLog' diff --git a/src/components/TuringGames/TuringGames.tsx b/src/components/Turing/TuringGames.tsx similarity index 95% rename from src/components/TuringGames/TuringGames.tsx rename to src/components/Turing/TuringGames.tsx index c0f1f25..f2c12b2 100644 --- a/src/components/TuringGames/TuringGames.tsx +++ b/src/components/Turing/TuringGames.tsx @@ -1,5 +1,4 @@ /* eslint-disable jsx-a11y/no-static-element-interactions */ -import classNames from 'classnames' import { useContext } from 'react' import { TuringControllerContext } from 'src/contexts' diff --git a/src/components/TuringSubmission/TuringSubmission.tsx b/src/components/Turing/TuringSubmission.tsx similarity index 100% rename from src/components/TuringSubmission/TuringSubmission.tsx rename to src/components/Turing/TuringSubmission.tsx diff --git a/src/components/TuringSubmission/index.ts b/src/components/Turing/index.ts similarity index 53% rename from src/components/TuringSubmission/index.ts rename to src/components/Turing/index.ts index 44d8bc4..204b4fe 100644 --- a/src/components/TuringSubmission/index.ts +++ b/src/components/Turing/index.ts @@ -1 +1,2 @@ +export * from './TuringGames' export * from './TuringSubmission' diff --git a/src/components/TuringGames/index.ts b/src/components/TuringGames/index.ts deleted file mode 100644 index 8b3def4..0000000 --- a/src/components/TuringGames/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './TuringGames' diff --git a/src/components/UserProfile/index.ts b/src/components/UserProfile/index.ts deleted file mode 100644 index af67ba4..0000000 --- a/src/components/UserProfile/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -// index.ts adjusted for default export -import UserProfile from './UserProfile' -export { UserProfile } diff --git a/src/components/VerticalBar/VerticalBar.tsx b/src/components/VerticalBar/VerticalBar.tsx deleted file mode 100644 index 2f17b50..0000000 --- a/src/components/VerticalBar/VerticalBar.tsx +++ /dev/null @@ -1 +0,0 @@ -export const VerticalBar = () => <> diff --git a/src/components/VerticalEvaluationBar/index.tsx b/src/components/VerticalEvaluationBar/index.tsx deleted file mode 100644 index 7039152..0000000 --- a/src/components/VerticalEvaluationBar/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './VerticalEvaluationBar' diff --git a/src/components/index.ts b/src/components/index.ts index 615735a..2afd0cb 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,20 +1,10 @@ -export * from './Compose' -export * from './BoardController' -export * from './MovePlot' -export * from './PositionEvaluationContainer' -export * from './VerticalEvaluationBar' -export * from './HorizontalEvaluationBar' -export * from './Header' -export * from './ThemeButton' -export * from './modals' -export * from './Markdown' -export * from './Feedback' -export * from './AuthenticatedWrapper' -export * from './TuringSubmission' -export * from './TuringGames' -export * from './MovesContainer' -export * from './GameBoard' -export * from './Loading' -export * from './ErrorBoundary' -export * from './UserProfile' -export * from './BlunderMeter' +export * from './Core' +export * from './Misc' +export * from './Play' +export * from './Home' +export * from './Board' +export * from './Turing' +export * from './Profile' +export * from './Analysis' +export * from './Training' +export * from './Leaderboard' diff --git a/src/components/modals/InstructionsModal/index.ts b/src/components/modals/InstructionsModal/index.ts deleted file mode 100644 index 175c0dc..0000000 --- a/src/components/modals/InstructionsModal/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './InstructionsModal' diff --git a/src/components/modals/ModalContainer/index.ts b/src/components/modals/ModalContainer/index.ts deleted file mode 100644 index 7d3f764..0000000 --- a/src/components/modals/ModalContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ModalContainer' diff --git a/src/components/modals/PlaySetupModal/bK.svg b/src/components/modals/PlaySetupModal/bK.svg deleted file mode 100644 index 2b18ec8..0000000 --- a/src/components/modals/PlaySetupModal/bK.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/modals/PlaySetupModal/index.ts b/src/components/modals/PlaySetupModal/index.ts deleted file mode 100644 index 534b72a..0000000 --- a/src/components/modals/PlaySetupModal/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PlaySetupModal' diff --git a/src/components/modals/PlaySetupModal/wK.svg b/src/components/modals/PlaySetupModal/wK.svg deleted file mode 100644 index de48959..0000000 --- a/src/components/modals/PlaySetupModal/wK.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/components/modals/index.ts b/src/components/modals/index.ts deleted file mode 100644 index 546ffa8..0000000 --- a/src/components/modals/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './ModalContainer' -export * from './InstructionsModal' diff --git a/src/contexts/ModalContext/ModalContext.ts b/src/contexts/ModalContext/ModalContext.ts index fdf89b5..f30381c 100644 --- a/src/contexts/ModalContext/ModalContext.ts +++ b/src/contexts/ModalContext/ModalContext.ts @@ -1,7 +1,7 @@ -import { Modals } from 'src/types' import React, { ComponentProps } from 'react' -import { InstructionsModal } from 'src/components' -import { PlaySetupModal } from 'src/components/modals/PlaySetupModal/PlaySetupModal' + +import { Modals } from 'src/types' +import { InstructionsModal, PlaySetupModal } from 'src/components' const fn = () => { throw new Error('poorly provided ModalContext') diff --git a/src/contexts/PlayControllerContext/PlayControllerContext.ts b/src/contexts/PlayControllerContext/PlayControllerContext.ts index f606649..471eba5 100644 --- a/src/contexts/PlayControllerContext/PlayControllerContext.ts +++ b/src/contexts/PlayControllerContext/PlayControllerContext.ts @@ -1,4 +1,5 @@ import React from 'react' + import { usePlayController } from 'src/hooks' type IPlayControllerContext = ReturnType diff --git a/src/contexts/ThemeContext/ThemeContext.ts b/src/contexts/ThemeContext/ThemeContext.ts index eed9891..124f1db 100644 --- a/src/contexts/ThemeContext/ThemeContext.ts +++ b/src/contexts/ThemeContext/ThemeContext.ts @@ -1,4 +1,5 @@ import React from 'react' + import { Theme } from 'src/types' interface IThemeContext { diff --git a/src/contexts/TuringControllerContext/TuringControllerContext.ts b/src/contexts/TuringControllerContext/TuringControllerContext.ts index f024923..79bb550 100644 --- a/src/contexts/TuringControllerContext/TuringControllerContext.ts +++ b/src/contexts/TuringControllerContext/TuringControllerContext.ts @@ -1,4 +1,5 @@ import React from 'react' + import { useTuringController } from 'src/hooks' type ITuringControllerContext = ReturnType diff --git a/src/hooks/useGameController/useGameController.ts b/src/hooks/useGameController/useGameController.ts index bf9e4cf..f6f436f 100644 --- a/src/hooks/useGameController/useGameController.ts +++ b/src/hooks/useGameController/useGameController.ts @@ -1,4 +1,5 @@ import { useEffect, useMemo, useState } from 'react' + import { BaseGame, Color } from 'src/types' export const useGameController = ( diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 4e46187..2de437f 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -17,8 +17,7 @@ import 'react-tooltip/dist/react-tooltip.css' import 'chessground/assets/chessground.base.css' import 'chessground/assets/chessground.brown.css' import 'chessground/assets/chessground.cburnett.css' -import { Footer } from 'src/components/Footer/Footer' -import { Compose, ErrorBoundary, Header } from 'src/components/' +import { Footer, Compose, ErrorBoundary, Header } from 'src/components' function MaiaPlatform({ Component, pageProps }: AppProps) { const router = useRouter() diff --git a/src/pages/analysis/[...id].tsx b/src/pages/analysis/[...id].tsx index b51e387..4d9a49c 100644 --- a/src/pages/analysis/[...id].tsx +++ b/src/pages/analysis/[...id].tsx @@ -22,20 +22,21 @@ import { import { Loading, MovePlot, + GameInfo, + GameBoard, BlunderMeter, + MovesContainer, BoardController, + AnalysisGameList, + ContinueAgainstMaia, AuthenticatedWrapper, VerticalEvaluationBar, + HorizontalEvaluationBar, } from 'src/components' import { Color } from 'src/types' import { useAnalysisController } from 'src/hooks' import { AnalyzedGame, MoveMap } from 'src/types/analysis' -import { MovesContainer } from 'src/components/MovesContainer' -import { GameBoard } from 'src/components/GameBoard/GameBoard' -import { GameInfo, ContinueAgainstMaia } from 'src/components/Core' -import AnalysisGameList from 'src/components/Analysis/AnalysisGameList' import { ThemeContext, ModalContext, WindowSizeContext } from 'src/contexts' -import { HorizontalEvaluationBar } from 'src/components/HorizontalEvaluationBar' import { GameControllerContext } from 'src/contexts/GameControllerContext/GameControllerContext' const MAIA_MODELS = [ diff --git a/src/pages/index.tsx b/src/pages/index.tsx index b97b143..877349a 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -3,8 +3,7 @@ import type { NextPage } from 'next' import React, { useCallback, useContext, useEffect, useRef } from 'react' import { ModalContext } from 'src/contexts' -import { HomeHero } from 'src/components/HomeHero/HomeHero' -import { AboutMaia } from 'src/components/AboutMaia/AboutMaia' +import { HomeHero, AboutMaia } from 'src/components' const Home: NextPage = () => { const { setPlaySetupModalProps } = useContext(ModalContext) diff --git a/src/pages/leaderboard.tsx b/src/pages/leaderboard.tsx index d5bbd8b..c6995a7 100644 --- a/src/pages/leaderboard.tsx +++ b/src/pages/leaderboard.tsx @@ -9,7 +9,7 @@ import { TuringIcon, } from 'src/components/Icons/icons' import { getLeaderboard } from 'src/api' -import { LeaderboardColumn } from 'src/components/LeaderboardColumn/LeaderboardColumn' +import { LeaderboardColumn } from 'src/components' const Leaderboard: React.FC = () => { const [lastUpdated, setLastUpdated] = useState(null) diff --git a/src/pages/play/hb.tsx b/src/pages/play/hb.tsx index 5434944..ea35b41 100644 --- a/src/pages/play/hb.tsx +++ b/src/pages/play/hb.tsx @@ -12,13 +12,15 @@ import { submitGameMove, getPlayPlayerStats, } from 'src/api' -import { Loading } from 'src/components' +import { + Loading, + GameplayInterface, + HandBrainPlayControls, +} from 'src/components' import { ModalContext } from 'src/contexts' import { useStats } from 'src/hooks/useStats' import { Color, PlayGameConfig, TimeControl } from 'src/types' import { usePlayController } from 'src/hooks/usePlayController' -import { GameplayInterface } from 'src/components/GameplayInterface' -import { HandBrainPlayControls } from 'src/components/HandBrainPlayControls' import { PlayControllerContext } from 'src/contexts/PlayControllerContext/PlayControllerContext' const brainStatsLoader = async () => { diff --git a/src/pages/play/maia.tsx b/src/pages/play/maia.tsx index 2eae3d2..b726905 100644 --- a/src/pages/play/maia.tsx +++ b/src/pages/play/maia.tsx @@ -9,13 +9,11 @@ import { submitGameMove, getPlayPlayerStats, } from 'src/api' -import { Loading } from 'src/components' import { ModalContext } from 'src/contexts' import { useStats } from 'src/hooks/useStats' -import { PlayControls } from 'src/components/PlayControls' import { Color, TimeControl, PlayGameConfig } from 'src/types' import { usePlayController } from 'src/hooks/usePlayController' -import { GameplayInterface } from 'src/components/GameplayInterface' +import { Loading, PlayControls, GameplayInterface } from 'src/components' import { PlayControllerContext } from 'src/contexts/PlayControllerContext/PlayControllerContext' const playStatsLoader = async () => { diff --git a/src/pages/train.tsx b/src/pages/train.tsx index cd8af96..49d80d4 100644 --- a/src/pages/train.tsx +++ b/src/pages/train.tsx @@ -24,21 +24,22 @@ import { import { Loading, MovePlot, + GameInfo, Feedback, + PuzzleLog, + GameBoard, + StatsDisplay, BoardController, + ContinueAgainstMaia, AuthenticatedWrapper, VerticalEvaluationBar, + HorizontalEvaluationBar, PositionEvaluationContainer, } from 'src/components' -import { GameInfo, ContinueAgainstMaia } from 'src/components/Core' -import { PuzzleLog } from 'src/components/Train' import { useTrainingController } from 'src/hooks' import { AllStats, useStats } from 'src/hooks/useStats' import { TrainingGame, Status } from 'src/types/training' -import { StatsDisplay } from 'src/components/StatsDisplay' import { ModalContext, WindowSizeContext } from 'src/contexts' -import { GameBoard } from 'src/components/GameBoard/GameBoard' -import { HorizontalEvaluationBar } from 'src/components/HorizontalEvaluationBar' import { GameControllerContext } from 'src/contexts/GameControllerContext/GameControllerContext' const statsLoader = async () => { diff --git a/src/pages/turing.tsx b/src/pages/turing.tsx index 5accdf7..d5e3069 100644 --- a/src/pages/turing.tsx +++ b/src/pages/turing.tsx @@ -11,17 +11,18 @@ import { } from 'src/contexts' import { Loading, + GameInfo, GameBoard, TuringGames, + StatsDisplay, MovesContainer, BoardController, TuringSubmission, + ContinueAgainstMaia, } from 'src/components' import { AllStats } from 'src/hooks/useStats' import { TuringGame } from 'src/types/turing' -import { StatsDisplay } from 'src/components/StatsDisplay' import { useGameController, useTuringController } from 'src/hooks' -import { GameInfo, ContinueAgainstMaia } from 'src/components/Core' const TuringPage: NextPage = () => { const { openedModals, setInstructionsModalProps: setInstructionsModalProps } = diff --git a/src/providers/ModalContextProvider/ModalContextProvider.tsx b/src/providers/ModalContextProvider/ModalContextProvider.tsx index 36597df..a46a62f 100644 --- a/src/providers/ModalContextProvider/ModalContextProvider.tsx +++ b/src/providers/ModalContextProvider/ModalContextProvider.tsx @@ -3,8 +3,7 @@ import { ComponentProps, ReactNode, useState } from 'react' import { Modals } from 'src/types' import { useLocalStorage } from 'src/hooks' import { ModalContext } from 'src/contexts' -import { InstructionsModal } from 'src/components' -import { PlaySetupModal } from 'src/components/modals/PlaySetupModal/PlaySetupModal' +import { InstructionsModal, PlaySetupModal } from 'src/components' export const ModalContextProvider: React.FC<{ children: ReactNode }> = ({ children, diff --git a/src/types/analysis/index.ts b/src/types/analysis/index.ts index 35b2cd7..cd8ca12 100644 --- a/src/types/analysis/index.ts +++ b/src/types/analysis/index.ts @@ -18,14 +18,6 @@ export interface AnalysisTournamentGame { result?: string } -export interface AnalysisLichessGame { - id: string - white: string - black: string - pgn: string - result?: string -} - export interface AnalysisWebGame { id: string type: 'tournament' | 'pgn' | 'play' | 'hand' | 'brain' diff --git a/src/types/index.ts b/src/types/index.ts index 612ff87..b34d061 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -7,63 +7,3 @@ export * from './auth' export * from './turing' export * from './modal' export * from './blog' - -interface GameState { - fen: string - lastMove: string | undefined - check: false | 'black' | 'white' - san: string | undefined - evaluations: { [key: string]: number } | undefined - clock: number | undefined -} - -interface Termination { - result: string - winner: 'white' | 'black' | undefined - type: string -} - -interface Player { - id: string - name: string - rating: number - title: string | undefined -} - -// interface StockfishAnalysisMap { -// [move: string]: { -// evaluation: number | undefined -// whiteMate: number | undefined -// blackMate: number | undefined -// winrate: number -// } -// } - -// interface MaiaAnalysisMap { -// [move: string]: number -// } - -// interface AvailableMoves { -// [move: string]: GameState -// } - -// interface Game { -// id: string -// termination: Termination -// gameStates: GameState[] -// whitePlayer: Player | undefined -// blackPlayer: Player | undefined -// } - -// interface AnalysisGame extends Game { -// stockfishAnalyses: { [model: string]: StockfishAnalysisMap[] }[] -// maiaAnalyses: { [model: string]: MaiaAnalysisMap[] }[] -// availableMoves: AvailableMoves[] -// } - -// interface TrainingGame extends Game { -// targetIndex: number -// stockfishAnalyses: { [model: string]: StockfishAnalysisMap[] } -// maiaAnalyses: { [model: string]: MaiaAnalysisMap[] } -// availableMoves: AvailableMoves -// }