Spaces:
Running
Running
umer6016
commited on
Commit
·
96cf5ed
1
Parent(s):
5ffd058
Fix search bar focus issue by using render functions
Browse files- frontend/src/App.jsx +12 -12
frontend/src/App.jsx
CHANGED
|
@@ -332,7 +332,7 @@ export default function App() {
|
|
| 332 |
}
|
| 333 |
};
|
| 334 |
|
| 335 |
-
const
|
| 336 |
<header className="hero">
|
| 337 |
<div>
|
| 338 |
<h1>ChatSmith</h1>
|
|
@@ -349,7 +349,7 @@ export default function App() {
|
|
| 349 |
</header>
|
| 350 |
);
|
| 351 |
|
| 352 |
-
const
|
| 353 |
<Panel title="Login" subtitle="AI-powered chatbot generator for any website.">
|
| 354 |
<input
|
| 355 |
placeholder="Email"
|
|
@@ -374,7 +374,7 @@ export default function App() {
|
|
| 374 |
</Panel>
|
| 375 |
);
|
| 376 |
|
| 377 |
-
const
|
| 378 |
<Panel title="Sign Up" subtitle="Create your account and start building.">
|
| 379 |
<input
|
| 380 |
placeholder="First name"
|
|
@@ -391,7 +391,7 @@ export default function App() {
|
|
| 391 |
</Panel>
|
| 392 |
);
|
| 393 |
|
| 394 |
-
const
|
| 395 |
<Panel title="Reset Password" subtitle="Securely recover access with OTP.">
|
| 396 |
{!resetSent && (
|
| 397 |
<>
|
|
@@ -438,7 +438,7 @@ export default function App() {
|
|
| 438 |
</Panel>
|
| 439 |
);
|
| 440 |
|
| 441 |
-
const
|
| 442 |
<Panel title="Enter OTP" subtitle="Check your inbox for the 6-digit code.">
|
| 443 |
<div className="muted small">OTP sent to: {otpEmail || "your email"}</div>
|
| 444 |
<input placeholder="OTP code" ref={otpCodeRef} defaultValue="" />
|
|
@@ -449,7 +449,7 @@ export default function App() {
|
|
| 449 |
</Panel>
|
| 450 |
);
|
| 451 |
|
| 452 |
-
const
|
| 453 |
<div className="grid single-column">
|
| 454 |
<Panel title="Generate Chatbot" subtitle="Paste a URL and generate a chatbot instantly.">
|
| 455 |
<label className="label">Website URL</label>
|
|
@@ -552,7 +552,7 @@ export default function App() {
|
|
| 552 |
|
| 553 |
return (
|
| 554 |
<div className="app-shell">
|
| 555 |
-
|
| 556 |
|
| 557 |
{isSessionChecking ? (
|
| 558 |
<div className="auth-page">
|
|
@@ -572,7 +572,7 @@ export default function App() {
|
|
| 572 |
<div className="auth-page">
|
| 573 |
<div className="auth-stage">
|
| 574 |
<div className="auth-card-wrap">
|
| 575 |
-
|
| 576 |
</div>
|
| 577 |
</div>
|
| 578 |
</div>
|
|
@@ -582,7 +582,7 @@ export default function App() {
|
|
| 582 |
<div className="auth-page">
|
| 583 |
<div className="auth-stage">
|
| 584 |
<div className="auth-card-wrap">
|
| 585 |
-
|
| 586 |
</div>
|
| 587 |
</div>
|
| 588 |
</div>
|
|
@@ -592,7 +592,7 @@ export default function App() {
|
|
| 592 |
<div className="auth-page">
|
| 593 |
<div className="auth-stage">
|
| 594 |
<div className="auth-card-wrap">
|
| 595 |
-
|
| 596 |
</div>
|
| 597 |
</div>
|
| 598 |
</div>
|
|
@@ -602,7 +602,7 @@ export default function App() {
|
|
| 602 |
<div className="auth-page">
|
| 603 |
<div className="auth-stage">
|
| 604 |
<div className="auth-card-wrap">
|
| 605 |
-
|
| 606 |
</div>
|
| 607 |
</div>
|
| 608 |
</div>
|
|
@@ -611,7 +611,7 @@ export default function App() {
|
|
| 611 |
{view === "app" && (
|
| 612 |
<div className="main-page">
|
| 613 |
<div className="main-card-wrap">
|
| 614 |
-
|
| 615 |
</div>
|
| 616 |
</div>
|
| 617 |
)}
|
|
|
|
| 332 |
}
|
| 333 |
};
|
| 334 |
|
| 335 |
+
const renderHeader = () => (
|
| 336 |
<header className="hero">
|
| 337 |
<div>
|
| 338 |
<h1>ChatSmith</h1>
|
|
|
|
| 349 |
</header>
|
| 350 |
);
|
| 351 |
|
| 352 |
+
const renderLoginCard = () => (
|
| 353 |
<Panel title="Login" subtitle="AI-powered chatbot generator for any website.">
|
| 354 |
<input
|
| 355 |
placeholder="Email"
|
|
|
|
| 374 |
</Panel>
|
| 375 |
);
|
| 376 |
|
| 377 |
+
const renderSignupCard = () => (
|
| 378 |
<Panel title="Sign Up" subtitle="Create your account and start building.">
|
| 379 |
<input
|
| 380 |
placeholder="First name"
|
|
|
|
| 391 |
</Panel>
|
| 392 |
);
|
| 393 |
|
| 394 |
+
const renderResetCard = () => (
|
| 395 |
<Panel title="Reset Password" subtitle="Securely recover access with OTP.">
|
| 396 |
{!resetSent && (
|
| 397 |
<>
|
|
|
|
| 438 |
</Panel>
|
| 439 |
);
|
| 440 |
|
| 441 |
+
const renderOtpCard = () => (
|
| 442 |
<Panel title="Enter OTP" subtitle="Check your inbox for the 6-digit code.">
|
| 443 |
<div className="muted small">OTP sent to: {otpEmail || "your email"}</div>
|
| 444 |
<input placeholder="OTP code" ref={otpCodeRef} defaultValue="" />
|
|
|
|
| 449 |
</Panel>
|
| 450 |
);
|
| 451 |
|
| 452 |
+
const renderAppCards = () => (
|
| 453 |
<div className="grid single-column">
|
| 454 |
<Panel title="Generate Chatbot" subtitle="Paste a URL and generate a chatbot instantly.">
|
| 455 |
<label className="label">Website URL</label>
|
|
|
|
| 552 |
|
| 553 |
return (
|
| 554 |
<div className="app-shell">
|
| 555 |
+
{renderHeader()}
|
| 556 |
|
| 557 |
{isSessionChecking ? (
|
| 558 |
<div className="auth-page">
|
|
|
|
| 572 |
<div className="auth-page">
|
| 573 |
<div className="auth-stage">
|
| 574 |
<div className="auth-card-wrap">
|
| 575 |
+
{renderLoginCard()}
|
| 576 |
</div>
|
| 577 |
</div>
|
| 578 |
</div>
|
|
|
|
| 582 |
<div className="auth-page">
|
| 583 |
<div className="auth-stage">
|
| 584 |
<div className="auth-card-wrap">
|
| 585 |
+
{renderSignupCard()}
|
| 586 |
</div>
|
| 587 |
</div>
|
| 588 |
</div>
|
|
|
|
| 592 |
<div className="auth-page">
|
| 593 |
<div className="auth-stage">
|
| 594 |
<div className="auth-card-wrap">
|
| 595 |
+
{renderResetCard()}
|
| 596 |
</div>
|
| 597 |
</div>
|
| 598 |
</div>
|
|
|
|
| 602 |
<div className="auth-page">
|
| 603 |
<div className="auth-stage">
|
| 604 |
<div className="auth-card-wrap">
|
| 605 |
+
{renderOtpCard()}
|
| 606 |
</div>
|
| 607 |
</div>
|
| 608 |
</div>
|
|
|
|
| 611 |
{view === "app" && (
|
| 612 |
<div className="main-page">
|
| 613 |
<div className="main-card-wrap">
|
| 614 |
+
{renderAppCards()}
|
| 615 |
</div>
|
| 616 |
</div>
|
| 617 |
)}
|