Skip to content

Commit 0a60ccf

Browse files
authored
Merge pull request #115 from codeforpdx/update-page-layouts-and-margins
Enhancement: Improve layout for mobile
2 parents 4a086c4 + 6e4ea5b commit 0a60ccf

File tree

5 files changed

+67
-66
lines changed

5 files changed

+67
-66
lines changed

frontend/src/About.tsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { useNavigate } from "react-router-dom";
2+
3+
export default function About() {
4+
const navigate = useNavigate();
5+
6+
return (
7+
<div className="flex items-center h-dvh pt-16 sm:pt-0">
8+
<div className="relative max-w-2xl m-auto p-8 bg-[#F4F4F2] rounded-lg shadow-md">
9+
<button
10+
className="absolute top-4 left-4 flex text-[#4a90e2] hover:text-[#3a7bc8] font-semibold cursor-pointer"
11+
onClick={() => navigate(-1)}
12+
aria-label="Go back"
13+
>
14+
<svg
15+
className="w-6 h-6 mr-2"
16+
fill="none"
17+
stroke="currentColor"
18+
strokeWidth={2}
19+
viewBox="0 0 24 24"
20+
>
21+
<path
22+
strokeLinecap="round"
23+
strokeLinejoin="round"
24+
d="M15 19l-7-7 7-7"
25+
/>
26+
</svg>
27+
Back
28+
</button>
29+
<p className="my-6">
30+
<strong>Tenant First Aid</strong> is an AI-powered chatbot designed to
31+
help tenants navigate rental issues, answer questions, and provides
32+
legal advice related to housing and eviction.
33+
</p>
34+
<h2 className="text-2xl font-semibold mt-6 mb-2">Features</h2>
35+
<ul className="list-disc list-inside mb-6">
36+
<li>Instant answers to common rental questions</li>
37+
<li>Guidance on tenant rights and landlord obligations</li>
38+
<li>Easy-to-use chat interface</li>
39+
<li>Available 24/7</li>
40+
</ul>
41+
<h2 className="text-2xl font-semibold mt-6 mb-2">How It Works</h2>
42+
<p className="mb-6">
43+
Simply type your question or describe your situation, and Tenant First
44+
Aid will provide helpful information or direct you to relevant
45+
resources.
46+
</p>
47+
<h2 className="text-2xl font-semibold mt-6 mb-2">Disclaimer</h2>
48+
<p className="">
49+
<strong>Tenant First Aid</strong> is an AI assistant and does not
50+
provide legal advice. For complex or urgent legal matters, please
51+
consult a qualified professional.
52+
</p>
53+
</div>
54+
</div>
55+
);
56+
}

frontend/src/AboutPage.tsx

Lines changed: 0 additions & 54 deletions
This file was deleted.

frontend/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
2-
import Chat from "./Chat.tsx";
3-
import AboutPage from "./AboutPage.tsx";
4-
import SessionContextProvider from "./contexts/SessionContext.tsx";
5-
import Navbar from "./pages/Chat/components/Navbar.tsx";
2+
import Chat from "./Chat";
3+
import About from "./About";
4+
import SessionContextProvider from "./contexts/SessionContext";
5+
import Navbar from "./pages/Chat/components/Navbar";
66

77
export default function App() {
88
return (
@@ -11,7 +11,7 @@ export default function App() {
1111
<Navbar />
1212
<Routes>
1313
<Route path="/" element={<Chat />} />
14-
<Route path="/about" element={<AboutPage />} />
14+
<Route path="/about" element={<About />} />
1515
</Routes>
1616
</Router>
1717
</SessionContextProvider>

frontend/src/Chat.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default function Chat() {
1616
setSelectedStatute(statute);
1717
setDrawerOpen(true);
1818
}
19-
2019
};
2120

2221
const closeDrawer = () => {
@@ -32,7 +31,7 @@ export default function Chat() {
3231
className={`container relative flex flex-col mx-auto p-6 bg-[#F4F4F2] rounded-lg shadow-[0_4px_6px_rgba(0,0,0,0.1)]
3332
${
3433
isOngoing
35-
? "justify-between h-[calc(100dvh-10rem)]"
34+
? "justify-between h-[calc(100dvh-4rem)] max-h-[calc(100dvh-4rem)] sm:h-[calc(100dvh-10rem)]"
3635
: "justify-center max-w-[600px]"
3736
}`}
3837
>

frontend/src/pages/Chat/components/MessageWindow.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ export default function MessageWindow({
3131
};
3232

3333
useEffect(() => {
34-
inputRef.current?.focus();
3534
const messagesElement = messagesRef.current;
3635
if (messagesElement) {
3736
messagesElement.scrollTo({
3837
top: messagesElement.scrollHeight,
3938
behavior: "smooth",
4039
});
40+
setTimeout(() => {
41+
inputRef.current?.focus();
42+
}, 500);
4143
}
4244
}, [messages]);
4345

@@ -50,7 +52,7 @@ export default function MessageWindow({
5052
</div>
5153
) : (
5254
<div
53-
className={`max-h-[calc(100vh-20rem)] mx-auto max-w-[700px] ${
55+
className={`max-h-[calc(100dvh-240px)] sm:max-h-[calc(100dvh-20rem)] mx-auto max-w-[700px] ${
5456
isOngoing ? "overflow-y-scroll" : "overflow-y-none"
5557
}`}
5658
ref={messagesRef}
@@ -106,9 +108,7 @@ export default function MessageWindow({
106108
>
107109
Clear Chat
108110
</button>
109-
<div className="">
110-
<ExportMessagesButton messages={messages} />
111-
</div>
111+
<ExportMessagesButton messages={messages} />
112112
</div>
113113
) : null}
114114
</div>

0 commit comments

Comments
 (0)