From b702cd6e4cece2a1350479ba1946365ef83728cc Mon Sep 17 00:00:00 2001 From: Supra4E8C Date: Sat, 14 Feb 2026 20:32:31 +0800 Subject: [PATCH] feat(OAuthPage): enhance layout and styling for better user experience --- src/pages/OAuthPage.module.scss | 94 +++++++- src/pages/OAuthPage.tsx | 405 ++++++++++++++++---------------- 2 files changed, 296 insertions(+), 203 deletions(-) diff --git a/src/pages/OAuthPage.module.scss b/src/pages/OAuthPage.module.scss index dd032ea..081c2f5 100644 --- a/src/pages/OAuthPage.module.scss +++ b/src/pages/OAuthPage.module.scss @@ -28,6 +28,35 @@ gap: $spacing-xl; } +.cardContent { + display: flex; + flex-direction: column; + gap: $spacing-md; + + :global(.form-group) { + margin-bottom: 0; + } + + :global(.status-badge) { + margin-bottom: 0; + align-self: flex-start; + } +} + +.cardHint { + margin: 0; + font-size: 13px; + line-height: 1.6; + color: var(--text-secondary); +} + +.cardHintSecondary { + margin: 0; + font-size: 12px; + line-height: 1.5; + color: var(--text-tertiary); +} + .oauthSection { display: flex; flex-direction: column; @@ -72,10 +101,10 @@ } .callbackSection { - margin-top: $spacing-md; + margin-top: 0; display: flex; flex-direction: column; - gap: $spacing-xs; + gap: $spacing-sm; } .callbackActions { @@ -117,11 +146,24 @@ .geminiProjectField { :global(.form-group) { - margin-top: $spacing-sm; + margin-top: 0; + margin-bottom: 0; gap: $spacing-sm; } } +.formItem { + display: flex; + flex-direction: column; + gap: $spacing-xs; +} + +.formItemLabel { + margin: 0; + font-weight: 600; + color: var(--text-primary); +} + .filePicker { display: flex; align-items: center; @@ -143,3 +185,49 @@ .fileNamePlaceholder { color: var(--text-secondary); } + +.connectionBox { + background: var(--bg-secondary); + border: 1px solid var(--border-color); + border-radius: $radius-md; + padding: $spacing-md; + display: flex; + flex-direction: column; + gap: $spacing-sm; +} + +.connectionLabel { + margin: 0; + font-size: 14px; + font-weight: 600; + color: var(--text-primary); +} + +.keyValueList { + display: flex; + flex-direction: column; + gap: 6px; +} + +.keyValueItem { + display: grid; + grid-template-columns: 140px 1fr; + gap: 10px; + align-items: start; + + @include mobile { + grid-template-columns: 1fr; + gap: 2px; + } +} + +.keyValueKey { + color: var(--text-secondary); + font-size: 13px; +} + +.keyValueValue { + color: var(--text-primary); + word-break: break-all; + overflow-wrap: anywhere; +} diff --git a/src/pages/OAuthPage.tsx b/src/pages/OAuthPage.tsx index 5cc2515..8cb3e34 100644 --- a/src/pages/OAuthPage.tsx +++ b/src/pages/OAuthPage.tsx @@ -358,88 +358,90 @@ export function OAuthPage() { } > -
{t(provider.hintKey)}
- {provider.id === 'gemini-cli' && ( -
- - updateProviderState(provider.id, { - projectId: e.target.value, - projectIdError: undefined - }) - } - placeholder={t('auth_login.gemini_cli_project_id_placeholder')} - /> -
- )} - {state.url && ( -
-
{t(provider.urlLabelKey)}
-
{state.url}
-
- - +
+
{t(provider.hintKey)}
+ {provider.id === 'gemini-cli' && ( +
+ + updateProviderState(provider.id, { + projectId: e.target.value, + projectIdError: undefined + }) + } + placeholder={t('auth_login.gemini_cli_project_id_placeholder')} + />
-
- )} - {canSubmitCallback && ( -
- - updateProviderState(provider.id, { - callbackUrl: e.target.value, - callbackStatus: undefined, - callbackError: undefined - }) - } - placeholder={t('auth_login.oauth_callback_placeholder')} - /> -
- + )} + {state.url && ( +
+
{t(provider.urlLabelKey)}
+
{state.url}
+
+ + +
- {state.callbackStatus === 'success' && state.status === 'waiting' && ( -
- {t('auth_login.oauth_callback_status_success')} + )} + {canSubmitCallback && ( +
+ + updateProviderState(provider.id, { + callbackUrl: e.target.value, + callbackStatus: undefined, + callbackError: undefined + }) + } + placeholder={t('auth_login.oauth_callback_placeholder')} + /> +
+
- )} - {state.callbackStatus === 'error' && ( -
- {t('auth_login.oauth_callback_status_error')} {state.callbackError || ''} -
- )} -
- )} - {state.status && state.status !== 'idle' && ( -
- {state.status === 'success' - ? t(getAuthKey(provider.id, 'oauth_status_success')) - : state.status === 'error' - ? `${t(getAuthKey(provider.id, 'oauth_status_error'))} ${state.error || ''}` - : t(getAuthKey(provider.id, 'oauth_status_waiting'))} -
- )} + {state.callbackStatus === 'success' && state.status === 'waiting' && ( +
+ {t('auth_login.oauth_callback_status_success')} +
+ )} + {state.callbackStatus === 'error' && ( +
+ {t('auth_login.oauth_callback_status_error')} {state.callbackError || ''} +
+ )} +
+ )} + {state.status && state.status !== 'idle' && ( +
+ {state.status === 'success' + ? t(getAuthKey(provider.id, 'oauth_status_success')) + : state.status === 'error' + ? `${t(getAuthKey(provider.id, 'oauth_status_error'))} ${state.error || ''}` + : t(getAuthKey(provider.id, 'oauth_status_waiting'))} +
+ )} +
); @@ -459,78 +461,80 @@ export function OAuthPage() { } > -
{t('vertex_import.description')}
- - setVertexState((prev) => ({ - ...prev, - location: e.target.value - })) - } - placeholder={t('vertex_import.location_placeholder')} - /> -
- -
- -
- {vertexState.fileName || t('vertex_import.file_placeholder')} -
-
-
{t('vertex_import.file_hint')}
- +
{t('vertex_import.description')}
+ + setVertexState((prev) => ({ + ...prev, + location: e.target.value + })) + } + placeholder={t('vertex_import.location_placeholder')} /> -
- {vertexState.error && ( -
- {vertexState.error} -
- )} - {vertexState.result && ( -
-
{t('vertex_import.result_title')}
-
- {vertexState.result.projectId && ( -
- {t('vertex_import.result_project')} - {vertexState.result.projectId} -
- )} - {vertexState.result.email && ( -
- {t('vertex_import.result_email')} - {vertexState.result.email} -
- )} - {vertexState.result.location && ( -
- {t('vertex_import.result_location')} - {vertexState.result.location} -
- )} - {vertexState.result.authFile && ( -
- {t('vertex_import.result_file')} - {vertexState.result.authFile} -
- )} +
+ +
+ +
+ {vertexState.fileName || t('vertex_import.file_placeholder')} +
+
{t('vertex_import.file_hint')}
+
- )} + {vertexState.error && ( +
+ {vertexState.error} +
+ )} + {vertexState.result && ( +
+
{t('vertex_import.result_title')}
+
+ {vertexState.result.projectId && ( +
+ {t('vertex_import.result_project')} + {vertexState.result.projectId} +
+ )} + {vertexState.result.email && ( +
+ {t('vertex_import.result_email')} + {vertexState.result.email} +
+ )} + {vertexState.result.location && ( +
+ {t('vertex_import.result_location')} + {vertexState.result.location} +
+ )} + {vertexState.result.authFile && ( +
+ {t('vertex_import.result_file')} + {vertexState.result.authFile} +
+ )} +
+
+ )} +
{/* iFlow Cookie 登录 */} @@ -547,60 +551,61 @@ export function OAuthPage() { } > -
{t('auth_login.iflow_cookie_hint')}
-
- {t('auth_login.iflow_cookie_key_hint')} -
-
- - setIflowCookie((prev) => ({ ...prev, cookie: e.target.value }))} - placeholder={t('auth_login.iflow_cookie_placeholder')} - /> -
- {iflowCookie.error && ( -
- {iflowCookie.errorType === 'warning' - ? t('auth_login.iflow_cookie_status_duplicate') - : t('auth_login.iflow_cookie_status_error')}{' '} - {iflowCookie.error} +
+
{t('auth_login.iflow_cookie_hint')}
+
+ {t('auth_login.iflow_cookie_key_hint')}
- )} - {iflowCookie.result && iflowCookie.result.status === 'ok' && ( -
-
{t('auth_login.iflow_cookie_result_title')}
-
- {iflowCookie.result.email && ( -
- {t('auth_login.iflow_cookie_result_email')} - {iflowCookie.result.email} -
- )} - {iflowCookie.result.expired && ( -
- {t('auth_login.iflow_cookie_result_expired')} - {iflowCookie.result.expired} -
- )} - {iflowCookie.result.saved_path && ( -
- {t('auth_login.iflow_cookie_result_path')} - {iflowCookie.result.saved_path} -
- )} - {iflowCookie.result.type && ( -
- {t('auth_login.iflow_cookie_result_type')} - {iflowCookie.result.type} -
- )} +
+ + setIflowCookie((prev) => ({ ...prev, cookie: e.target.value }))} + placeholder={t('auth_login.iflow_cookie_placeholder')} + /> +
+ {iflowCookie.error && ( +
+ {iflowCookie.errorType === 'warning' + ? t('auth_login.iflow_cookie_status_duplicate') + : t('auth_login.iflow_cookie_status_error')}{' '} + {iflowCookie.error}
-
- )} + )} + {iflowCookie.result && iflowCookie.result.status === 'ok' && ( +
+
{t('auth_login.iflow_cookie_result_title')}
+
+ {iflowCookie.result.email && ( +
+ {t('auth_login.iflow_cookie_result_email')} + {iflowCookie.result.email} +
+ )} + {iflowCookie.result.expired && ( +
+ {t('auth_login.iflow_cookie_result_expired')} + {iflowCookie.result.expired} +
+ )} + {iflowCookie.result.saved_path && ( +
+ {t('auth_login.iflow_cookie_result_path')} + {iflowCookie.result.saved_path} +
+ )} + {iflowCookie.result.type && ( +
+ {t('auth_login.iflow_cookie_result_type')} + {iflowCookie.result.type} +
+ )} +
+
+ )} +