chore: Adjust Profile Style

This commit is contained in:
MystiPanda 2024-03-10 21:37:52 +08:00
parent 1992237ce5
commit 7ce8597c25
2 changed files with 25 additions and 30 deletions

View File

@ -57,6 +57,7 @@ export const ProfileItem = (props: Props) => {
const { upload = 0, download = 0, total = 0 } = extra ?? {}; const { upload = 0, download = 0, total = 0 } = extra ?? {};
const from = parseUrl(itemData.url); const from = parseUrl(itemData.url);
const description = itemData.desc;
const expire = parseExpire(extra?.expire); const expire = parseExpire(extra?.expire);
const progress = Math.round(((download + upload) * 100) / (total + 0.1)); const progress = Math.round(((download + upload) * 100) / (total + 0.1));
@ -275,27 +276,32 @@ export const ProfileItem = (props: Props) => {
</Box> </Box>
{/* the second line show url's info or description */} {/* the second line show url's info or description */}
<Box sx={boxStyle}> <Box sx={boxStyle}>
{hasUrl ? ( {
<> <>
<Typography noWrap title={`From: ${from}`}> {description ? (
{from} <Typography noWrap title={description}>
</Typography> {description}
</Typography>
<Typography ) : (
noWrap hasUrl && (
flex="1 0 auto" <Typography noWrap title={`From ${from}`}>
fontSize={14} {from}
textAlign="right" </Typography>
title={`Updated Time: ${parseExpire(updated)}`} )
> )}
{updated > 0 ? dayjs(updated * 1000).fromNow() : ""} {hasUrl && (
</Typography> <Typography
noWrap
flex="1 0 auto"
fontSize={14}
textAlign="right"
title={`Updated Time: ${parseExpire(updated)}`}
>
{updated > 0 ? dayjs(updated * 1000).fromNow() : ""}
</Typography>
)}
</> </>
) : ( }
<Typography noWrap title={itemData.desc}>
{itemData.desc}
</Typography>
)}
</Box> </Box>
{/* the third line show extra info or last updated time */} {/* the third line show extra info or last updated time */}
{hasExtra ? ( {hasExtra ? (

View File

@ -178,17 +178,6 @@ export const ProfileMore = (props: Props) => {
{itemData.desc} {itemData.desc}
</Typography> </Typography>
)} )}
<Typography
noWrap
component="span"
title={`Updated Time: ${parseExpire(itemData.updated)}`}
style={{ fontSize: 14 }}
>
{!!itemData.updated
? dayjs(itemData.updated! * 1000).fromNow()
: ""}
</Typography>
</Box> </Box>
</ProfileBox> </ProfileBox>