Skip to content

Commit

Permalink
handled edge cases and fixed responsiveness
Browse files Browse the repository at this point in the history
Signed-off-by: Swapnoneel Saha <[email protected]>
  • Loading branch information
Swpn0neel committed Oct 10, 2024
1 parent 710f20a commit 397e385
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/ChatBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ function textFormat(text) {
} else if (text.substring(i, i + 1) == "#") {
heading = 1;
output += `\n\n`;
} else if (text.substring(i, i + 1) == "]") {
output += ": ";
} else if (text.substring(i, i + 1) == "[") {
output += "";
} else if (
text.substring(i, i + 1) == "(" ||
text.substring(i, i + 1) == ")"
) {
output += `"`;
} else if (text.substring(i, i + 1) == "<") {
i++;
while (
Expand Down Expand Up @@ -137,7 +146,7 @@ export default function ChatBot() {
}, []);

return (
<div className="fixed bottom-16 right-16 z-50">
<div className="fixed bottom-14 right-4 z-50 sm:right-8 md:right-16">
{!isOpen && (
<button
onClick={toggleChat}
Expand Down Expand Up @@ -185,7 +194,7 @@ export default function ChatBot() {
<div ref={messagesEndRef} />
</div>

<div className="border-t bg-white p-4">
<div className="flex border-t bg-white p-4">
<div className="flex items-center space-x-4">
<input
type="text"
Expand All @@ -201,7 +210,7 @@ export default function ChatBot() {
onClick={sendMessage}
disabled={isLoading || !input.trim()}
>
{isLoading ? "Sending..." : "Send"}
{isLoading ? "Sent" : "Send"}
</button>
</div>
</div>
Expand Down

0 comments on commit 397e385

Please sign in to comment.