Skip to content

Commit

Permalink
DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
visnup committed Jan 24, 2024
1 parent f9ceef6 commit 2032798
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion convex/deals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { mutation, query } from "./_generated/server.js";

const suits = [..."♣♦♥♠"];
const ranks = [..."23456789", "10", ..."JQKA"];
const deck = cross(ranks, suits, (r, s) => r + s);
export const deck = cross(suits, ranks, (s, r) => r + s);

export const clear = mutation({
args: { table: v.string() },
Expand Down
6 changes: 1 addition & 5 deletions src/pages/test/deal.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { useState } from "react";
import { cross } from "d3-array";
import { Card } from "../../components/Card";

const suits = [..."♣♦♥♠"];
const ranks = [..."23456789", "10", ..."JQKA"];
const deck = cross(ranks, suits, (r, s) => r + s);
import { deck } from "../../../convex/deals";

export default function Test() {
const [revealed, setRevealed] = useState(false);
Expand Down
8 changes: 2 additions & 6 deletions src/pages/test/faces.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { cross } from "d3-array";
import { deck } from "../../../convex/deals";
import { Card } from "../../components/Card";

const suits = [..."♣♦♥♠"];
const ranks = [..."23456789", "10", ..."JQKA"];
const deck = cross(ranks, suits, (r, s) => r + s);

export default function Test() {
return (
<main>
{deck.slice(0, 26).map((card) => (
{deck.map((card) => (
<Card key={card} card={card} anchor="top" rotation={0} revealed />
))}
<style jsx>{`
Expand Down

1 comment on commit 2032798

@vercel
Copy link

@vercel vercel bot commented on 2032798 Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

poker – ./

poker-visnup.vercel.app
poker-git-main-visnup.vercel.app
poker.dance

Please sign in to comment.