From df138962d61939eeeb0f0562919a0094be168487 Mon Sep 17 00:00:00 2001 From: DecentM Date: Mon, 2 Oct 2023 04:51:22 +0300 Subject: [PATCH] feat: remove afen sidebar, create new sidebar with move history --- apps/frontend/src/components/afen-info.vue | 181 ------------------ apps/frontend/src/components/chess-board.vue | 134 ++++++------- apps/frontend/src/components/game-sidebar.vue | 79 ++++++++ apps/frontend/src/css/app.scss | 23 +++ .../src/hooks/chess-rtc-connection.ts | 2 +- apps/frontend/src/layouts/main-layout.vue | 10 +- apps/frontend/src/pages/play/online-game.vue | 3 - apps/frontend/src/pages/play/pen-pal-game.vue | 94 +++++---- apps/frontend/src/pages/play/setup-game.vue | 2 +- apps/frontend/src/router/routes.ts | 2 +- packages/core/src/afen/index.ts | 3 + packages/core/src/chess/board-memory.ts | 30 +-- packages/core/src/chess/board.ts | 48 +++-- packages/core/src/index.ts | 7 +- packages/core/src/notation/index.ts | 4 + 15 files changed, 292 insertions(+), 330 deletions(-) delete mode 100644 apps/frontend/src/components/afen-info.vue create mode 100644 apps/frontend/src/components/game-sidebar.vue create mode 100644 packages/core/src/afen/index.ts create mode 100644 packages/core/src/notation/index.ts diff --git a/apps/frontend/src/components/afen-info.vue b/apps/frontend/src/components/afen-info.vue deleted file mode 100644 index 0f15bf8..0000000 --- a/apps/frontend/src/components/afen-info.vue +++ /dev/null @@ -1,181 +0,0 @@ - - - diff --git a/apps/frontend/src/components/chess-board.vue b/apps/frontend/src/components/chess-board.vue index 446eaf0..a79a443 100644 --- a/apps/frontend/src/components/chess-board.vue +++ b/apps/frontend/src/components/chess-board.vue @@ -22,85 +22,91 @@ const sidebarWidth = computed(() => { diff --git a/apps/frontend/src/components/game-sidebar.vue b/apps/frontend/src/components/game-sidebar.vue new file mode 100644 index 0000000..1f21bff --- /dev/null +++ b/apps/frontend/src/components/game-sidebar.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/apps/frontend/src/css/app.scss b/apps/frontend/src/css/app.scss index ecac98f..f162486 100644 --- a/apps/frontend/src/css/app.scss +++ b/apps/frontend/src/css/app.scss @@ -1 +1,24 @@ // app global css in SCSS form + +.v- { + &enter-active, + &leave-active { + transition-property: transform, opacity, filter; + transition-duration: 0.2s; + } + + &enter-active { + transition-timing-function: cubic-bezier(0.19, 0.84, 0.53, 1); + } + + &leave-active { + transition-timing-function: cubic-bezier(0.58, 0.05, 0.91, 0.53); + } + + &enter-from, + &leave-to { + opacity: 0; + transform: scale(0.95); + filter: grayscale(1); + } +} diff --git a/apps/frontend/src/hooks/chess-rtc-connection.ts b/apps/frontend/src/hooks/chess-rtc-connection.ts index 7831057..9d3e4cb 100644 --- a/apps/frontend/src/hooks/chess-rtc-connection.ts +++ b/apps/frontend/src/hooks/chess-rtc-connection.ts @@ -24,8 +24,8 @@ export type ChessRtcConnection = { sendMessage: (message: ChessMessage) => void open: Ref disconnect: () => void - serverSide: Ref<'white' | 'black' | null> + serverSide: Ref<'white' | 'black' | null> boardAFEN: Ref moveHistory: Ref } diff --git a/apps/frontend/src/layouts/main-layout.vue b/apps/frontend/src/layouts/main-layout.vue index 8acb215..00a02b9 100644 --- a/apps/frontend/src/layouts/main-layout.vue +++ b/apps/frontend/src/layouts/main-layout.vue @@ -4,6 +4,10 @@ import { useRoute } from 'vue-router' import SidebarMenu from './main/sidebar-menu.vue' const route = useRoute() + +defineProps<{ + fullwidth?: boolean +}>() @@ -38,7 +38,7 @@ const route = useRoute() - + { Board information - - diff --git a/apps/frontend/src/pages/play/pen-pal-game.vue b/apps/frontend/src/pages/play/pen-pal-game.vue index d5739ca..befd654 100644 --- a/apps/frontend/src/pages/play/pen-pal-game.vue +++ b/apps/frontend/src/pages/play/pen-pal-game.vue @@ -1,11 +1,11 @@ diff --git a/apps/frontend/src/pages/play/setup-game.vue b/apps/frontend/src/pages/play/setup-game.vue index 294a95a..0631643 100644 --- a/apps/frontend/src/pages/play/setup-game.vue +++ b/apps/frontend/src/pages/play/setup-game.vue @@ -104,7 +104,7 @@ onMounted(() => {