From 053db4a1e397382f83cffd424d694e345ca6a855 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Fri, 30 Aug 2024 04:34:28 +0200 Subject: [PATCH] Update manga page styling --- src/App.tsx | 8 +- src/components/atoms/CustomIconButton.tsx | 22 ++- .../chapter/ChapterActionMenuItems.tsx | 4 +- src/components/chapter/ChapterList.tsx | 3 +- src/components/manga/MangaDetails.tsx | 171 +++++++----------- src/components/manga/TrackMangaButton.tsx | 4 +- src/components/navbar/DefaultNavBar.tsx | 7 +- 7 files changed, 82 insertions(+), 137 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index bda74e06..f9fc8ff9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,7 +12,6 @@ import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import { loadErrorMessages, loadDevMessages } from '@apollo/client/dev'; import { loadable } from 'react-lazily/loadable'; import Box from '@mui/material/Box'; -import Toolbar from '@mui/material/Toolbar'; import { AppContext } from '@/components/context/AppContext'; import '@/i18n'; import { DefaultNavBar } from '@/components/navbar/DefaultNavBar'; @@ -79,23 +78,22 @@ const BackgroundSubscriptions = () => { }; const MainApp = () => { - const { navBarWidth, bottomBarHeight } = useNavBarContext(); + const { navBarWidth, appBarHeight, bottomBarHeight } = useNavBarContext(); return ( - - {/* General Routes */} diff --git a/src/components/atoms/CustomIconButton.tsx b/src/components/atoms/CustomIconButton.tsx index bb25f321..89cf83ac 100644 --- a/src/components/atoms/CustomIconButton.tsx +++ b/src/components/atoms/CustomIconButton.tsx @@ -8,15 +8,17 @@ import Button, { ButtonProps } from '@mui/material/Button'; import Stack from '@mui/material/Stack'; -import { TypographyProps } from '@mui/material/Typography'; +import { ForwardedRef, forwardRef } from 'react'; -export const CustomIconButton = ({ - children, - ...props -}: ButtonProps & TypographyProps) => ( - +export const CustomIconButton = forwardRef( + ( + { children, ...props }: ButtonProps, + ref: ForwardedRef, + ) => ( + + ), ); diff --git a/src/components/chapter/ChapterActionMenuItems.tsx b/src/components/chapter/ChapterActionMenuItems.tsx index 3f40f9fd..0cc6b363 100644 --- a/src/components/chapter/ChapterActionMenuItems.tsx +++ b/src/components/chapter/ChapterActionMenuItems.tsx @@ -16,7 +16,7 @@ import BookmarkRemove from '@mui/icons-material/BookmarkRemove'; import BookmarkAdd from '@mui/icons-material/BookmarkAdd'; import DoneAll from '@mui/icons-material/DoneAll'; import { useMemo } from 'react'; -import PublicIcon from '@mui/icons-material/Public'; +import LaunchIcon from '@mui/icons-material/Launch'; import { SelectableCollectionReturnType } from '@/components/collection/useSelectableCollection.ts'; import { actionToTranslationKey, @@ -159,7 +159,7 @@ export const ChapterActionMenuItems = ({ )} {isSingleMode && ( { window.open(chapter!.realUrl!, '_blank', 'noopener,noreferrer'); diff --git a/src/components/chapter/ChapterList.tsx b/src/components/chapter/ChapterList.tsx index 7a6d95c1..0e0b2c37 100644 --- a/src/components/chapter/ChapterList.tsx +++ b/src/components/chapter/ChapterList.tsx @@ -58,7 +58,6 @@ const StyledVirtuoso = styled(Virtuoso)(({ theme }) => ({ padding: 0, minHeight: '200px', [theme.breakpoints.up('md')]: { - width: '50vw', // 64px for the Appbar, 48px for the ChapterCount Header height: 'calc(100vh - 64px - 48px)', margin: 0, @@ -165,7 +164,7 @@ export const ChapterList = ({ return ( <> - + {`${visibleChapters.length} ${t('chapter.title_one', { diff --git a/src/components/manga/MangaDetails.tsx b/src/components/manga/MangaDetails.tsx index deb4c762..568b00e3 100644 --- a/src/components/manga/MangaDetails.tsx +++ b/src/components/manga/MangaDetails.tsx @@ -8,14 +8,17 @@ import FavoriteIcon from '@mui/icons-material/Favorite'; import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder'; -import PublicIcon from '@mui/icons-material/Public'; import { styled } from '@mui/material/styles'; -import { ComponentProps, useEffect, useMemo } from 'react'; +import { ComponentProps, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { t as translate } from 'i18next'; import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; import { useLongPress } from 'use-long-press'; +import Chip from '@mui/material/Chip'; +import Tooltip from '@mui/material/Tooltip'; +import LaunchIcon from '@mui/icons-material/Launch'; +import Stack from '@mui/material/Stack'; import { makeToast } from '@/components/util/Toast'; import { Mangas, MangaThumbnailInfo, MangaTrackRecordInfo } from '@/lib/data/Mangas.ts'; import { SpinnerImage } from '@/components/util/SpinnerImage.tsx'; @@ -27,132 +30,66 @@ import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts import { MangaType, SourceType } from '@/lib/graphql/generated/graphql.ts'; const DetailsWrapper = styled('div')(({ theme }) => ({ - width: '100%', + display: 'flex', + flexDirection: 'column', + gap: theme.spacing(2), + padding: theme.spacing(1), [theme.breakpoints.up('md')]: { - position: 'sticky', - top: '64px', - left: '0px', - width: '50vw', + flexBasis: '40%', height: 'calc(100vh - 64px)', - alignSelf: 'flex-start', overflowY: 'auto', }, })); -const TopContentWrapper = styled('div')(() => ({ - padding: '10px', - // [theme.breakpoints.up('md')]: { - // minWidth: '50%', - // }, -})); +const TopContentWrapper = styled('div')(() => ({})); const ThumbnailMetadataWrapper = styled('div')(() => ({ display: 'flex', })); -const Thumbnail = styled('div')(() => ({ +const Thumbnail = styled('div')(({ theme }) => ({ '& img': { borderRadius: 4, - maxWidth: '100%', - minWidth: '100%', + width: '150px', height: 'auto', - }, - maxWidth: '50%', - // [theme.breakpoints.up('md')]: { - // minWidth: '100px', - // }, -})); - -const MetadataContainer = styled('div')(({ theme }) => ({ - marginLeft: 15, - maxWidth: '100%', - '& span': { - fontWeight: '400', - }, - [theme.breakpoints.up('lg')]: { - fontSize: '1.3em', - }, -})); - -const Metadata = (props: ComponentProps) => ( - -); - -const MangaButtonsContainer = styled('div')(({ theme }) => ({ - display: 'flex', - justifyContent: 'space-around', - '& button, a': { - borderRadius: '25px', - textTransform: 'none', - paddingLeft: '20px', - paddingRight: '20px', - fontSize: 'x-large', - [theme.breakpoints.down('sm')]: { - fontSize: 'larger', + [theme.breakpoints.up('lg')]: { + width: '200px', + }, + [theme.breakpoints.up('xl')]: { + width: '300px', }, }, })); -const BottomContentWrapper = styled('div')(({ theme }) => ({ - paddingLeft: '10px', - paddingRight: '10px', - [theme.breakpoints.up('md')]: { - fontSize: '1.2em', - // maxWidth: '50%', - }, - [theme.breakpoints.up('lg')]: { - fontSize: '1.3em', - }, + +const MetadataContainer = styled('div')(({ theme }) => ({ + marginLeft: theme.spacing(1), })); -const Description = styled('div')(() => ({ - '& h4': { - marginTop: '1em', - marginBottom: 0, - }, - '& p': { - textAlign: 'justify', - textJustify: 'inter-word', - }, -})); -const Genres = styled('div')(() => ({ + +const Metadata = (props: ComponentProps) => ; + +const MangaButtonsContainer = styled('div')(({ theme }) => ({ display: 'flex', - flexWrap: 'wrap', - '& h5': { - border: '2px solid #2196f3', - borderRadius: '1.13em', - marginRight: '1em', - marginTop: 0, - marginBottom: '10px', - padding: '0.3em', - color: '#2196f3', - }, + gap: theme.spacing(1), })); const OpenSourceButton = ({ url }: { url?: string | null }) => { const { t } = useTranslation(); - const button = useMemo( - () => ( + return ( + - - {t('global.button.open_site')} + - ), - [url], + ); - - if (!url) { - return button; - } - - return button; }; function getSourceName(source?: Pick | null): string { @@ -167,6 +104,30 @@ function getValueOrUnknown(val?: string | null) { return val ?? translate('global.label.unknown'); } +const DescriptionGenre = ({ + manga: { description, genre: genres }, +}: { + manga: Pick; +}) => ( + <> + + {description} + + + {genres.map((genre) => ( + + ))} + + +); + export const MangaDetails = ({ manga, }: { @@ -208,8 +169,8 @@ export const MangaDetails = ({ @@ -223,9 +184,9 @@ export const MangaDetails = ({ {manga.inLibrary ? : } {manga.inLibrary ? t('manga.button.in_library') : t('manga.button.add_to_library')} @@ -234,17 +195,7 @@ export const MangaDetails = ({ - - -

{t('settings.about.title')}

-

{manga.description}

-
- - {manga.genre.map((g) => ( -
{g}
- ))} -
-
+ {CategorySelectComponent} diff --git a/src/components/manga/TrackMangaButton.tsx b/src/components/manga/TrackMangaButton.tsx index 8a58fb6b..b6ec737a 100644 --- a/src/components/manga/TrackMangaButton.tsx +++ b/src/components/manga/TrackMangaButton.tsx @@ -52,11 +52,11 @@ export const TrackMangaButton = ({ manga }: { manga: MangaTrackRecordInfo & Pick <> handleClick(popupState.open)} onTouchStart={() => handleClick(popupState.open)} - size="large" - sx={{ color: trackersInUse.length ? '#2196f3' : 'inherit' }} + variant={trackersInUse.length ? 'contained' : 'outlined'} > {trackersInUse.length ? : } {trackersInUse.length diff --git a/src/components/navbar/DefaultNavBar.tsx b/src/components/navbar/DefaultNavBar.tsx index 8c68b76f..09218fcb 100644 --- a/src/components/navbar/DefaultNavBar.tsx +++ b/src/components/navbar/DefaultNavBar.tsx @@ -164,12 +164,7 @@ export function DefaultNavBar() { {getOptionForDirection(, )} )} - + {title} {action}