Skip to content

Commit 42daaed

Browse files
committed
make file view not scroll
1 parent 38f3df7 commit 42daaed

2 files changed

Lines changed: 40 additions & 35 deletions

File tree

public/output.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,9 @@
14271427
.top-0 {
14281428
top: calc(var(--spacing) * 0);
14291429
}
1430+
.top-6 {
1431+
top: calc(var(--spacing) * 6);
1432+
}
14301433
.top-20 {
14311434
top: calc(var(--spacing) * 20);
14321435
}

src/pages/file_viewer.rs

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -513,46 +513,48 @@ pub fn FileViewer() -> impl IntoView {
513513
/>
514514
<div class="flex gap-6 items-start">
515515
// Left Panel: File Tree
516-
<div class="w-64 flex-shrink-0 bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700 self-start">
516+
<div class="w-64 flex-shrink-0 bg-white dark:bg-gray-800 rounded-lg shadow p-4 border border-gray-200 dark:border-gray-700 self-start sticky top-6 max-h-[calc(100vh-6rem)] flex flex-col">
517517
<h2 class="text-xl font-semibold mb-4 text-gray-800 dark:text-gray-200">
518518
"Files"
519519
</h2>
520520
<FileQuickNavigator repo=repo.into() branch=branch.into() />
521-
<Suspense fallback=move || {
522-
view! { <p>"Loading tree..."</p> }
523-
}>
524-
<ul class="font-mono text-sm">
525-
{move || {
526-
tree_resource
527-
.get()
528-
.map(|result| match result {
529-
Ok(FileViewerData::Directory { entries, .. }) => {
530-
Either::Left(
531-
view! {
532-
<For
533-
each=move || entries.clone()
534-
key=|e| e.path.clone()
535-
children=move |entry| {
536-
view! {
537-
<FileTreeNode
538-
entry=entry
539-
repo=repo.into()
540-
branch=branch.into()
541-
expanded=expanded_dirs
542-
/>
521+
<div class="flex-1 min-h-0 overflow-y-auto pr-1">
522+
<Suspense fallback=move || {
523+
view! { <p>"Loading tree..."</p> }
524+
}>
525+
<ul class="font-mono text-sm">
526+
{move || {
527+
tree_resource
528+
.get()
529+
.map(|result| match result {
530+
Ok(FileViewerData::Directory { entries, .. }) => {
531+
Either::Left(
532+
view! {
533+
<For
534+
each=move || entries.clone()
535+
key=|e| e.path.clone()
536+
children=move |entry| {
537+
view! {
538+
<FileTreeNode
539+
entry=entry
540+
repo=repo.into()
541+
branch=branch.into()
542+
expanded=expanded_dirs
543+
/>
544+
}
543545
}
544-
}
545-
/>
546-
},
547-
)
548-
}
549-
_ => {
550-
Either::Right(view! { <p>"Error loading file tree."</p> })
551-
}
552-
})
553-
}}
554-
</ul>
555-
</Suspense>
546+
/>
547+
},
548+
)
549+
}
550+
_ => {
551+
Either::Right(view! { <p>"Error loading file tree."</p> })
552+
}
553+
})
554+
}}
555+
</ul>
556+
</Suspense>
557+
</div>
556558
</div>
557559

558560
<div class="flex-1 min-w-0 flex gap-6 items-start">

0 commit comments

Comments
 (0)