Просмотр исходного кода

✨ fix(cardpro): Keep actions & search areas mounted on mobile to auto-load RPM/TPM

This commit addresses an issue where RPM and TPM statistics did not load automatically on mobile devices.

Key changes
• Replaced conditional rendering with persistent rendering of `actionsArea` and `searchArea` in `CardPro` and applied the `hidden` CSS class when the sections should be concealed.
• Ensures internal hooks (e.g. `useUsageLogsData`) always run, allowing stats to be fetched without requiring the user to tap “Show Actions”.
• Maintains existing desktop behaviour; only mobile handling is affected.

Files updated
• `web/src/components/common/ui/CardPro.js`

Result
Mobile users now see up-to-date RPM/TPM (and other statistics) immediately after page load, improving usability and consistency with the desktop experience.
t0ng7u 7 месяцев назад
Родитель
Сommit
635bfd4aba
1 измененных файлов с 18 добавлено и 18 удалено
  1. 18 18
      web/src/components/common/ui/CardPro.js

+ 18 - 18
web/src/components/common/ui/CardPro.js

@@ -122,24 +122,24 @@ const CardPro = ({
         )}
         )}
 
 
         {/* 操作按钮和搜索表单的容器 */}
         {/* 操作按钮和搜索表单的容器 */}
-        {/* 在移动端时根据showMobileActions状态控制显示,在桌面端时始终显示 */}
-        {(!isMobile || showMobileActions) && (
-          <div className="flex flex-col gap-2">
-            {/* 操作按钮区域 - 用于type1和type3 */}
-            {(type === 'type1' || type === 'type3') && actionsArea && (
-              <div className="w-full">
-                {actionsArea}
-              </div>
-            )}
-
-            {/* 搜索表单区域 - 所有类型都可能有 */}
-            {searchArea && (
-              <div className="w-full">
-                {searchArea}
-              </div>
-            )}
-          </div>
-        )}
+        <div
+          className={`flex flex-col gap-2 ${isMobile && !showMobileActions ? 'hidden' : ''}`}
+        >
+          {/* 操作按钮区域 - 用于type1和type3 */}
+          {(type === 'type1' || type === 'type3') && actionsArea && (
+            <div className="w-full">
+              {actionsArea}
+            </div>
+          )}
+
+          {/* 搜索表单区域 - 所有类型都可能有 */}
+          {searchArea && (
+            <div className="w-full">
+              {searchArea}
+            </div>
+          )}
+        </div>
+
       </div>
       </div>
     );
     );
   };
   };