Skip to content

Commit

Permalink
update: Thu 01 Aug 2024 08:14:42 CEST
Browse files Browse the repository at this point in the history
  • Loading branch information
cophilot committed Aug 1, 2024
1 parent 6231d5e commit f8c5324
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
38 changes: 31 additions & 7 deletions src/api/BoardScoreTable/BoardScoreTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,42 @@ type FirstRowCellProps = {
};

function FirstRowCell({ row, helpOn }: FirstRowCellProps) {
let inner = row.name;
if (row.icon) {
inner = <img src={row.icon} alt={row.name} className="row-icon" />;
if (helpOn) {
inner = (
const [showHelp, setShowHelp] = useState(helpOn);
const [inner, setInner] = useState(row.name);

const onIconClick = () => {
if (helpOn || showHelp) {
return;
}
setShowHelp(true);
setTimeout(() => {
setShowHelp(false);
}, 2000);
};

useEffect(() => {
if (!row.icon) {
return;
}
let newInner = (
<img
src={row.icon}
alt={row.name}
className="row-icon"
onClick={onIconClick}
/>
);
if (helpOn || showHelp) {
newInner = (
<>
{inner}
{newInner}
<p className="row-help">{row.name}</p>
</>
);
}
}
setInner(newInner);
}, [row.icon, row.name, helpOn, showHelp]);

return <td style={{ fontWeight: 'bold' }}>{inner}</td>;
}

Expand Down
6 changes: 3 additions & 3 deletions src/games/forest-shuffle/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ export default function getDefinition() {
icon: cardIcon,
},
{
name: 'Cards on top',
name: 'Cards top',
icon: topIcon,
},
{
name: 'Cards on right',
name: 'Cards right',
icon: rightIcon,
},
{
name: 'Cards below',
icon: downIcon,
},
{
name: 'Cards on left',
name: 'Cards left',
icon: leftIcon,
},
{
Expand Down

0 comments on commit f8c5324

Please sign in to comment.