added bin history, fixed some column stuff in the DiffHistory

This commit is contained in:
csawatzky 2025-03-17 11:19:00 -06:00
parent 41131dee26
commit c397b86524
3 changed files with 24 additions and 19 deletions

View file

@ -1,14 +1,14 @@
import { Box, Card, Typography } from "@material-ui/core";
import { createStyles, makeStyles, Theme } from "@material-ui/core/styles";
import { MatchParams } from "navigation/Routes";
import { Box, Card, Typography, Theme } from "@mui/material";
import { createStyles, makeStyles } from "@mui/styles";
//import { MatchParams } from "navigation/Routes";
import DiffHistory, { ListResult, Record } from "common/DiffHistory";
import { useSnackbar, useMobile } from "hooks";
import { useBinAPI } from "providers";
import { Bin } from "models";
import { TranslateKey, TranslateValue } from "pbHelpers/Bin";
import { pond } from "protobuf-ts/pond";
import React, { useEffect, useState } from "react";
import { useParams } from "react-router";
import { useEffect, useState } from "react";
//import { useParams } from "react-router";
import { or } from "utils/types";
const useStyles = makeStyles((theme: Theme) =>
@ -29,16 +29,17 @@ const useStyles = makeStyles((theme: Theme) =>
);
interface Props {
binID?: string;
binID: string;
drawer?: boolean;
}
export default function BinHistory(props: Props) {
const params = useParams<MatchParams>();
//const params = useParams<MatchParams>();
const {binID, drawer} = props
const classes = useStyles();
const { openSnack } = useSnackbar();
const binAPI = useBinAPI();
const binID = props.binID ?? params.binID;
//const binID = props.binID ?? params.binID;
const [bin, setBin] = useState(Bin.any({ settings: { binId: binID } }));
const binName = bin.name();
const isMobile = useMobile();
@ -92,7 +93,7 @@ export default function BinHistory(props: Props) {
};
return (
<Card className={isMobile || props.drawer ? classes.gutterMobile : classes.gutter}>
<Card className={isMobile || drawer ? classes.gutterMobile : classes.gutter}>
<Typography variant="subtitle2" color="textPrimary" className={classes.title}>
{binName} History
</Typography>
@ -103,10 +104,10 @@ export default function BinHistory(props: Props) {
list={list}
translateKey={translateKey}
translateValue={translateValue}
cellStyle={{ margin: "0px", padding: "0.5rem" }}
cellStyle={{ margin: "0px", padding: 1 }}
showTitle={false}
headerStyle={{ margin: "0px" }}
drawer={props.drawer}
drawer={drawer}
/>
</Box>
</Card>