Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@
"eslint --fix"
]
},
"dependencies": {
"styled-components": "^6.1.13",
"vite-plugin-dts": "^4.5.0"
},
"dependencies": {},
"devDependencies": {
"@commitlint/cli": "^19.6.1",
"@commitlint/config-conventional": "^19.6.0",
Expand All @@ -77,6 +74,7 @@
"prettier": "3.4.2",
"typescript": "~5.6.2",
"typescript-eslint": "^8.13.0",
"vite": "^5.4.10"
"vite": "^5.4.10",
"vite-plugin-dts": "^4.5.0"
}
}
102 changes: 3 additions & 99 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/components/Backgammon.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"use client";
import React from "react";
import {
DimensionProvider,
GameStateProvider,
PositionProvider,
ThemeProvider,
} from "../providers";
import { BoardStateState } from "../types";
import { BoardState } from "../types";
import { Board } from "./Board";

export const Backgammon: React.FC<BoardStateState> = ({
export const Backgammon: React.FC<BoardState> = ({
theme,
positions,
preset,
Expand Down
10 changes: 5 additions & 5 deletions src/components/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export const Board: React.FC = () => {
pointWidth,
boardHeight,
sidebarWidth,
sidebarRationModifier,
sidebarRatioModifier,
} = dimensions;

const direction = gameState?.direction ?? "clockwise";
const isClockwise = direction === "clockwise";

const sidebarRenderedWidth = sidebarWidth * sidebarRationModifier;
const sidebarRenderedWidth = sidebarWidth * sidebarRatioModifier;
const mainBoardX = isClockwise ? 0 : sidebarRenderedWidth - borderWidth;
const sidebarX = isClockwise
? boardWidth - sidebarRenderedWidth - borderWidth
Expand All @@ -36,14 +36,14 @@ export const Board: React.FC = () => {
key="board"
width="100%"
height="100%"
viewBox={`0 0 ${boardWidth - borderWidth} ${boardHeight * sidebarRationModifier}`}
viewBox={`0 0 ${boardWidth - borderWidth} ${boardHeight * sidebarRatioModifier}`}
xmlns="http://www.w3.org/2000/svg"
>
<svg
key="main-board"
x={mainBoardX}
width={boardWidth - sidebarWidth * sidebarRationModifier}
height={boardHeight * sidebarRationModifier}
width={boardWidth - sidebarWidth * sidebarRatioModifier}
height={boardHeight * sidebarRatioModifier}
viewBox={`0 0 ${boardWidth} ${boardHeight}`}
xmlns="http://www.w3.org/2000/svg"
>
Expand Down
30 changes: 3 additions & 27 deletions src/components/Checker.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
import React from "react";
import { useDimensions, usePosition, useTheme } from "../providers";
import { PlayerType } from "../types";
import { NumberRange } from "../type-utils";

type CheckerProps = {
x:
| 0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
| 10
| 11
| 12
| 13
| 14
| 15
| 16
| 17
| 18
| 19
| 20
| 21
| 22
| 23
| 24
| "bar";
x: NumberRange<25> | "bar";
y: number;
playerType: PlayerType;
totalOnPoint: number;
Expand Down
15 changes: 3 additions & 12 deletions src/components/Die.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React from "react";

import { useDimensions, useTheme } from "../providers";
import { DieValue, PlayerType } from "../types";

Expand All @@ -6,7 +8,7 @@ type DieProps = {
colorSchema: PlayerType;
};

export const Die: React.FC<DieProps> = ({ value = 2, colorSchema }) => {
export const Die: React.FC<DieProps> = ({ value, colorSchema }) => {
const {
playerCheckerColor,
playerCheckerBorderColor,
Expand Down Expand Up @@ -57,14 +59,12 @@ export const Die: React.FC<DieProps> = ({ value = 2, colorSchema }) => {
r={dieDotSize}
fill={dotFillColor}
/>
;
<circle
cx={(dieWidth / 4) * 3}
cy={dieWidth / 2}
r={dieDotSize}
fill={dotFillColor}
/>
;
</>
);
break;
Expand Down Expand Up @@ -101,7 +101,6 @@ export const Die: React.FC<DieProps> = ({ value = 2, colorSchema }) => {
r={dieDotSize}
fill={dotFillColor}
/>
;
</>
);
break;
Expand Down Expand Up @@ -156,7 +155,6 @@ export const Die: React.FC<DieProps> = ({ value = 2, colorSchema }) => {
r={dieDotSize}
fill={dotFillColor}
/>
;
</>
);
break;
Expand Down Expand Up @@ -206,13 +204,6 @@ export const Die: React.FC<DieProps> = ({ value = 2, colorSchema }) => {
fill={dieBackgroundColor}
/>
{dots}
{/* <circle cx={dieWidth / 4} cy={dieWidth / 2} r={dieDotSize} fill={dotFillColor} />
<circle cx={dieWidth / 4 * 3} cy={dieWidth / 2} r={dieDotSize} fill={dotFillColor} />
<circle cx={dieWidth / 4} cy={dieWidth / 4} r={dieDotSize} fill={dotFillColor} />
<circle cx={dieWidth / 4} cy={dieWidth / 4} r={dieDotSize} fill={dotFillColor} />
<circle cx={dieWidth / 4} cy={dieWidth / 4 * 3} r={dieDotSize} fill={dotFillColor} />
<circle cx={dieWidth / 4 * 3} cy={dieWidth / 4} r={dieDotSize} fill={dotFillColor} />
<circle cx={dieWidth / 4 * 3} cy={dieWidth / 4 * 3} r={dieDotSize} fill={dotFillColor} /> */}
</svg>
</g>
);
Expand Down
Loading
Loading