refactor: Improve TextOutputView component

This commit refactors the TextOutputView component to handle a specific case where the `value` prop is an object with a `text` property. It updates the component to check if the `value` is an object and if it contains the `text` property. If so, it assigns the value of `value.text` to `value`. This change improves the flexibility and usability of the component.
This commit is contained in:
ogabrielluiz 2024-06-19 01:02:46 -03:00
commit 68f5b38bd2

View file

@ -1,14 +1,17 @@
import { Textarea } from "../../../components/ui/textarea";
const TextOutputView = ({ left, value }) => {
if (typeof value === "object" && Object.keys(value).includes("text")) {
value = value.text;
}
return (
<Textarea
className={`w-full custom-scroll ${left ? "min-h-32" : "h-full"}`}
placeholder={"Empty"}
// update to real value on flowPool
value={value}
readOnly
/>
<Textarea
className={`w-full custom-scroll ${left ? "min-h-32" : "h-full"}`}
placeholder={"Empty"}
// update to real value on flowPool
value={value}
readOnly
/>
);
};