chore: Adjust Profile Style

This commit is contained in:
MystiPanda 2024-03-10 21:37:52 +08:00
parent 8ec19e058f
commit 20a9775dc6
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 from = parseUrl(itemData.url);
const description = itemData.desc;
const expire = parseExpire(extra?.expire);
const progress = Math.round(((download + upload) * 100) / (total + 0.1));
@ -275,27 +276,32 @@ export const ProfileItem = (props: Props) => {
</Box>
{/* the second line show url's info or description */}
<Box sx={boxStyle}>
{hasUrl ? (
{
<>
<Typography noWrap title={`From: ${from}`}>
{from}
</Typography>
<Typography
noWrap
flex="1 0 auto"
fontSize={14}
textAlign="right"
title={`Updated Time: ${parseExpire(updated)}`}
>
{updated > 0 ? dayjs(updated * 1000).fromNow() : ""}
</Typography>
{description ? (
<Typography noWrap title={description}>
{description}
</Typography>
) : (
hasUrl && (
<Typography noWrap title={`From ${from}`}>
{from}
</Typography>
)
)}
{hasUrl && (
<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>
{/* the third line show extra info or last updated time */}
{hasExtra ? (

View File

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