/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { CardActionArea } from '@mui/material'; import Avatar from '@mui/material/Avatar'; import Button from '@mui/material/Button'; import Card from '@mui/material/Card'; import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; import { Box, styled } from '@mui/system'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { Link, useHistory } from 'react-router-dom'; import { ISource } from 'typings'; import { translateExtensionLanguage } from 'screens/util/Extensions'; import requestManager from 'lib/RequestManager'; const MobileWidthButtons = styled('div')(({ theme }) => ({ display: 'flex', [theme.breakpoints.up('sm')]: { display: 'none', }, })); const WiderWidthButtons = styled('div')(({ theme }) => ({ display: 'flex', [theme.breakpoints.down('sm')]: { display: 'none', }, '& .MuiButton-root': { marginLeft: '20px', }, })); interface IProps { source: ISource; } const SourceCard: React.FC = (props: IProps) => { const { t } = useTranslation(); const { source: { id, name, lang, iconUrl, supportsLatest, isNsfw }, } = props; const history = useHistory(); const redirectTo = (e: any, to: string) => { history.push(to); // prevent parent tags from getting the event e.stopPropagation(); }; return ( {name} {id !== '0' && ( {translateExtensionLanguage(lang)} {isNsfw && ( {' 18+'} )} )} <> {supportsLatest && ( )} {supportsLatest && ( )} ); }; export default SourceCard;