Skip to content

Commit 8509583

Browse files
committed
feat: judge does not play...
1 parent 93d9996 commit 8509583

File tree

6 files changed

+66
-14
lines changed

6 files changed

+66
-14
lines changed

apps/web/packs/base-pack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type CardPack } from 'types/pack';
1+
import type { CardPack } from 'types/pack';
22

33
const basePack: CardPack = {
44
id: 'base-pack',

apps/web/packs/snowye-pack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type CardPack } from 'types/pack';
1+
import type { CardPack } from 'types/pack';
22

33
const snowyePack: CardPack = {
44
id: 'snowye-base',

apps/web/packs/xmas-pack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type CardPack } from 'types/pack';
1+
import type { CardPack } from 'types/pack';
22

33
const xmasPack: CardPack = {
44
id: 'xmas-pack',

apps/web/src/components/brand/logo-text.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import Link from 'next/link';
22
import { siteConfig } from 'config/site';
33
import { LogoIcon } from './logo-icon';
44

5-
interface LogoTextProps {}
6-
7-
export function LogoText({}: LogoTextProps) {
5+
export function LogoText() {
86
return (
97
<Link href={'/'} className="flex w-fit items-center gap-2">
108
<LogoIcon />

apps/web/src/components/game/cards/black-card.tsx

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,63 @@
1+
'use client';
2+
3+
import { useMemo } from 'react';
14
import { useGame } from '@/hooks/game';
25
import { CardFooter } from './card-footer';
36
import { CardHeader } from './card-header';
47

58
export function BlackCard() {
69
const { currentBlackCard } = useGame();
7-
// TODO:
8-
// - [ ] Handle pick (Fill in the blanks)
9-
// - [ ] Blank fill style
10+
// Determine text size class based on character count
11+
const textSizeClass = useMemo(() => {
12+
const text = currentBlackCard?.text || '';
13+
const charCount = text.length;
14+
15+
// Text size thresholds based on character count
16+
if (charCount <= 74) return 'text-4xl'; // Up to 74 chars
17+
if (charCount <= 100) return 'text-3xl'; // Up to 100 chars
18+
if (charCount <= 150) return 'text-2xl'; // Up to 150 chars
19+
if (charCount <= 200) return 'text-xl'; // Up to 200 chars
20+
return 'text-lg'; // More than 200 chars
21+
}, [currentBlackCard?.text]);
22+
23+
// Process text to replace "___" with styled lines
24+
const processedContent = useMemo(() => {
25+
const text = currentBlackCard?.text || '';
26+
27+
// If no fill-in-the-gap markers, return the text as is
28+
if (!text.includes('___')) return text;
29+
30+
// Split by the fill-in-the-gap marker
31+
const segments = text.split('___');
32+
33+
// Map through segments and join with styled lines
34+
return segments.map((segment, index) => {
35+
// Last segment doesn't need a line after it
36+
if (index === segments.length - 1) {
37+
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
38+
return <span key={index}>{segment}</span>;
39+
}
40+
41+
// Add a line after each segment (except the last)
42+
return (
43+
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
44+
<span key={index}>
45+
{segment}
46+
<span className="mx-1 inline-block h-4 w-24 border-b-2 border-zinc-50 align-middle" />
47+
</span>
48+
);
49+
});
50+
}, [currentBlackCard?.text]);
1051

1152
return (
1253
<div className="flex aspect-card h-[30rem] flex-col justify-between gap-5 rounded-2xl border border-zinc-950 bg-zinc-950 p-9 dark:border-zinc-50">
1354
<CardHeader packId={currentBlackCard?.packId || ''} variant="blackCard" />
1455

15-
<div className="flex-1">
16-
<span className="text-4xl font-bold leading-snug text-zinc-50">
17-
{currentBlackCard?.text || ''}
56+
<div className="flex flex-1 items-center">
57+
<span
58+
className={`${textSizeClass} font-bold leading-snug text-zinc-50`}
59+
>
60+
{processedContent}
1861
</span>
1962
</div>
2063

apps/web/src/components/game/game-player-deck.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@ import { WhiteCard } from './cards/white-card';
55

66
export function GamePlayerDeck() {
77
// TODO: -space-x-10 group hover:space-x-8 stack arc */
8-
const { currentWhiteCards } = useGame();
8+
const { currentWhiteCards, currentPlayer } = useGame();
9+
10+
const isJudge = currentPlayer.isJudge;
11+
12+
console.log(currentPlayer);
13+
14+
if (isJudge) {
15+
return (
16+
<div>
17+
<span>Como já esperado, Juiz não trabalha no Brasil...</span>
18+
</div>
19+
);
20+
}
921

10-
console.log('currentWhiteCards', currentWhiteCards);
1122
return (
1223
<div className="flex w-full items-center justify-center space-x-4">
1324
{currentWhiteCards.map(card => (

0 commit comments

Comments
 (0)