From e14c35ceb540d29d91d5af045fa86cb6318f56d3 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 3 Dec 2024 13:01:29 -0300 Subject: [PATCH] Refactor: Update toTitleCase function and CrashErrorComponent (#4940) * Refactor: Update Data class to handle different types of text inputs The Data class in the langflow schema has been updated to handle different types of text inputs. Previously, the page_content attribute was expected to be a string, but now it can also accept other types. If the input is already a string, it is used as is. Otherwise, it is converted to a string before being assigned to the page_content attribute of the Document object. This change improves the flexibility and robustness of the Data class, allowing it to handle a wider range of input types. * Refactor: Update toTitleCase function to handle ignoreTitleCase option * Refactor: Update CrashErrorComponent to add ignoreTitleCase option to the Report on GitHub button * [autofix.ci] apply automated fixes --- .../src/components/common/crashErrorComponent/index.tsx | 2 +- src/frontend/src/components/ui/button.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/common/crashErrorComponent/index.tsx b/src/frontend/src/components/common/crashErrorComponent/index.tsx index e9d00f9ab..75ee8cefe 100644 --- a/src/frontend/src/components/common/crashErrorComponent/index.tsx +++ b/src/frontend/src/components/common/crashErrorComponent/index.tsx @@ -51,7 +51,7 @@ export default function CrashErrorComponent({ target="_blank" rel="noopener noreferrer" > - diff --git a/src/frontend/src/components/ui/button.tsx b/src/frontend/src/components/ui/button.tsx index 2c9d0a14c..46886b316 100644 --- a/src/frontend/src/components/ui/button.tsx +++ b/src/frontend/src/components/ui/button.tsx @@ -53,6 +53,7 @@ export interface ButtonProps asChild?: boolean; loading?: boolean; unstyled?: boolean; + ignoreTitleCase?: boolean; } function toTitleCase(text: string) { @@ -74,6 +75,7 @@ const Button = React.forwardRef( disabled, asChild = false, children, + ignoreTitleCase = false, ...props }, ref, @@ -81,7 +83,7 @@ const Button = React.forwardRef( const Comp = asChild ? Slot : "button"; let newChildren = children; if (typeof children === "string") { - newChildren = toTitleCase(children); + newChildren = ignoreTitleCase ? children : toTitleCase(children); } return ( <>