From 755ece2f01543bb18a9ec746b21dff88eac554c3 Mon Sep 17 00:00:00 2001 From: Seefs Date: Mon, 23 Mar 2026 00:58:59 +0800 Subject: [PATCH] refactor: simplify codex account modal and collapse raw json by default --- .../table/channels/modals/CodexUsageModal.jsx | 104 ++++++++++-------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/web/src/components/table/channels/modals/CodexUsageModal.jsx b/web/src/components/table/channels/modals/CodexUsageModal.jsx index 2e36474a..cc454891 100644 --- a/web/src/components/table/channels/modals/CodexUsageModal.jsx +++ b/web/src/components/table/channels/modals/CodexUsageModal.jsx @@ -187,14 +187,14 @@ const AccountInfoCard = ({ t, label, value, onCopy, monospace = false }) => { const hasValue = text !== ''; return ( -
-
+
+
{label}
-
+
{hasValue ? text : '-'} @@ -203,6 +203,7 @@ const AccountInfoCard = ({ t, label, value, onCopy, monospace = false }) => { size='small' type='tertiary' theme='borderless' + className='px-1 text-xs' disabled={!hasValue} onClick={() => onCopy?.(text)} > @@ -266,6 +267,7 @@ const RateLimitWindowCard = ({ t, title, windowData }) => { const CodexUsageView = ({ t, record, payload, onCopy, onRefresh }) => { const tt = typeof t === 'function' ? t : (v) => v; + const [showRawJson, setShowRawJson] = useState(false); const data = payload?.data ?? null; const rateLimit = data?.rate_limit ?? {}; const { fiveHourWindow, weeklyWindow } = resolveRateLimitWindows(data); @@ -291,37 +293,35 @@ const CodexUsageView = ({ t, record, payload, onCopy, onRefresh }) => {
)} -
-
-
-
-
- {tt('Codex 帐号')} -
-
- - {accountTypeLabel} - - {statusTag} -
- {tt('上游状态码:')} - {upstreamStatus ?? '-'} -
-
+
+
+
+
+ {tt('Codex 帐号')} +
+
+ + {accountTypeLabel} + + {statusTag} + + {tt('上游状态码:')} + {upstreamStatus ?? '-'} +
-
+
-
+
{ />
-
+
{tt('渠道:')} {record?.name || '-'} ({tt('编号:')} {record?.id || '-'}) @@ -373,19 +373,33 @@ const CodexUsageView = ({ t, record, payload, onCopy, onRefresh }) => {
{tt('原始 JSON')}
- +
+ + {showRawJson && ( + + )} +
-
-          {rawText}
-        
+ {showRawJson && ( +
+            {rawText}
+          
+ )}
);