summaryrefslogtreecommitdiff
path: root/extension/react-app/src/components/UserInputContainer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'extension/react-app/src/components/UserInputContainer.tsx')
-rw-r--r--extension/react-app/src/components/UserInputContainer.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/extension/react-app/src/components/UserInputContainer.tsx b/extension/react-app/src/components/UserInputContainer.tsx
index fe85c431..228c3530 100644
--- a/extension/react-app/src/components/UserInputContainer.tsx
+++ b/extension/react-app/src/components/UserInputContainer.tsx
@@ -69,6 +69,13 @@ const TextArea = styled.textarea`
}
`;
+function stringWithEllipsis(str: string, maxLen: number) {
+ if (str.length > maxLen) {
+ return str.substring(0, maxLen - 3) + "...\n(Click to expand)";
+ }
+ return str;
+}
+
const UserInputContainer = (props: UserInputContainerProps) => {
const [isHovered, setIsHovered] = useState(false);
const [isEditing, setIsEditing] = useState(false);
@@ -144,7 +151,7 @@ const UserInputContainer = (props: UserInputContainerProps) => {
}}
className="mr-6 cursor-text w-full"
>
- {props.children}
+ {stringWithEllipsis(props.children, 600)}
</StyledPre>
)}
{/* <ReactMarkdown children={props.children} className="w-fit mr-10" /> */}