Bläddra i källkod

chore: Adjust Profile Style

MystiPanda 1 år sedan
förälder
incheckning
20a9775dc6
2 ändrade filer med 25 tillägg och 30 borttagningar
  1. 25 19
      src/components/profile/profile-item.tsx
  2. 0 11
      src/components/profile/profile-more.tsx

+ 25 - 19
src/components/profile/profile-item.tsx

@@ -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 ? (

+ 0 - 11
src/components/profile/profile-more.tsx

@@ -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>