import React, { useEffect, useState } from "react"; import { AIIcon } from "../../../icons/ExportCommonIcons"; import RegularDropDown from "../../../ui/inputs/RegularDropDown"; import { AnalysisPresetsType } from "../../../../types/analysis"; import RenderAnalysisInputs from "./RenderAnalysisInputs"; import { useInputValues } from "../../../../store/builder/store"; const Analysis: React.FC = () => { const [selectedOption, setSelectedOption] = useState("Throughput time"); const handleSelect = (option: string) => { setSelectedOption(option); // Normalize for key matching }; const AnalysisPresets: AnalysisPresetsType = { "Throughput time": [ // { type: "default", inputs: { label: "Cycle time", activeOption: "s" } }, // { type: "default", inputs: { label: "machines / lines", activeOption: "item" } }, // { type: "default", inputs: { label: "Machine uptime", activeOption: "%" } }, ], "Production capacity": [ { type: "range", inputs: { label: "Shift length", activeOption: "hr", defaultValue: 6 } }, { type: "default", inputs: { label: "Shifts / day", activeOption: "unit", defaultValue: 2 } }, { type: "default", inputs: { label: "Working days / year", activeOption: "days", defaultValue: 300 } }, { type: "default", inputs: { label: "Yield rate", activeOption: "%", defaultValue: 92 } }, ], ROI: [ { type: "default", inputs: { label: "Selling price", activeOption: "INR", defaultValue: 800 }, }, { type: "default", inputs: { label: "Material cost", activeOption: "INR", defaultValue: 300 }, }, { type: "default", inputs: { label: "Labor Cost", activeOption: "INR", defaultValue: 150 }, }, { type: "default", inputs: { label: "Maintenance cost", activeOption: "INR", defaultValue: 1200 }, }, { type: "default", inputs: { label: "Electricity cost", activeOption: "INR", defaultValue: 840 }, }, { type: "default", inputs: { label: "Fixed costs", activeOption: "INR", defaultValue: 1250 }, }, { type: "default", inputs: { label: "Initial Investment", activeOption: "INR", defaultValue: 1500000 }, }, { type: "default", inputs: { label: "Salvage value", activeOption: "Day", defaultValue: 565 }, }, { type: "default", inputs: { label: "Production period", activeOption: "yrs", defaultValue: 5 }, }, { type: "default", inputs: { label: "Tax rate", activeOption: "%", defaultValue: 30 }, }, ], }; useEffect(() => { Object.values(AnalysisPresets).forEach((category) => { category.forEach((item) => { const { label, defaultValue } = item.inputs; if (defaultValue !== undefined) { updateInputValue(label, defaultValue.toString()); } }); }); }, []); const { inputValues, setInputValues, updateInputValue } = useInputValues(); return (
Object
Generate Report
Create Analysis
{/* Render only the selected option */} { updateInputValue(label, value); }} />
setInputValues({})} /> setInputValues(inputValues)} />
Create Custom Analysis
Click 'Create' to enhances decision-making by providing actionable insights, optimizing operations that adapts to the unique challenges.
); }; export default Analysis;