-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from ArnasDickus/develop
Merge develop branch to main
- Loading branch information
Showing
29 changed files
with
299 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
describe("check Chess redirection", () => { | ||
it("Visit play chess page", () => { | ||
cy.loginUI(Cypress.env("TEST_USERNAME"), Cypress.env("TEST_PASSWORD")); | ||
cy.wait(5000); | ||
cy.visit("en/chess"); | ||
cy.get('[data-testid="playChessLinkButton"]').click(); | ||
cy.get('[data-testid="pagePlayChessId"]'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"types": ["cypress"] | ||
"types": ["cypress", "mocha"] | ||
}, | ||
"include": ["../node_modules/cypress", "./**/*.ts"] | ||
"include": ["../node_modules/cypress", "./**/*.ts", "../cypress.config.ts"], | ||
"exclude": ["src/*.test.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.container { | ||
background-color: #302e2b; | ||
} | ||
|
||
.wrapper { | ||
padding-top: 20px; | ||
margin-right: auto; | ||
margin-left: auto; | ||
max-width: 920px; | ||
padding-right: 10px; | ||
padding-left: 10px; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/app/[lng]/chess/components/chess-buttons/chess-buttons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { useTranslation } from "@/app/i18n"; | ||
import Button from "@/components/button/button"; | ||
import Link from "next/link"; | ||
|
||
const ChessButtons = async ({ language }: { language: string }) => { | ||
const { t } = await useTranslation({ | ||
language, | ||
ns: "chess", | ||
}); | ||
|
||
return ( | ||
<div> | ||
<Button | ||
dataTestIdButton="playChessLinkButton" | ||
buttonProps={{ | ||
type: "button", | ||
}}> | ||
{/* @ts-ignore */} | ||
<Link href={`/${language}/chess/play-chess`}>{t("newGame")}</Link> | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
export default ChessButtons; |
15 changes: 15 additions & 0 deletions
15
src/app/[lng]/chess/components/chess-header/chess-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"use client"; | ||
import { useSession } from "next-auth/react"; | ||
|
||
const ChessHeader = () => { | ||
const { data: session } = useSession(); | ||
|
||
return ( | ||
<div className="pb-5 pt-5"> | ||
<h2 className="text-white font-semibold text-2xl"> | ||
{session?.user?.name} | ||
</h2> | ||
</div> | ||
); | ||
}; | ||
export default ChessHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import PageContainer from "@/styles/components/page-container"; | ||
import classes from "./chess.module.css"; | ||
import { IPageParamProps } from "@/constants/interfaces"; | ||
import { ServerFooter } from "@/components/layout/footer/serverfooter"; | ||
import ChessHeader from "./components/chess-header/chess-header"; | ||
import ChessButtons from "./components/chess-buttons/chess-buttons"; | ||
import NavbarWrapper from "@/styles/components/navbar-wrapper/navbar-wrapper"; | ||
|
||
const PageChessHome = ({ params }: IPageParamProps) => { | ||
return ( | ||
<div className={classes.container}> | ||
<PageContainer | ||
language={params.lng} | ||
footer={<ServerFooter language={params.lng} path="/chess" />}> | ||
<NavbarWrapper> | ||
<ChessHeader /> | ||
<ChessButtons language={params.lng} /> | ||
</NavbarWrapper> | ||
</PageContainer> | ||
</div> | ||
); | ||
}; | ||
export default PageChessHome; |
16 changes: 16 additions & 0 deletions
16
src/app/[lng]/chess/play-chess/components/chess-game/chess-game.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DndContext } from "@dnd-kit/core"; | ||
import Draggable from "./draggable/draggable"; | ||
import Droppable from "./droppable/droppable"; | ||
|
||
const ChessGame = () => { | ||
return ( | ||
<div className="pt-20"> | ||
<DndContext> | ||
<Draggable /> | ||
<Droppable /> | ||
</DndContext> | ||
<p>ChessGame</p> | ||
</div> | ||
); | ||
}; | ||
export default ChessGame; |
21 changes: 21 additions & 0 deletions
21
src/app/[lng]/chess/play-chess/components/chess-game/draggable/draggable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
import { useDraggable } from "@dnd-kit/core"; | ||
|
||
const Draggable = (props: any) => { | ||
const { attributes, listeners, setNodeRef, transform } = useDraggable({ | ||
id: "draggable", | ||
}); | ||
const style = transform | ||
? { | ||
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`, | ||
} | ||
: undefined; | ||
|
||
return ( | ||
<button ref={setNodeRef} style={style} {...listeners} {...attributes}> | ||
{props.children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default Draggable; |
19 changes: 19 additions & 0 deletions
19
src/app/[lng]/chess/play-chess/components/chess-game/droppable/droppable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import { useDroppable } from "@dnd-kit/core"; | ||
|
||
const Droppable = (props: any) => { | ||
const { isOver, setNodeRef } = useDroppable({ | ||
id: "droppable", | ||
}); | ||
const style = { | ||
color: isOver ? "green" : undefined, | ||
}; | ||
|
||
return ( | ||
<div ref={setNodeRef} style={style}> | ||
{props.children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Droppable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const PagePlayChess = () => { | ||
return ( | ||
<div data-testid="pagePlayChessId"> | ||
<p>PagePlayChess</p> | ||
</div> | ||
); | ||
}; | ||
export default PagePlayChess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"newGame": "New Game" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"newGame": "Naujas žaidimas" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.