Skip to content

Commit 9b7371c

Browse files
committed
Refactor: Mobile UI optimizations, scrollbar fix, and glossary improvements
- Fixed mobile scrollbar gap by adjusting global overflow and layout padding - Optimized article typography for mobile readability - Removed redundant 'Back' navigation links from article details - Fixed glossary React key errors and removed chapter labels - Added clear button to glossary search - Fixed 'Ask a Question' toggle issue on mobile
1 parent a10d349 commit 9b7371c

11 files changed

Lines changed: 47 additions & 42 deletions

File tree

web/src/app/ask/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export default function AskPage() {
1818
const [isSubmitting, setIsSubmitting] = useState(false);
1919

2020
useEffect(() => {
21-
// Auto-collapse new question form on mobile if there are active tickets
21+
// Auto-collapse new question form on mobile if there are active tickets (only on initial load)
2222
const hasActiveTickets = tickets.some(t => t.status === 'Open' || t.status === 'Answered');
23-
if (window.innerWidth < 768 && hasActiveTickets && isNewQuestionExpanded) {
24-
// eslint-disable-next-line react-hooks/set-state-in-effect
23+
if (window.innerWidth < 768 && hasActiveTickets) {
2524
setIsNewQuestionExpanded(false);
2625
}
27-
}, [tickets, isNewQuestionExpanded]);
26+
// eslint-disable-next-line react-hooks/exhaustive-deps
27+
}, []); // Only run on mount
2828

2929
const toggleExpand = (id: string) => {
3030
setExpandedTicketId(expandedTicketId === id ? null : id);
@@ -86,7 +86,7 @@ export default function AskPage() {
8686
);
8787

8888
return (
89-
<div className="max-w-4xl mx-auto space-y-6 pt-6">
89+
<div className="max-w-4xl mx-auto space-y-6 pt-6 px-4">
9090
{/* Header */}
9191
<div className="flex items-center space-x-4 pb-2 border-b border-gray-100">
9292
<div className="w-12 h-12 bg-blue-50 rounded-full flex items-center justify-center text-blue-600 flex-none">

web/src/app/bodhakatha/[articleId]/page.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export async function generateStaticParams() {
99
}));
1010
}
1111

12-
import Link from 'next/link';
13-
import { ArrowLeft } from 'lucide-react';
12+
1413

1514
export default async function BodhakathaDetailPage({ params }: { params: Promise<{ articleId: string }> }) {
1615
const { articleId } = await params;
@@ -36,21 +35,16 @@ export default async function BodhakathaDetailPage({ params }: { params: Promise
3635
<div className="flex flex-col lg:flex-row gap-8 h-[calc(100vh-8rem)] pt-6">
3736
{/* Left: Text Content (Prominent) - First on mobile and desktop */}
3837
<div className="w-full lg:w-2/3 flex-1 overflow-y-auto pr-4 custom-scrollbar">
39-
<div className="mb-4">
40-
<Link href="/bodhakatha" className="inline-flex items-center transition-colors px-4 py-2 bg-white border border-gray-200 rounded-full text-gray-700 font-medium shadow-sm hover:bg-gray-50 lg:bg-transparent lg:border-0 lg:shadow-none lg:p-0 lg:text-gray-500 lg:hover:text-ochre lg:hover:bg-transparent text-sm">
41-
<ArrowLeft className="w-4 h-4 mr-2 lg:mr-1" />
42-
Back to Bodhakathas
43-
</Link>
44-
</div>
38+
4539
<article className="prose prose-ochre max-w-none bg-white p-8 rounded-xl shadow-sm border border-gray-100">
4640
<div className="mb-6 border-b border-gray-100 pb-4">
4741
<div className="flex items-center space-x-2 mb-2">
4842
<span className="text-xs font-bold text-white bg-ochre px-2 py-1 rounded">
4943
{article.theme}
5044
</span>
5145
</div>
52-
<h1 className="text-3xl font-bold text-gray-800 mb-2">{article.title_english}</h1>
53-
<h2 className="text-2xl text-ochre font-serif">{article.title_hindi}</h2>
46+
<h1 className="text-xl md:text-3xl font-bold text-gray-800 mb-2">{article.title_english}</h1>
47+
<h2 className="text-lg md:text-2xl text-ochre font-serif">{article.title_hindi}</h2>
5448
</div>
5549

5650
<h3 className="text-lg font-bold text-gray-500 mb-4">Core Teaching</h3>

web/src/app/bodhakatha/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Lightbulb } from 'lucide-react';
44

55
export default function BodhakathaPage() {
66
return (
7-
<div className="max-w-4xl mx-auto space-y-6 pt-6">
7+
<div className="max-w-4xl mx-auto space-y-6 pt-6 px-4">
88
<div className="flex items-center space-x-4 pb-2 border-b border-gray-100">
99
<div className="w-12 h-12 bg-ochre/10 rounded-full flex items-center justify-center text-ochre flex-none">
1010
<Lightbulb className="w-6 h-6" />
@@ -26,10 +26,10 @@ export default function BodhakathaPage() {
2626
<span className="text-xs font-bold text-white bg-ochre px-3 py-1 rounded-full self-start">
2727
{article.theme}
2828
</span>
29-
<h2 className="text-xl font-bold text-gray-800 group-hover:text-ochre transition-colors mt-2">
29+
<h2 className="text-lg md:text-xl font-bold text-gray-800 group-hover:text-ochre transition-colors mt-2">
3030
{article.title_english}
3131
</h2>
32-
<h3 className="text-lg text-gray-400 font-serif">
32+
<h3 className="text-base md:text-lg text-gray-400 font-serif">
3333
{article.title_hindi}
3434
</h3>
3535

web/src/app/globals.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,18 @@
1919
--font-mono: var(--font-geist-mono);
2020
}
2121

22+
html {
23+
overflow-y: scroll;
24+
overflow-x: hidden;
25+
}
26+
2227
body {
2328
background: var(--background);
2429
color: var(--foreground);
2530
font-family: var(--font-sans), Arial, Helvetica, sans-serif;
31+
margin: 0;
32+
padding: 0;
33+
overflow-x: hidden;
2634
}
2735

2836
@layer utilities {

web/src/app/glossary/page.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function GlossaryPage() {
3838
}, [searchQuery, sortOrder, language]);
3939

4040
return (
41-
<div className="max-w-4xl mx-auto space-y-8 pt-6">
41+
<div className="max-w-4xl mx-auto space-y-8 pt-6 px-4">
4242
<div className="flex flex-col md:flex-row justify-between items-center gap-4">
4343
<h1 className="text-3xl font-bold text-ochre">Glossary</h1>
4444

@@ -60,16 +60,14 @@ export default function GlossaryPage() {
6060

6161
<div className="grid gap-4">
6262
{filteredData.length > 0 ? (
63-
filteredData.map((item) => (
63+
filteredData.map((item, index) => (
6464
<div
65-
key={item.term}
65+
key={`${item.term}-${item.chapter}-${index}`}
6666
className="bg-white p-6 rounded-lg shadow-sm border border-gray-100 hover:border-gold transition-colors"
6767
>
6868
<div className="flex justify-between items-start">
6969
<h2 className="text-xl font-bold text-ochre mb-2">{item.term}</h2>
70-
<span className="text-xs text-gray-400 bg-gray-50 px-2 py-1 rounded">
71-
{item.chapter}
72-
</span>
70+
7371
</div>
7472
<p className="text-gray-700 font-serif text-lg leading-relaxed">
7573
{getDefinition(item)}

web/src/app/icon.png

554 KB
Loading

web/src/app/leela/[articleId]/page.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export async function generateStaticParams() {
99
}));
1010
}
1111

12-
import Link from 'next/link';
13-
import { ArrowLeft } from 'lucide-react';
12+
1413

1514
export default async function LeelaDetailPage({ params }: { params: Promise<{ articleId: string }> }) {
1615
const { articleId } = await params;
@@ -36,16 +35,11 @@ export default async function LeelaDetailPage({ params }: { params: Promise<{ ar
3635
<div className="flex flex-col lg:flex-row gap-8 h-[calc(100vh-8rem)] pt-6">
3736
{/* Left: Text Content (Prominent) - First on mobile and desktop */}
3837
<div className="w-full lg:w-2/3 flex-1 overflow-y-auto pr-4 custom-scrollbar">
39-
<div className="mb-4">
40-
<Link href="/leela" className="inline-flex items-center transition-colors px-4 py-2 bg-white border border-gray-200 rounded-full text-gray-700 font-medium shadow-sm hover:bg-gray-50 lg:bg-transparent lg:border-0 lg:shadow-none lg:p-0 lg:text-gray-500 lg:hover:text-ochre lg:hover:bg-transparent text-sm">
41-
<ArrowLeft className="w-4 h-4 mr-2 lg:mr-1" />
42-
Back to Leelas
43-
</Link>
44-
</div>
38+
4539
<article className="prose prose-ochre max-w-none bg-white p-8 rounded-xl shadow-sm border border-gray-100">
4640
<div className="mb-6 border-b border-gray-100 pb-4">
47-
<h1 className="text-3xl font-bold text-gray-800 mb-2">{article.title_english}</h1>
48-
<h2 className="text-2xl text-ochre font-serif">{article.title_hindi}</h2>
41+
<h1 className="text-xl md:text-3xl font-bold text-gray-800 mb-2">{article.title_english}</h1>
42+
<h2 className="text-lg md:text-2xl text-ochre font-serif">{article.title_hindi}</h2>
4943
</div>
5044

5145
<h3 className="text-lg font-bold text-gray-500 mb-4">{article.chapter} Narrative</h3>

web/src/app/leela/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Footprints } from 'lucide-react';
44

55
export default function LeelaPage() {
66
return (
7-
<div className="max-w-4xl mx-auto space-y-6 pt-6">
7+
<div className="max-w-4xl mx-auto space-y-6 pt-6 px-4">
88
<div className="flex items-center space-x-4 pb-2 border-b border-gray-100">
99
<div className="w-12 h-12 bg-ochre/10 rounded-full flex items-center justify-center text-ochre flex-none">
1010
<Footprints className="w-6 h-6" />
@@ -27,10 +27,10 @@ export default function LeelaPage() {
2727
<span className="text-xs font-bold text-gray-400 uppercase tracking-widest bg-gray-50 px-2 py-1 rounded inline-block">
2828
{article.chapter}
2929
</span>
30-
<h2 className="text-xl font-bold text-gray-800 group-hover:text-ochre transition-colors">
30+
<h2 className="text-lg md:text-xl font-bold text-gray-800 group-hover:text-ochre transition-colors">
3131
{article.title_english}
3232
</h2>
33-
<h3 className="text-lg text-gray-400 font-serif">
33+
<h3 className="text-base md:text-lg text-gray-400 font-serif">
3434
{article.title_hindi}
3535
</h3>
3636
<p className="text-gray-600 text-sm line-clamp-2">

web/src/app/live/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function LivePage() {
2929
}, [isPlaying, closePlayer, router]);
3030

3131
return (
32-
<div className="max-w-6xl mx-auto space-y-6 pt-6">
32+
<div className="max-w-6xl mx-auto space-y-6 pt-6 px-4">
3333

3434
{/* Header */}
3535
<div className="flex items-center space-x-4 pb-2 border-b border-gray-100">

web/src/components/features/SearchBar.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { Search } from 'lucide-react';
3+
import { Search, X } from 'lucide-react';
44

55
interface SearchBarProps {
66
value: string;
@@ -16,9 +16,18 @@ export default function SearchBar({ value, onChange, placeholder = 'Search...' }
1616
value={value}
1717
onChange={(e) => onChange(e.target.value)}
1818
placeholder={placeholder}
19-
className="w-full pl-10 pr-4 py-2 border border-gray-200 rounded-full focus:outline-none focus:ring-2 focus:ring-ochre focus:border-transparent transition-all"
19+
className="w-full pl-10 pr-10 py-2 border border-gray-200 rounded-full focus:outline-none focus:ring-2 focus:ring-ochre focus:border-transparent transition-all"
2020
/>
2121
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" />
22+
{value && (
23+
<button
24+
onClick={() => onChange('')}
25+
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors"
26+
aria-label="Clear search"
27+
>
28+
<X className="w-4 h-4" />
29+
</button>
30+
)}
2231
</div>
2332
);
2433
}

0 commit comments

Comments
 (0)