Skip to content

Commit 30ade1d

Browse files
committed
fix(ui): fix chapter list overflow and menu positioning
- Add scroll functionality to the chapter list to prevent content overflow. - Conditionally adjust the positioning of chapter action menus to ensure they remain visible within the modal, preventing them from being cut off for chapters at the top of the list.
1 parent d218954 commit 30ade1d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/AudiobookExportModal.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,15 @@ export function AudiobookExportModal({
538538

539539
{chapters.length > 0 && (
540540
<>
541-
<div className={`space-y-2 max-h-96 ${isRefreshingChapters ? 'opacity-70 transition-opacity' : ''}`} aria-busy={isRefreshingChapters}>
541+
<div
542+
className={`space-y-2 max-h-96 overflow-scroll pr-1 ${isRefreshingChapters ? 'opacity-70 transition-opacity' : ''}`}
543+
aria-busy={isRefreshingChapters}
544+
>
542545
<div className="flex items-center gap-2">
543546
<h4 className="text-sm font-medium text-foreground">Chapters</h4>
544547
{isRefreshingChapters && <ClockIcon className="h-4 w-4 text-muted animate-spin" />}
545548
</div>
546-
{displayChapters.map((chapter) => (
549+
{displayChapters.map((chapter, index) => (
547550
<div
548551
key={chapter.index}
549552
className={`flex items-center justify-between px-2 sm:px-3 py-1 sm:py-1.5 rounded-lg bg-offbase ${(regeneratingChapter === chapter.index || chapter.status === 'generating') ? 'prism-outline' : ''}`}
@@ -591,7 +594,7 @@ export function AudiobookExportModal({
591594
leaveFrom="transform opacity-100 scale-100"
592595
leaveTo="transform opacity-0 scale-95"
593596
>
594-
<MenuItems className="absolute right-0 bottom-full mb-2 w-44 origin-bottom-right rounded-md bg-background shadow-lg ring-1 ring-black/5 focus:outline-none z-10 p-1">
597+
<MenuItems className={`absolute right-0 w-44 rounded-md bg-background shadow-lg ring-1 ring-black/5 focus:outline-none z-10 p-1 ${index < 2 ? 'top-full mt-2 origin-top-right' : 'bottom-full mb-2 origin-bottom-right'}`}>
595598
{chapter.status === 'completed' && (
596599
<>
597600
<MenuItem>

0 commit comments

Comments
 (0)