Changed all occurrences of 'yahtzee' to 'superkadi', allowed the gameboards to be hydrated by JSON data upon instantiation (also after).

This commit is contained in:
Daniel Ledda
2020-06-28 13:21:06 +02:00
parent 166ec7525a
commit bc0b4cfe4d
14 changed files with 108 additions and 86 deletions

View File

@@ -1,9 +1,9 @@
import React, {ChangeEvent, FocusEvent, ReactNode, KeyboardEvent} from "react";
import {CellFlag, FieldType} from "../static/enums";
import {ScoreCellValue} from "../Classes/ScoreCell";
import {CellEventResponse} from "./KadiBoard";
import {CellLocation} from "../Classes/PlayerScoreCard";
import {useLongPress} from "./useLongPress";
import {CellFlag, FieldType} from "../../../shared/rulesets";
export type KadiCellDisplayValue = ScoreCellValue | CellFlag.strike;
@@ -93,8 +93,8 @@ class KadiCell extends React.Component<KadiCellProps, KadiCellState> {
return <MultipleKadiCell {...propsForEditableCell}/>;
case FieldType.number:
return <NumberKadiCell {...propsForEditableCell}/>;
case FieldType.yahtzee:
return <YahtzeeKadiCell {...propsForEditableCell}/>;
case FieldType.superkadi:
return <SuperkadiKadiCell {...propsForEditableCell}/>;
}
}
}
@@ -185,16 +185,16 @@ const NumberKadiCell: React.FunctionComponent<EditableKadiCellProps> = ({ strike
)
};
const YahtzeeKadiCell: React.FunctionComponent<EditableKadiCellProps> = ({value, timeoutMs, strikeCell, updateCell}) => {
const SuperkadiKadiCell: React.FunctionComponent<EditableKadiCellProps> = ({value, timeoutMs, strikeCell, updateCell}) => {
const handleClick = (): void => updateCell(true);
const strikeCellOnLongPress = useLongPress(strikeCell, timeoutMs);
return (
<td
className={"kadiCell editable yahtzeeField"}
className={"kadiCell editable superkadiField"}
onClick={handleClick}
{...strikeCellOnLongPress}
>
<div className={"yahtzeeField"}>
<div className={"superkadiField"}>
{value}
</div>
</td>