瀏覽代碼

fix: sub usage percent fails to display when number is too small #1290

dongchengjie 11 月之前
父節點
當前提交
8d8c2ed262
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/components/profile/profile-item.tsx

+ 2 - 2
src/components/profile/profile-item.tsx

@@ -71,7 +71,7 @@ export const ProfileItem = (props: Props) => {
   const from = parseUrl(itemData.url);
   const description = itemData.desc;
   const expire = parseExpire(extra?.expire);
-  const progress = Math.round(((download + upload) * 100) / (total + 0.1));
+  const progress = Math.round(((download + upload) * 100) / (total + 0.01) + 1);
 
   const loading = loadingCache[itemData.uid] ?? false;
 
@@ -429,7 +429,7 @@ export const ProfileItem = (props: Props) => {
         <LinearProgress
           variant="determinate"
           value={progress}
-          style={{ opacity: progress > 0 ? 1 : 0 }}
+          style={{ opacity: total > 0 ? 1 : 0 }}
         />
       </ProfileBox>