All files / src/pages/flowsheet-page/flowsheet/LeftSideBar/Scenarios MssDataPanel.tsx

100% Statements 3/3
80% Branches 4/5
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64                37x                         66x                                                   58x                                
import { CSVUploaderButton } from "@/pages/flowsheet-page/multi-steady-state/CSVUploader";
import ExpressionViewer from "@/pages/flowsheet-page/multi-steady-state/ExpressionViewer";
import { FileText } from "lucide-react";
import { ExpressionRead, ScenarioRead } from "../../../../../api/apiStore.gen";
import { DownloadTagMappingsButton } from "../../../multi-steady-state/DownloadTagMappings";
import { PreviewData } from "./PreviewData";
 
// Example component function
const MssDataPanel = ({
  handleFileUpload,
  hasFile,
  clearFile,
  scenario,
  expressions = [],
}: {
  scenario: ScenarioRead,
  handleFileUpload: (file: File) => void,
  hasFile: boolean,
  clearFile: () => void,
  expressions: ExpressionRead[],
}) => (
  <div className=" p-2 my-2 rounded-lg bg-muted" aria-label="scn-multiple-container">
 
 
    <div className="flex flex-row items-center border border-input rounded-md p-1 w-full gap-0">
 
      <CSVUploaderButton
        onUpload={handleFileUpload}
        buttonText="Choose File"
        icon={<FileText className="w-4 h-4" />}
      />
 
      <PreviewData
        hasFile={hasFile}
        onRemove={clearFile}
        fileName={scenario.Uploaded_fileName ? "View Data" : "No file chosen"}
        optimization={scenario}
      />
      <div className="flex-grow flex justify-end" >
          <DownloadTagMappingsButton />
      </div>
    </div>
 
 
    {hasFile && (
      <div className="border mt-2">
        {expressions.map((expression) => (
          <div
            key={expression.id}
            className="rounded-lg bg-muted shadow-sm p-2 my-1"
          >
            <ExpressionViewer expression={expression} />
          </div>
        ))}
      </div>
    )}
 
  </div>
 
 
);
 
export default MssDataPanel;