mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Initially hide some Auth options behind "More..." (#1245)
This commit is contained in:
committed by
GitHub
parent
4059a3e8ee
commit
2f1fc3f359
@@ -28,7 +28,7 @@ export function AuthDialog({
|
|||||||
const [errorMessage, setErrorMessage] = useState<string | null>(
|
const [errorMessage, setErrorMessage] = useState<string | null>(
|
||||||
initialErrorMessage || null,
|
initialErrorMessage || null,
|
||||||
);
|
);
|
||||||
const authItems = [
|
const allAuthItems = [
|
||||||
{
|
{
|
||||||
label: 'Login with Google Personal Account',
|
label: 'Login with Google Personal Account',
|
||||||
value: AuthType.LOGIN_WITH_GOOGLE_PERSONAL,
|
value: AuthType.LOGIN_WITH_GOOGLE_PERSONAL,
|
||||||
@@ -41,7 +41,20 @@ export function AuthDialog({
|
|||||||
{ label: 'Vertex AI', value: AuthType.USE_VERTEX_AI },
|
{ label: 'Vertex AI', value: AuthType.USE_VERTEX_AI },
|
||||||
];
|
];
|
||||||
|
|
||||||
let initialAuthIndex = authItems.findIndex(
|
const isSelectedAuthInMore = allAuthItems
|
||||||
|
.slice(2)
|
||||||
|
.some((item) => item.value === settings.merged.selectedAuthType);
|
||||||
|
|
||||||
|
const [showAll, setShowAll] = useState(isSelectedAuthInMore);
|
||||||
|
|
||||||
|
const initialAuthItems = [
|
||||||
|
...allAuthItems.slice(0, 2),
|
||||||
|
{ label: 'More...', value: 'more' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const items = showAll ? allAuthItems : initialAuthItems;
|
||||||
|
|
||||||
|
let initialAuthIndex = items.findIndex(
|
||||||
(item) => item.value === settings.merged.selectedAuthType,
|
(item) => item.value === settings.merged.selectedAuthType,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -50,6 +63,10 @@ export function AuthDialog({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleAuthSelect = (authMethod: string) => {
|
const handleAuthSelect = (authMethod: string) => {
|
||||||
|
if (authMethod === 'more') {
|
||||||
|
setShowAll(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const error = validateAuthMethod(authMethod);
|
const error = validateAuthMethod(authMethod);
|
||||||
if (error) {
|
if (error) {
|
||||||
setErrorMessage(error);
|
setErrorMessage(error);
|
||||||
@@ -75,7 +92,7 @@ export function AuthDialog({
|
|||||||
>
|
>
|
||||||
<Text bold>Select Auth Method</Text>
|
<Text bold>Select Auth Method</Text>
|
||||||
<RadioButtonSelect
|
<RadioButtonSelect
|
||||||
items={authItems}
|
items={items}
|
||||||
initialIndex={initialAuthIndex}
|
initialIndex={initialAuthIndex}
|
||||||
onSelect={handleAuthSelect}
|
onSelect={handleAuthSelect}
|
||||||
onHighlight={onHighlight}
|
onHighlight={onHighlight}
|
||||||
|
|||||||
Reference in New Issue
Block a user