fix donation

This commit is contained in:
Olivier Gagnon 2021-09-22 12:49:29 -04:00
parent 3a7c64872a
commit c1945ab12e
5 changed files with 16 additions and 11 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -52,6 +52,7 @@ export function DonateOption(props: IProps): React.ReactElement {
const amt = numeralWrapper.parseMoney(event.target.value); const amt = numeralWrapper.parseMoney(event.target.value);
if (event.target.value === "" || isNaN(amt)) setDonateAmt(null); if (event.target.value === "" || isNaN(amt)) setDonateAmt(null);
else setDonateAmt(amt); else setDonateAmt(amt);
console.log('set')
} }
function donate(): void { function donate(): void {

@ -70,12 +70,6 @@ export function FactionRoot(props: IProps): React.ReactElement {
function rerender(): void { function rerender(): void {
setRerender((old) => !old); setRerender((old) => !old);
} }
useEffect(() => {
const id = setInterval(rerender, 1000);
return () => clearInterval(id);
}, []);
const faction = props.faction; const faction = props.faction;
const player = use.Player(); const player = use.Player();

@ -2,7 +2,7 @@
* React component for general information about the faction. This includes the * React component for general information about the faction. This includes the
* factions "motto", reputation, favor, and gameplay instructions * factions "motto", reputation, favor, and gameplay instructions
*/ */
import * as React from "react"; import React, {useState, useEffect} from "react";
import { Faction } from "../../Faction/Faction"; import { Faction } from "../../Faction/Faction";
import { FactionInfo } from "../../Faction/FactionInfo"; import { FactionInfo } from "../../Faction/FactionInfo";
@ -34,6 +34,16 @@ const useStyles = makeStyles((theme: Theme) =>
); );
export function Info(props: IProps): React.ReactElement { export function Info(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
function rerender(): void {
setRerender((old) => !old);
}
useEffect(() => {
const id = setInterval(rerender, 1000);
return () => clearInterval(id);
}, []);
const classes = useStyles(); const classes = useStyles();
const favorGain = props.faction.getFavorGain()[0]; const favorGain = props.faction.getFavorGain()[0];