Skip to content

Commit 49ce536

Browse files
committed
fix: pageindex status display and mobile sidebar overlay
1 parent a7572b9 commit 49ce536

File tree

4 files changed

+29
-12
lines changed

4 files changed

+29
-12
lines changed

src/components/DashboardViews/DocumentsView.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ const TreeNodeNode = ({ node, depth = 0 }: { node: PageIndexNode; depth?: number
112112
<span className="text-[10px] font-mono text-[#FFB286] bg-[#FF8A5B]/10 px-1.5 py-0.5 rounded">
113113
{pageLabel}
114114
</span>
115-
) : node.node_id ? (
116-
<span className="text-[10px] font-mono text-white/40 bg-white/5 px-1.5 py-0.5 rounded">
117-
ID
118-
</span>
119115
) : null}
116+
{node.node_id && (
117+
<span className="text-[10px] font-mono text-white/40 bg-white/5 px-1.5 py-0.5 rounded truncate max-w-[120px]">
118+
{node.node_id}
119+
</span>
120+
)}
120121
<h4 className="text-sm font-medium text-white/90 truncate group-hover:text-white">
121122
{titleText}
122123
</h4>
@@ -126,6 +127,11 @@ const TreeNodeNode = ({ node, depth = 0 }: { node: PageIndexNode; depth?: number
126127
{summaryText}
127128
</p>
128129
)}
130+
{!summaryText && isExpanded && (
131+
<p className="text-xs text-white/30 mt-1 italic leading-relaxed">
132+
No summary available
133+
</p>
134+
)}
129135
</div>
130136
</div>
131137

src/components/Layout/Sidebar/MobileSidebar.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import { createPortal } from 'react-dom';
23
import { motion, AnimatePresence } from 'framer-motion';
34
import { X } from 'lucide-react';
45
import { useTheme } from '../../../hooks/useTheme';
@@ -28,7 +29,7 @@ export default function MobileSidebar({
2829
const { isDark } = useTheme();
2930
const navigate = useNavigate();
3031

31-
return (
32+
const content = (
3233
<AnimatePresence>
3334
{isOpen && (
3435
<>
@@ -54,7 +55,8 @@ export default function MobileSidebar({
5455
}}
5556
className={cn(
5657
"fixed inset-x-0 bottom-0 z-50",
57-
"h-auto max-h-[85vh] overflow-y-auto", // Increased height and added scroll
58+
"h-auto max-h-[85vh] max-h-[85dvh] overflow-y-auto overscroll-contain",
59+
"pb-[max(1rem,env(safe-area-inset-bottom))]",
5860
"rounded-t-[1.25rem] shadow-2xl",
5961
isDark
6062
? [
@@ -129,4 +131,7 @@ export default function MobileSidebar({
129131
)}
130132
</AnimatePresence>
131133
);
132-
}
134+
135+
if (typeof document === 'undefined') return content;
136+
return createPortal(content, document.body);
137+
}

src/components/PageIndex/PageIndexView.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ const TreeNode = ({ node, depth = 0 }: { node: PageIndexNode; depth?: number })
5858
<span className="text-[10px] font-mono text-[#FFB286] bg-[#FF8A5B]/10 px-1.5 py-0.5 rounded">
5959
{pageLabel}
6060
</span>
61-
) : node.node_id ? (
62-
<span className="text-[10px] font-mono text-white/40 bg-white/5 px-1.5 py-0.5 rounded">
63-
ID
64-
</span>
6561
) : null}
62+
{node.node_id && (
63+
<span className="text-[10px] font-mono text-white/40 bg-white/5 px-1.5 py-0.5 rounded truncate max-w-[120px]">
64+
{node.node_id}
65+
</span>
66+
)}
6667
<h4 className="text-sm font-medium text-white/90 truncate group-hover:text-white">
6768
{titleText}
6869
</h4>
@@ -72,6 +73,11 @@ const TreeNode = ({ node, depth = 0 }: { node: PageIndexNode; depth?: number })
7273
{summaryText}
7374
</p>
7475
)}
76+
{!summaryText && isExpanded && (
77+
<p className="text-xs text-white/30 mt-1 italic leading-relaxed">
78+
No summary available
79+
</p>
80+
)}
7581
</div>
7682
</div>
7783

src/services/pageIndexService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class PageIndexService {
9797
const treeResponse = await this.fetchTreeStatus(docId);
9898
const status = treeResponse.status;
9999

100-
if (status === 'completed' && treeResponse.result) {
100+
if (treeResponse.result && treeResponse.result.length > 0) {
101101
return treeResponse.result || [];
102102
} else if (status === 'failed') {
103103
throw new Error('PageIndex processing failed');

0 commit comments

Comments
 (0)