diff --git a/src/components/manga/ChapterList.tsx b/src/components/manga/ChapterList.tsx index e5870cf9..fa36f0dd 100644 --- a/src/components/manga/ChapterList.tsx +++ b/src/components/manga/ChapterList.tsx @@ -21,6 +21,7 @@ import ChaptersToolbarMenu from 'components/manga/ChaptersToolbarMenu'; import SelectionFAB from 'components/manga/SelectionFAB'; import { BatchChaptersChange, IChapter, IDownloadChapter, IQueue, TranslationKey } from 'typings'; import { useTranslation } from 'react-i18next'; +import { DEFAULT_FULL_FAB_HEIGHT } from 'components/util/StyledFab'; const StyledVirtuoso = styled(Virtuoso)(({ theme }) => ({ listStyle: 'none', @@ -252,15 +253,29 @@ const ChapterList: React.FC = ({ mangaId }) => { // 900 is the md breakpoint in MUI overflowY: window.innerWidth < 900 ? 'visible' : 'auto', }} - totalCount={visibleChapters.length} - itemContent={(index: number) => ( - mutate()} - onSelect={() => handleSelection(index)} - /> - )} + totalCount={visibleChapters.length + 1} + itemContent={(index: number) => { + // hacky way of adding padding to the bottom of the list, so the FAB doesn't overlay the last chapter + // since I was unable to find another solution on how to achieve this + if (index === visibleChapters.length) { + return ( +
+ ); + } + + return ( + mutate()} + onSelect={() => handleSelection(index)} + /> + ); + }} useWindowScroll={window.innerWidth < 900} overscan={window.innerHeight * 0.5} /> diff --git a/src/components/manga/ResumeFAB.tsx b/src/components/manga/ResumeFAB.tsx index d1fa6300..aac0265c 100644 --- a/src/components/manga/ResumeFAB.tsx +++ b/src/components/manga/ResumeFAB.tsx @@ -6,12 +6,12 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import React from 'react'; -import { Fab } from '@mui/material'; import { Link } from 'react-router-dom'; import { PlayArrow } from '@mui/icons-material'; import { BACK } from 'util/useBackTo'; import { IChapter } from 'typings'; import { useTranslation } from 'react-i18next'; +import StyledFab from 'components/util/StyledFab'; interface ResumeFABProps { chapter: IChapter; @@ -26,8 +26,7 @@ export default function ResumeFab(props: ResumeFABProps) { mangaId, } = props; return ( - {index === 1 ? t('global.button.start') : t('global.button.resume')} - + ); } diff --git a/src/components/manga/SelectionFAB.tsx b/src/components/manga/SelectionFAB.tsx index ae8048e2..13eb433b 100644 --- a/src/components/manga/SelectionFAB.tsx +++ b/src/components/manga/SelectionFAB.tsx @@ -12,6 +12,7 @@ import React, { useRef, useState } from 'react'; import type { IChapterWithMeta } from 'components/manga/ChapterList'; import SelectionFABActionItem from 'components/manga/SelectionFABActionItem'; import { useTranslation } from 'react-i18next'; +import { DEFAULT_FAB_STYLE } from 'components/util/StyledFab'; export type SelectionAction = 'download' | 'delete' | 'bookmark' | 'unbookmark' | 'mark_as_read' | 'mark_as_unread'; @@ -38,9 +39,8 @@ const SelectionFAB: React.FC = (props) => { return ( - setFilterOptions(!FilterOptions)} - variant="extended" - color="primary" - > + setFilterOptions(!FilterOptions)} variant="extended" color="primary"> {t('global.button.filter')} - + setFilterOptions(false)}> diff --git a/src/components/util/StyledFab.tsx b/src/components/util/StyledFab.tsx new file mode 100644 index 00000000..8500aa24 --- /dev/null +++ b/src/components/util/StyledFab.tsx @@ -0,0 +1,17 @@ +import { Fab } from '@mui/material'; +import { styled } from '@mui/system'; + +export const DEFAULT_FAB_STYLE = { + position: 'fixed', + height: '48px', + right: '3em', + bottom: '2em', +} as const; + +export const DEFAULT_FULL_FAB_HEIGHT = `calc(${DEFAULT_FAB_STYLE.bottom} + ${DEFAULT_FAB_STYLE.height})`; + +const StyledFab = styled(Fab)({ + ...DEFAULT_FAB_STYLE, +}) as typeof Fab; + +export default StyledFab;