Skip to content

Commit 26ec125

Browse files
authored
improvement(byok): updated styling for byok page (#2581)
1 parent 9737253 commit 26ec125

File tree

1 file changed

+53
-26
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/byok

1 file changed

+53
-26
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/byok/byok.tsx

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
ModalContent,
1212
ModalFooter,
1313
ModalHeader,
14-
Trash,
1514
} from '@/components/emcn'
1615
import { AnthropicIcon, GeminiIcon, MistralIcon, OpenAIIcon } from '@/components/icons'
1716
import { Skeleton } from '@/components/ui'
@@ -65,10 +64,10 @@ const PROVIDERS: {
6564

6665
function BYOKKeySkeleton() {
6766
return (
68-
<div className='flex items-center justify-between gap-[12px] rounded-[8px] p-[12px]'>
67+
<div className='flex items-center justify-between gap-[12px]'>
6968
<div className='flex items-center gap-[12px]'>
7069
<Skeleton className='h-9 w-9 flex-shrink-0 rounded-[6px]' />
71-
<div className='flex flex-col justify-center gap-[1px]'>
70+
<div className='flex min-w-0 flex-col justify-center gap-[1px]'>
7271
<Skeleton className='h-[14px] w-[100px]' />
7372
<Skeleton className='h-[13px] w-[200px]' />
7473
</div>
@@ -159,41 +158,40 @@ export function BYOK() {
159158
const Icon = provider.icon
160159

161160
return (
162-
<div
163-
key={provider.id}
164-
className='flex items-center justify-between gap-[12px] rounded-[8px] p-[12px]'
165-
>
161+
<div key={provider.id} className='flex items-center justify-between gap-[12px]'>
166162
<div className='flex items-center gap-[12px]'>
167163
<div className='flex h-9 w-9 flex-shrink-0 items-center justify-center overflow-hidden rounded-[6px] bg-[var(--surface-6)]'>
168164
<Icon className='h-4 w-4' />
169165
</div>
170-
<div className='flex flex-col gap-[2px]'>
166+
<div className='flex min-w-0 flex-col justify-center gap-[1px]'>
171167
<span className='font-medium text-[14px]'>{provider.name}</span>
172-
<span className='text-[12px] text-[var(--text-tertiary)]'>
173-
{provider.description}
174-
</span>
175-
{existingKey && (
176-
<span className='font-mono text-[11px] text-[var(--text-muted)]'>
177-
{existingKey.maskedKey}
178-
</span>
179-
)}
168+
<p className='truncate text-[13px] text-[var(--text-muted)]'>
169+
{existingKey ? existingKey.maskedKey : provider.description}
170+
</p>
180171
</div>
181172
</div>
182173

183-
<div className='flex items-center gap-[6px]'>
184-
{existingKey && (
174+
{existingKey ? (
175+
<div className='flex flex-shrink-0 items-center gap-[8px]'>
176+
<Button variant='ghost' onClick={() => openEditModal(provider.id)}>
177+
Update
178+
</Button>
185179
<Button
186180
variant='ghost'
187-
className='h-9 w-9'
188181
onClick={() => setDeleteConfirmProvider(provider.id)}
189182
>
190-
<Trash />
183+
Delete
191184
</Button>
192-
)}
193-
<Button variant='default' onClick={() => openEditModal(provider.id)}>
194-
{existingKey ? 'Update' : 'Add Key'}
185+
</div>
186+
) : (
187+
<Button
188+
variant='primary'
189+
className='!bg-[var(--brand-tertiary-2)] !text-[var(--text-inverse)] hover:!bg-[var(--brand-tertiary-2)]/90'
190+
onClick={() => openEditModal(provider.id)}
191+
>
192+
Add Key
195193
</Button>
196-
</div>
194+
)}
197195
</div>
198196
)
199197
})}
@@ -228,7 +226,24 @@ export function BYOK() {
228226
requests in this workspace. Your key is encrypted and stored securely.
229227
</p>
230228

231-
<div className='mt-[12px] flex flex-col gap-[8px]'>
229+
<div className='mt-[16px] flex flex-col gap-[8px]'>
230+
<p className='font-medium text-[13px] text-[var(--text-secondary)]'>
231+
Enter your API key
232+
</p>
233+
{/* Hidden decoy fields to prevent browser autofill */}
234+
<input
235+
type='text'
236+
name='fakeusernameremembered'
237+
autoComplete='username'
238+
style={{
239+
position: 'absolute',
240+
left: '-9999px',
241+
opacity: 0,
242+
pointerEvents: 'none',
243+
}}
244+
tabIndex={-1}
245+
readOnly
246+
/>
232247
<div className='relative'>
233248
<EmcnInput
234249
type={showApiKey ? 'text' : 'password'}
@@ -240,6 +255,12 @@ export function BYOK() {
240255
placeholder={PROVIDERS.find((p) => p.id === editingProvider)?.placeholder}
241256
className='h-9 pr-[36px]'
242257
autoFocus
258+
name='byok_api_key'
259+
autoComplete='off'
260+
autoCorrect='off'
261+
autoCapitalize='off'
262+
data-lpignore='true'
263+
data-form-type='other'
243264
/>
244265
<Button
245266
variant='ghost'
@@ -275,6 +296,7 @@ export function BYOK() {
275296
variant='primary'
276297
onClick={handleSave}
277298
disabled={!apiKeyInput.trim() || upsertKey.isPending}
299+
className='!bg-[var(--brand-tertiary-2)] !text-[var(--text-inverse)] hover:!bg-[var(--brand-tertiary-2)]/90'
278300
>
279301
{upsertKey.isPending ? 'Saving...' : 'Save'}
280302
</Button>
@@ -298,7 +320,12 @@ export function BYOK() {
298320
<Button variant='default' onClick={() => setDeleteConfirmProvider(null)}>
299321
Cancel
300322
</Button>
301-
<Button variant='primary' onClick={handleDelete} disabled={deleteKey.isPending}>
323+
<Button
324+
variant='primary'
325+
onClick={handleDelete}
326+
disabled={deleteKey.isPending}
327+
className='!bg-[var(--brand-tertiary-2)] !text-[var(--text-inverse)] hover:!bg-[var(--brand-tertiary-2)]/90'
328+
>
302329
{deleteKey.isPending ? 'Deleting...' : 'Delete'}
303330
</Button>
304331
</ModalFooter>

0 commit comments

Comments
 (0)