Feature/show extension repo only in case more than one repo is set (#543)

* Rename "isSingleRepoSet" prop to "showSourceRepo"

* Show repo of source in case sources of different repos are installed

* Center the source icon
This commit is contained in:
schroda
2024-01-09 22:09:31 +01:00
committed by GitHub
parent 684ae69470
commit fd1fa63064
8 changed files with 203 additions and 34 deletions

View File

@@ -15,7 +15,7 @@ import Typography from '@mui/material/Typography';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
import { ISource } from '@/typings';
import { TPartialSource } from '@/typings';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { translateExtensionLanguage } from '@/screens/util/Extensions';
import { SourceContentType } from '@/screens/SourceMangas';
@@ -39,14 +39,24 @@ const WiderWidthButtons = styled('div')(({ theme }) => ({
}));
interface IProps {
source: ISource;
source: TPartialSource;
showSourceRepo: boolean;
}
export const SourceCard: React.FC<IProps> = (props: IProps) => {
const { t } = useTranslation();
const {
source: { id, name, lang, iconUrl, supportsLatest, isNsfw },
source: {
id,
name,
lang,
iconUrl,
supportsLatest,
isNsfw,
extension: { repo },
},
showSourceRepo,
} = props;
return (
@@ -69,7 +79,7 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
padding: 2,
}}
>
<Box sx={{ display: 'flex' }}>
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Avatar
variant="rounded"
alt={name}
@@ -99,6 +109,11 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
{' 18+'}
</Typography>
)}
{showSourceRepo && (
<Typography variant="caption" display="block">
{repo}
</Typography>
)}
</Typography>
)}
</Box>