diff --git a/Makefile b/Makefile index 3600cf1..8ff73bc 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ build: --cache-from=type=local,src=/var/cache/docker-build \ --cache-to=type=local,dest=/var/cache/docker-build \ --platform linux/arm64 \ + --progress=plain \ --tag games . diff --git a/package.json b/package.json index 54b7fdd..634cee5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "games", "type": "module", - "version": "0.0.1", + "version": "0.0.2", "scripts": { "dev": "vinxi dev", "build": "vinxi build", diff --git a/src/app.css b/src/app.css index 3f17b14..3f1f248 100644 --- a/src/app.css +++ b/src/app.css @@ -50,3 +50,7 @@ body::before { bottom: 0; right: 0; } + +.clear { + pointer-events: none; +} diff --git a/src/app.tsx b/src/app.tsx index af22628..d125f3c 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -5,8 +5,16 @@ import { Suspense } from "solid-js"; import pkg from "~/../package.json"; const Version = () => ( -
- +
+ v{pkg.version}
diff --git a/src/components/Card.tsx b/src/components/Card.tsx index 051d0f8..a75b487 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -1,8 +1,25 @@ import { Component, createResource, Suspense } from "solid-js"; +import { Card } from "../types/cards"; -export default (() => { +const cardToSvgFilename = (card: Card) => { + if (card.kind == "joker") { + return `JOKER-${card.color == "black" ? "2" : "3"}`; + } + + const value = + { ace: 1, jack: 11, queen: 12, king: 13 }[card.rank] ?? + (card.rank as number); + return `${card.suit.toUpperCase()}-${value}${ + value >= 11 ? "-" + (card.rank as string).toUpperCase() : "" + }`; +}; + +export default ((props) => { const [svgPath] = createResource( - () => import(`~/../assets/views/cards/CLUB-1.svg`) + () => + import( + `~/../assets/views/cards/${cardToSvgFilename(props.card)}.svg` + ) ); return ( @@ -10,4 +27,4 @@ export default (() => { ); -}) satisfies Component; +}) satisfies Component<{ card: Card }>; diff --git a/src/components/Game.tsx b/src/components/Game.tsx index b687c87..0973c15 100644 --- a/src/components/Game.tsx +++ b/src/components/Game.tsx @@ -8,7 +8,7 @@ export default () => { style={{ "row-gap": "20px", "font-size": "32px" }} > games - + coming soon
); diff --git a/src/types/cards.ts b/src/types/cards.ts index 7b75101..94f5970 100644 --- a/src/types/cards.ts +++ b/src/types/cards.ts @@ -1,9 +1,13 @@ -export type Suit = "hearts" | "diamonds" | "spades" | "clubs"; +export type Suit = "heart" | "diamond" | "spade" | "club"; -export type Card = { - suit: Suit; - value: number; -}; +type Rank = number | "jack" | "queen" | "king" | "ace"; +export type Card = + | { + kind: "normal"; + suit: Suit; + rank: Rank; + } + | { kind: "joker"; color: "red" | "black" }; export type Pile = Card[]; export type Stack = Card[];