active scritp production typo and add new page size

This commit is contained in:
Olivier Gagnon 2021-09-21 11:50:48 -04:00
parent db35fde42e
commit ffa9600302
3 changed files with 7 additions and 25 deletions

@ -4,6 +4,7 @@
*/
import * as React from "react";
import { Money } from "../React/Money";
import { MoneyRate } from "../React/MoneyRate";
import { use } from "../Context";
@ -40,18 +41,13 @@ export function ScriptProduction(): React.ReactElement {
<TableBody>
<TableRow>
<TableCell component="th" scope="row" classes={{ root: classes.cell }}>
<Typography variant="body2">Total online production of Active scripts:</Typography>
<Typography variant="body2">Total production:</Typography>
</TableCell>
<TableCell align="left" classes={{ root: classes.cell }}>
<Typography variant="body2">
<MoneyRate money={player.scriptProdSinceLastAug} />
<Money money={player.scriptProdSinceLastAug} />
</Typography>
</TableCell>
</TableRow>
<TableRow style={{ width: "1px" }}>
<TableCell component="th" scope="row" classes={{ root: classes.cell }}>
<Typography variant="body2">Total online production since last Aug installation:</Typography>
</TableCell>
<TableCell align="left" classes={{ root: classes.cell }}>
<Typography variant="body2">
(<MoneyRate money={prodRateSinceLastAug} />)

@ -21,26 +21,19 @@ export function ServerAccordionContent(props: IProps): React.ReactElement {
setPage(0);
};
let safePage = page;
while (safePage * rowsPerPage + 1 > props.workerScripts.length) {
safePage--;
}
if (safePage != page) setPage(safePage);
return (
<>
<List dense disablePadding>
{props.workerScripts.slice(safePage * rowsPerPage, safePage * rowsPerPage + rowsPerPage).map((ws) => (
{props.workerScripts.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage).map((ws) => (
<WorkerScriptAccordion key={`${ws.name}_${ws.args}`} workerScript={ws} />
))}
</List>
<TablePagination
rowsPerPageOptions={[10, 15, 20]}
rowsPerPageOptions={[10, 15, 20, 100]}
component="div"
count={props.workerScripts.length}
rowsPerPage={rowsPerPage}
page={safePage}
page={page}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
ActionsComponent={TablePaginationActionsAll}

@ -74,13 +74,6 @@ export function ServerAccordions(props: IProps): React.ReactElement {
function rerender(): void {
setRerender((old) => !old);
let safePage = page;
while (safePage * rowsPerPage + 1 >= filtered.length) {
safePage--;
}
if (safePage != page) setPage(safePage);
}
useEffect(() => WorkerScriptStartStopEventEmitter.subscribe(rerender));
@ -108,7 +101,7 @@ export function ServerAccordions(props: IProps): React.ReactElement {
})}
</List>
<TablePagination
rowsPerPageOptions={[10, 15, 20]}
rowsPerPageOptions={[10, 15, 20, 100]}
component="div"
count={filtered.length}
rowsPerPage={rowsPerPage}