Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5dd9a18
added contract abi to frontend
Biokes Dec 16, 2025
2090178
update(integration): add useCOnect hook for game play integration
Biokes Dec 16, 2025
a9ab172
update deprecated useAccount usage
Biokes Dec 16, 2025
99e2d13
update: added useAccount hook, added connectFreeGame func
Biokes Dec 16, 2025
5a90e4d
added address validationn before execution for game connection
Biokes Dec 16, 2025
d3110fe
update checkout
Biokes Dec 16, 2025
7927be1
update(integration): comment out workflow
Biokes Dec 17, 2025
76a7c97
update(integration): added chess page
Biokes Dec 17, 2025
cde03f7
update(integration): added chess page importation
Biokes Dec 17, 2025
cfc343e
update(integration): added chess component
Biokes Dec 17, 2025
af25124
update(integration): added piece types
Biokes Dec 17, 2025
fc04814
update(integration): added board initializer
Biokes Dec 17, 2025
12b2c8e
update(integration): added state managements for chess
Biokes Dec 17, 2025
35d17d4
update(integration): added squareClickHandler
Biokes Dec 17, 2025
f8782b8
update(integration): added moveHandler
Biokes Dec 17, 2025
5278f82
update(integration): added resetHandler
Biokes Dec 17, 2025
4f43628
update(integration): added chess board header
Biokes Dec 17, 2025
0bb88f4
update(integration): added chess board container
Biokes Dec 17, 2025
9bade0f
update(integration): added chess board footer for interactions
Biokes Dec 17, 2025
880017a
update(integration): added chess board wrapper
Biokes Dec 17, 2025
3b52c92
update(integration): added chess board topmost wrapper
Biokes Dec 17, 2025
e4338a2
chores (integration): type all local vars
Biokes Dec 17, 2025
cab2c53
chores (integration): edit cheess title
Biokes Dec 17, 2025
7f332d3
update (integration): update
Biokes Dec 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
push:
branch: ["main", "dev"]
# on:
# push:
# branch: ["main", "dev"]

jobs:
# jobs:
18 changes: 9 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"arrowParens": "always",
"tabWidth": 4,
"useTabs": true,
"bracketSpacing": true,
"bracketSameLine": false
}
"semi": true,
"singleQuote": false,
"trailingComma": "none",
"arrowParens": "always",
"tabWidth": 2,
"useTabs": true,
"bracketSpacing": true,
"bracketSameLine": false
}
7 changes: 7 additions & 0 deletions frontend/app/chess/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Chess from "@/components/chess";

export default function ChessPage() {
return (
<Chess/>
)
}
102 changes: 102 additions & 0 deletions frontend/components/chess/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
"use client";

import { initializeBoard, pieceSymbols } from "@/lib/utils";
import { useState } from "react";

export default function Chess() {

const [board] = useState(initializeBoard());
const [selectedSquare, setSelectedSquare] = useState<Array<number>| null>(null);

const handleSquareClick = (row:number, col:number) => {
const piece = board[row][col];

if (selectedSquare) {
const [fromRow, fromCol] = selectedSquare;
handleMakeMove(fromRow, fromCol, row, col);

setSelectedSquare(null);
} else {
if (piece) {
setSelectedSquare([row, col]);
}
}
};

const handleMakeMove = (fromRow: number, fromCol: number, toRow: number, toCol: number) => {
console.log(`Move from [${fromRow}, ${fromCol}] to [${toRow}, ${toCol}]`);
};

const handleReset = () => {
console.log('Reset board');
};


return (
<div className="min-h-screen flex items-center justify-center p-4 sm:p-6 md:p-8">
<div className="w-full max-w-3xl">
<div className="text-center mb-6 sm:mb-8 bg-blue-300 rounded p-2">
<h1 className="text-3xl sm:text-4xl md:text-5xl font-bold text-white mb-2 ribeye">
Chess Board
</h1>
</div>

<div className="aspect-square bg-blue-50 p-3 sm:p-4 md:p-6 rounded-lg shadow-2xl">
<div className="w-full h-full grid grid-cols-8 gap-0 bg-white rounded-sm overflow-hidden shadow-inner">
{board.map((row, rowIndex) =>
row.map((piece, colIndex) => {
const isLight = (rowIndex + colIndex) % 2 === 0;
const fileLabel = String.fromCharCode(97 + colIndex);
const rankLabel = 8 - rowIndex;
const showFileLabel = rowIndex === 7;
const showRankLabel = colIndex === 0;
const isSelected = selectedSquare && selectedSquare[0] === rowIndex && selectedSquare[1] === colIndex;

return (
<button
key={`${rowIndex}-${colIndex}`}
onClick={() => handleSquareClick(rowIndex, colIndex)}
className={`relative aspect-square flex flex-col items-center justify-center transition-all duration-150 cursor-pointer hover:opacity-90 ${isLight
? 'bg-blue-200'
: 'bg-blue-500'
} ${isSelected ? 'ring-4 ring-yellow-300 ring-inset' : ''}`}
>
{piece && (
<div className={`text-4xl sm:text-5xl md:text-6xl lg:text-7xl leading-none drop-shadow-lg ${piece.color === 'white'
? 'text-white'
: 'text-black'
}`}>
{pieceSymbols[piece.color][piece.type]}
</div>
)}

{showFileLabel && (
<div className="absolute bottom-1 sm:bottom-1.5 right-1 sm:right-1.5 text-[10px] sm:text-xs font-bold text-blue-900 opacity-70">
{fileLabel}
</div>
)}

{showRankLabel && (
<div className="absolute top-1 sm:top-1.5 left-1 sm:left-1.5 text-[10px] sm:text-xs font-bold text-blue-900 opacity-70">
{rankLabel}
</div>
)}
</button>
);
})
)}
</div>
</div>

<div className="mt-6 sm:mt-8 flex justify-center gap-4">
<button
onClick={handleReset}
className="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition-colors duration-200"
>
Reset
</button>
</div>
</div>
</div>
)
}
190 changes: 190 additions & 0 deletions frontend/components/ui/select.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
"use client"

import * as React from "react"
import * as SelectPrimitive from "@radix-ui/react-select"
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"

import { cn } from "@/lib/utils"

function Select({
...props
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
return <SelectPrimitive.Root data-slot="select" {...props} />
}

function SelectGroup({
...props
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
return <SelectPrimitive.Group data-slot="select-group" {...props} />
}

function SelectValue({
...props
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
return <SelectPrimitive.Value data-slot="select-value" {...props} />
}

function SelectTrigger({
className,
size = "default",
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
size?: "sm" | "default"
}) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
data-size={size}
className={cn(
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDownIcon className="size-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
)
}

function SelectContent({
className,
children,
position = "item-aligned",
align = "center",
...props
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
return (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
data-slot="select-content"
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
position={position}
align={align}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
)
}

function SelectLabel({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
return (
<SelectPrimitive.Label
data-slot="select-label"
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
{...props}
/>
)
}

function SelectItem({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
return (
<SelectPrimitive.Item
data-slot="select-item"
className={cn(
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
className
)}
{...props}
>
<span
data-slot="select-item-indicator"
className="absolute right-2 flex size-3.5 items-center justify-center"
>
<SelectPrimitive.ItemIndicator>
<CheckIcon className="size-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
)
}

function SelectSeparator({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
return (
<SelectPrimitive.Separator
data-slot="select-separator"
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
{...props}
/>
)
}

function SelectScrollUpButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
return (
<SelectPrimitive.ScrollUpButton
data-slot="select-scroll-up-button"
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronUpIcon className="size-4" />
</SelectPrimitive.ScrollUpButton>
)
}

function SelectScrollDownButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
return (
<SelectPrimitive.ScrollDownButton
data-slot="select-scroll-down-button"
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronDownIcon className="size-4" />
</SelectPrimitive.ScrollDownButton>
)
}

export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectScrollDownButton,
SelectScrollUpButton,
SelectSeparator,
SelectTrigger,
SelectValue,
}
Loading