import { Typography } from "@material-ui/core";
import clsx from "clsx";
import React from "react";

import { useUserContext } from "../../Contexts/UserContext";
import { VehicleProvider } from "../../Contexts/VehicleContext";
import useStyles from "../../useStyles";
import CANSignals from "../CANSignals";

const Main = (props) => {
  const {
    token: {
      idToken: { jwtToken: token },
    },
  } = useUserContext();
  const classes = useStyles();
  const { vin } = props;

  return (
    <div className={clsx(classes.paper, classes.tableSize)}>
      <Typography variant="h6" style={{ paddingBottom: "10px" }}>
        CAN Signals
      </Typography>
      <CANSignals vin={vin} token={token} />
    </div>
  );
};

const CANSignalsTab = (props) => (
  <VehicleProvider>
    <Main {...props} />
  </VehicleProvider>
);

export default CANSignalsTab;
