Fix source/extension repo url word break

This commit is contained in:
schroda
2025-04-25 00:27:28 +02:00
parent 24629407cb
commit b503ab07e9
2 changed files with 67 additions and 114 deletions

View File

@@ -12,10 +12,10 @@ import CardContent from '@mui/material/CardContent';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import Avatar from '@mui/material/Avatar'; import Avatar from '@mui/material/Avatar';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import IconButton from '@mui/material/IconButton'; import IconButton from '@mui/material/IconButton';
import SettingsIcon from '@mui/icons-material/Settings'; import SettingsIcon from '@mui/icons-material/Settings';
import Stack from '@mui/material/Stack';
import { requestManager } from '@/lib/requests/RequestManager.ts'; import { requestManager } from '@/lib/requests/RequestManager.ts';
import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts'; import { defaultPromiseErrorHandler } from '@/lib/DefaultPromiseErrorHandler.ts';
import { makeToast } from '@/modules/core/utils/Toast.ts'; import { makeToast } from '@/modules/core/utils/Toast.ts';
@@ -147,49 +147,27 @@ export function ExtensionCard(props: IProps) {
src={requestManager.getValidImgUrlFor(iconUrl)} src={requestManager.getValidImgUrlFor(iconUrl)}
/> />
</Avatar> </Avatar>
<Box <Stack
sx={{ sx={{
display: 'flex', justifyContent: 'center',
flexDirection: 'column',
flexGrow: 1, flexGrow: 1,
flexShrink: 1, flexShrink: 1,
wordBreak: 'break-word', wordBreak: 'break-word',
justifyContent: 'center',
}} }}
> >
<Typography variant="h6" component="h3"> <Typography variant="h6" component="h3">
{name} {name}
</Typography> </Typography>
<Typography <Typography variant="caption">
variant="caption"
sx={{
display: 'block',
}}
>
{langPress} {versionName} {langPress} {versionName}
{isNsfw && ( {isNsfw && (
<Typography <Typography variant="caption" color="error">
variant="caption"
color="error"
sx={{
display: 'inline',
}}
>
{' 18+'} {' 18+'}
</Typography> </Typography>
)} )}
</Typography> </Typography>
{showSourceRepo && ( {showSourceRepo && <Typography variant="caption">{repo}</Typography>}
<Typography </Stack>
variant="caption"
sx={{
display: 'block',
}}
>
{repo}
</Typography>
)}
</Box>
{isInstalled && ( {isInstalled && (
<CustomTooltip title={t('settings.title')}> <CustomTooltip title={t('settings.title')}>
<IconButton onClick={showOptions} color="inherit"> <IconButton onClick={showOptions} color="inherit">

View File

@@ -7,7 +7,6 @@
*/ */
import CardActionArea from '@mui/material/CardActionArea'; import CardActionArea from '@mui/material/CardActionArea';
import Box from '@mui/material/Box';
import Avatar from '@mui/material/Avatar'; import Avatar from '@mui/material/Avatar';
import Button from '@mui/material/Button'; import Button from '@mui/material/Button';
import Card from '@mui/material/Card'; import Card from '@mui/material/Card';
@@ -65,12 +64,11 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
<CardContent <CardContent
sx={{ sx={{
display: 'flex', display: 'flex',
justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
padding: 1.5, gap: 1,
p: 1.5,
}} }}
> >
<Box sx={{ display: 'flex', alignItems: 'center' }}>
<Avatar <Avatar
variant="rounded" variant="rounded"
alt={sourceName} alt={sourceName}
@@ -78,7 +76,6 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
width: 56, width: 56,
height: 56, height: 56,
flex: '0 0 auto', flex: '0 0 auto',
mr: 1,
background: 'transparent', background: 'transparent',
}} }}
> >
@@ -89,48 +86,27 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
src={requestManager.getValidImgUrlFor(iconUrl)} src={requestManager.getValidImgUrlFor(iconUrl)}
/> />
</Avatar> </Avatar>
<Box <Stack
sx={{ sx={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center', justifyContent: 'center',
flexGrow: 1,
flexShrink: 1,
wordBreak: 'break-word',
}} }}
> >
<Typography variant="h6" component="h3"> <Typography variant="h6" component="h3">
{sourceName} {sourceName}
</Typography> </Typography>
<Typography <Typography variant="caption">
variant="caption"
sx={{
display: 'block',
}}
>
{translateExtensionLanguage(lang)} {translateExtensionLanguage(lang)}
{isNsfw && ( {isNsfw && (
<Typography <Typography variant="caption" color="error">
variant="caption"
color="error"
sx={{
display: 'inline',
}}
>
{' 18+'} {' 18+'}
</Typography> </Typography>
)} )}
{showSourceRepo && (
<Typography
variant="caption"
sx={{
display: 'block',
}}
>
{repo}
</Typography> </Typography>
)} {showSourceRepo && <Typography variant="caption">{repo}</Typography>}
</Typography> </Stack>
</Box>
</Box>
<Stack sx={{ flexDirection: 'row', gap: 1 }}>
{supportsLatest && ( {supportsLatest && (
<Button <Button
{...MUIUtil.preventRippleProp()} {...MUIUtil.preventRippleProp()}
@@ -153,7 +129,6 @@ export const SourceCard: React.FC<IProps> = (props: IProps) => {
{t('global.button.popular')} {t('global.button.popular')}
</Button> </Button>
)} )}
</Stack>
</CardContent> </CardContent>
</CardActionArea> </CardActionArea>
</Card> </Card>