@@ -7,9 +7,10 @@ import ApiOptions from "../settings/ApiOptions"
77import { Tab , TabContent } from "../common/Tab"
88import { useAppTranslation } from "../../i18n/TranslationContext"
99import { getRequestyAuthUrl , getOpenRouterAuthUrl } from "../../oauth/urls"
10+ import knuthShuffle from "knuth-shuffle-seeded"
1011
1112const WelcomeView = ( ) => {
12- const { apiConfiguration, currentApiConfigName, setApiConfiguration, uriScheme } = useExtensionState ( )
13+ const { apiConfiguration, currentApiConfigName, setApiConfiguration, uriScheme, machineId } = useExtensionState ( )
1314 const { t } = useAppTranslation ( )
1415 const [ errorMessage , setErrorMessage ] = useState < string | undefined > ( undefined )
1516
@@ -42,46 +43,56 @@ const WelcomeView = () => {
4243 < h4 className = "mt-3 mb-2" > { t ( "welcome:startRouter" ) } </ h4 >
4344
4445 < div className = "flex gap-4" >
45- < a
46- href = { getRequestyAuthUrl ( uriScheme ) }
47- className = "flex-1 border border-vscode-panel-border rounded p-4 flex flex-col items-center cursor-pointer transition-all hover:bg-vscode-button-hoverBackground hover:border-vscode-button-border no-underline text-inherit"
48- target = "_blank"
49- rel = "noopener noreferrer" >
50- < div className = "w-16 h-16 flex items-center justify-center rounded mb-2 overflow-hidden bg-white relative" >
51- < img
52- src = { `${ imagesBaseUri } /requesty.png` }
53- alt = "Requesty"
54- className = "w-full h-full object-contain p-2"
55- />
56- </ div >
57- < div className = "text-center" >
58- < div className = "font-bold" > Requesty</ div >
59- < div className = "text-sm text-vscode-descriptionForeground" >
60- { t ( "welcome:requestyDescription" ) }
61- </ div >
46+ { /* Define the providers */ }
47+ { ( ( ) => {
48+ // Provider card configuration
49+ const providers = [
50+ {
51+ name : "Requesty" ,
52+ description : t ( "welcome:requestyDescription" ) ,
53+ imgSrc : `${ imagesBaseUri } /requesty.png` ,
54+ authUrl : getRequestyAuthUrl ( uriScheme ) ,
55+ incentive : "$1 free credit" ,
56+ } ,
57+ {
58+ name : "OpenRouter" ,
59+ description : t ( "welcome:openRouterDescription" ) ,
60+ imgSrc : `${ imagesBaseUri } /openrouter.png` ,
61+ authUrl : getOpenRouterAuthUrl ( uriScheme ) ,
62+ } ,
63+ ]
6264
63- < div className = "text-sm font-bold" > $1 free credit</ div >
64- </ div >
65- </ a >
66- < a
67- href = { getOpenRouterAuthUrl ( uriScheme ) }
68- className = "flex-1 border border-vscode-panel-border rounded p-4 flex flex-col items-center cursor-pointer transition-all hover:bg-vscode-button-hoverBackground hover:border-vscode-button-border no-underline text-inherit"
69- target = "_blank"
70- rel = "noopener noreferrer" >
71- < div className = "w-16 h-16 flex items-center justify-center rounded mb-2 overflow-hidden bg-white relative" >
72- < img
73- src = { `${ imagesBaseUri } /openrouter.png` }
74- alt = "OpenRouter"
75- className = "w-full h-full object-contain p-2"
76- />
77- </ div >
78- < div className = "text-center" >
79- < div className = "font-bold" > OpenRouter</ div >
80- < div className = "text-sm text-vscode-descriptionForeground" >
81- { t ( "welcome:openRouterDescription" ) }
82- </ div >
83- </ div >
84- </ a >
65+ // Shuffle providers based on machine ID (will be consistent for the same machine)
66+ const orderedProviders = [ ...providers ]
67+ knuthShuffle ( orderedProviders , ( machineId as any ) || Date . now ( ) )
68+
69+ // Render the provider cards
70+ return orderedProviders . map ( ( provider , index ) => (
71+ < a
72+ key = { index }
73+ href = { provider . authUrl }
74+ className = "flex-1 border border-vscode-panel-border rounded p-4 flex flex-col items-center cursor-pointer transition-all hover:bg-vscode-button-hoverBackground hover:border-vscode-button-border no-underline text-inherit"
75+ target = "_blank"
76+ rel = "noopener noreferrer" >
77+ < div className = "w-16 h-16 flex items-center justify-center rounded mb-2 overflow-hidden bg-white relative" >
78+ < img
79+ src = { provider . imgSrc }
80+ alt = { provider . name }
81+ className = "w-full h-full object-contain p-2"
82+ />
83+ </ div >
84+ < div className = "text-center" >
85+ < div className = "font-bold" > { provider . name } </ div >
86+ < div className = "text-sm text-vscode-descriptionForeground" >
87+ { provider . description }
88+ </ div >
89+ { provider . incentive && (
90+ < div className = "text-sm font-bold" > { provider . incentive } </ div >
91+ ) }
92+ </ div >
93+ </ a >
94+ ) )
95+ } ) ( ) }
8596 </ div >
8697
8798 < div className = "text-center my-4" > or</ div >
0 commit comments