@@ -82,17 +82,26 @@ const handleKeyChange = (event: Event) => {
8282 const target = event .target as HTMLInputElement
8383 apiKey .value = target .value
8484}
85+
86+ /** Switch to free API by clearing the API key */
87+ const switchToFreeApi = () => {
88+ apiKey .value = ' '
89+ handleApiKeyChange ()
90+ }
8591 </script >
8692
8793<template >
8894 <div class =" api-key-input" >
8995 <div class =" header" >
9096 <div class =" title-section" >
9197 <h3 >DefiLlama Pro API Key</h3 >
92- <div
93- v-if =" isProUser"
94- class =" pro-badge" >
95- PRO
98+ <div class =" header-actions" >
99+ <button
100+ v-if =" isProUser"
101+ @click =" switchToFreeApi"
102+ class =" switch-button" >
103+ Switch to Free API
104+ </button >
96105 </div >
97106 </div >
98107 </div >
@@ -149,6 +158,13 @@ const handleKeyChange = (event: Event) => {
149158 flex-wrap : wrap ;
150159}
151160
161+ .header-actions {
162+ display : flex ;
163+ align-items : center ;
164+ gap : var (--scalar-spacing-3 );
165+ flex-wrap : wrap ;
166+ }
167+
152168.header h3 {
153169 margin : 0 !important ;
154170 font-size : var (--scalar-mini , 13px ) !important ;
@@ -256,6 +272,39 @@ const handleKeyChange = (event: Event) => {
256272 font-size : 10px ;
257273}
258274
275+ .switch-button {
276+ padding : var (--scalar-spacing-1-5 , 6px ) var (--scalar-spacing-2 , 8px ) !important ;
277+ background : var (--scalar-background-1 , #ffffff ) !important ;
278+ border : var (--scalar-border-width , 5px ) solid
279+ var (--scalar-border-color-hover , #d1d5db ) !important ;
280+ border-radius : var (--scalar-radius , 6px ) !important ;
281+ font-size : var (--scalar-micro , 11px ) !important ;
282+ font-weight : var (--scalar-semibold , 600 ) !important ;
283+ color : var (--scalar-color-2 , #6b7280 ) !important ;
284+ cursor : pointer !important ;
285+ transition : all 0.15s ease !important ;
286+ font-family : var (--scalar-font , ' Inter' , sans-serif ) !important ;
287+ white-space : nowrap !important ;
288+ }
289+
290+ .switch-button :hover {
291+ background : var (--scalar-background-2 , #f8f9fa ) !important ;
292+ border-color : var (--scalar-border-color-hover , #d1d5db ) !important ;
293+ color : var (--scalar-color-1 , #2a2f45 ) !important ;
294+ transform : translateY (-1px ) !important ;
295+ }
296+
297+ .switch-button :active {
298+ transform : translateY (0 ) !important ;
299+ background : var (--scalar-background-3 , #e5e7eb ) !important ;
300+ }
301+
302+ .switch-button :focus {
303+ outline : none !important ;
304+ border-color : var (--scalar-color-accent , #0066cc ) !important ;
305+ box-shadow : 0 0 0 1px var (--scalar-color-accent , #0066cc ) !important ;
306+ }
307+
259308.highlight {
260309 color : var (--scalar-color-accent );
261310 font-weight : var (--scalar-semibold );
@@ -283,13 +332,23 @@ const handleKeyChange = (event: Event) => {
283332 gap : var (--scalar-spacing-1 );
284333 }
285334
335+ .header-actions {
336+ width : 100% ;
337+ justify-content : flex-start ;
338+ }
339+
286340 .description {
287341 font-size : var (--scalar-micro );
288342 }
289343
290344 .description small {
291345 font-size : 10px ;
292346 }
347+
348+ .switch-button {
349+ font-size : var (--scalar-micro );
350+ padding : var (--scalar-spacing-1-5 ) var (--scalar-spacing-2 );
351+ }
293352}
294353
295354@media (max-width : 480px ) {
@@ -322,11 +381,14 @@ const handleKeyChange = (event: Event) => {
322381/* Reduced motion support */
323382@media (prefers-reduced-motion: reduce) {
324383 .api-key-input ,
325- .api-key-field {
384+ .api-key-field ,
385+ .switch-button {
326386 transition : none ;
327387 }
328388
329- .api-key-field :focus {
389+ .api-key-field :focus ,
390+ .switch-button :hover ,
391+ .switch-button :active {
330392 transform : none ;
331393 }
332394}
0 commit comments