Skip to content

Commit c70c32a

Browse files
authored
fix(settings-ui): fix settings ui, add upload status (#1691)
1 parent cc0ace7 commit c70c32a

File tree

7 files changed

+58
-45
lines changed

7 files changed

+58
-45
lines changed

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

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export function Copilot() {
238238
<div className='relative flex h-full flex-col'>
239239
{/* Sticky Header with API Keys (only for hosted) */}
240240
{isHosted && (
241-
<div className='sticky top-0 z-10 border-b bg-background px-6 py-4'>
241+
<div className='sticky top-0 z-10 bg-background px-6 py-4'>
242242
<div className='space-y-3'>
243243
{/* API Keys Header */}
244244
<div className='flex items-center justify-between'>
@@ -273,27 +273,25 @@ export function Copilot() {
273273
</div>
274274
) : (
275275
keys.map((k) => (
276-
<div
277-
key={k.id}
278-
className='flex items-center justify-between gap-4 rounded-lg border bg-muted/30 px-3 py-2'
279-
>
280-
<div className='flex min-w-0 items-center gap-3'>
281-
<code className='truncate font-mono text-foreground text-xs'>
282-
{k.displayKey}
283-
</code>
276+
<div key={k.id} className='flex flex-col gap-2'>
277+
<div className='flex items-center justify-between gap-4'>
278+
<div className='flex items-center gap-3'>
279+
<div className='flex h-8 items-center rounded-[8px] bg-muted px-3'>
280+
<code className='font-mono text-foreground text-xs'>{k.displayKey}</code>
281+
</div>
282+
</div>
283+
<Button
284+
variant='ghost'
285+
size='sm'
286+
onClick={() => {
287+
setDeleteKey(k)
288+
setShowDeleteDialog(true)
289+
}}
290+
className='h-8 text-muted-foreground hover:text-foreground'
291+
>
292+
Delete
293+
</Button>
284294
</div>
285-
286-
<Button
287-
variant='ghost'
288-
size='sm'
289-
onClick={() => {
290-
setDeleteKey(k)
291-
setShowDeleteDialog(true)
292-
}}
293-
className='h-7 flex-shrink-0 text-muted-foreground text-xs hover:text-foreground'
294-
>
295-
Delete
296-
</Button>
297295
</div>
298296
))
299297
)}
@@ -308,15 +306,6 @@ export function Copilot() {
308306
{/* Models Header */}
309307
<div>
310308
<h3 className='font-semibold text-foreground text-sm'>Models</h3>
311-
<div className='text-muted-foreground text-xs'>
312-
{isModelsLoading ? (
313-
<Skeleton className='mt-0.5 h-3 w-32' />
314-
) : (
315-
<span>
316-
{enabledCount} of {totalCount} enabled
317-
</span>
318-
)}
319-
</div>
320309
</div>
321310

322311
{/* Models List */}
@@ -473,9 +462,13 @@ export function Copilot() {
473462

474463
function CopilotKeySkeleton() {
475464
return (
476-
<div className='flex items-center justify-between gap-4 rounded-lg border bg-muted/30 px-3 py-2'>
477-
<Skeleton className='h-4 w-48' />
478-
<Skeleton className='h-7 w-14' />
465+
<div className='flex flex-col gap-2'>
466+
<div className='flex items-center justify-between gap-4'>
467+
<div className='flex items-center gap-3'>
468+
<Skeleton className='h-8 w-20 rounded-[8px]' />
469+
</div>
470+
<Skeleton className='h-8 w-14' />
471+
</div>
479472
</div>
480473
)
481474
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,15 +707,18 @@ export function EnvironmentVariables({
707707
</AlertDialogDescription>
708708
</AlertDialogHeader>
709709
<AlertDialogFooter className='flex'>
710-
<AlertDialogCancel onClick={handleCancel} className='h-9 w-full rounded-[8px]'>
710+
<AlertDialogCancel
711+
onClick={handleCancel}
712+
className='h-9 w-full rounded-[8px] bg-red-500 text-white transition-all duration-200 hover:bg-red-600 dark:bg-red-500 dark:hover:bg-red-600'
713+
>
711714
Discard Changes
712715
</AlertDialogCancel>
713716
{hasConflicts ? (
714717
<Tooltip>
715718
<TooltipTrigger asChild>
716719
<AlertDialogAction
717720
disabled={true}
718-
className='h-9 w-full cursor-not-allowed rounded-[8px] opacity-50 transition-all duration-200'
721+
className='h-9 w-full cursor-not-allowed rounded-[8px] bg-primary text-white opacity-50 transition-all duration-200'
719722
>
720723
Save Changes
721724
</AlertDialogAction>
@@ -725,7 +728,7 @@ export function EnvironmentVariables({
725728
) : (
726729
<AlertDialogAction
727730
onClick={handleSave}
728-
className='h-9 w-full rounded-[8px] transition-all duration-200'
731+
className='h-9 w-full rounded-[8px] bg-primary text-white transition-all duration-200 hover:bg-primary/90'
729732
>
730733
Save Changes
731734
</AlertDialogAction>

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { useEffect, useMemo, useRef, useState } from 'react'
4-
import { Download, Search, Trash2, Upload } from 'lucide-react'
4+
import { Download, Search, Trash2 } from 'lucide-react'
55
import { useParams } from 'next/navigation'
66
import { Input } from '@/components/ui'
77
import { Button } from '@/components/ui/button'
@@ -46,6 +46,7 @@ export function FileUploads() {
4646
const [uploading, setUploading] = useState(false)
4747
const [deletingFileId, setDeletingFileId] = useState<string | null>(null)
4848
const [uploadError, setUploadError] = useState<string | null>(null)
49+
const [uploadProgress, setUploadProgress] = useState({ completed: 0, total: 0 })
4950
const fileInputRef = useRef<HTMLInputElement>(null)
5051

5152
const { permissions: workspacePermissions, loading: permissionsLoading } =
@@ -94,9 +95,12 @@ export function FileUploads() {
9495
if (!ok) unsupported.push(f.name)
9596
return ok
9697
})
98+
99+
setUploadProgress({ completed: 0, total: allowedFiles.length })
97100
let lastError: string | null = null
98101

99-
for (const selectedFile of allowedFiles) {
102+
for (let i = 0; i < allowedFiles.length; i++) {
103+
const selectedFile = allowedFiles[i]
100104
try {
101105
const formData = new FormData()
102106
formData.append('file', selectedFile)
@@ -109,6 +113,8 @@ export function FileUploads() {
109113
const data = await response.json()
110114
if (!data.success) {
111115
lastError = data.error || 'Upload failed'
116+
} else {
117+
setUploadProgress({ completed: i + 1, total: allowedFiles.length })
112118
}
113119
} catch (err) {
114120
logger.error('Error uploading file:', err)
@@ -127,6 +133,7 @@ export function FileUploads() {
127133
setTimeout(() => setUploadError(null), 5000)
128134
} finally {
129135
setUploading(false)
136+
setUploadProgress({ completed: 0, total: 0 })
130137
if (fileInputRef.current) {
131138
fileInputRef.current.value = ''
132139
}
@@ -225,15 +232,19 @@ export function FileUploads() {
225232
onChange={handleFileChange}
226233
disabled={uploading}
227234
accept={ACCEPT_ATTR}
235+
multiple
228236
/>
229237
<Button
230238
onClick={handleUploadClick}
231239
disabled={uploading}
232240
variant='ghost'
233241
className='h-9 rounded-[8px] border bg-background px-3 shadow-xs hover:bg-muted focus:outline-none focus-visible:ring-0 focus-visible:ring-offset-0'
234242
>
235-
<Upload className='mr-2 h-4 w-4 stroke-[2px]' />
236-
{uploading ? 'Uploading...' : 'Upload File'}
243+
{uploading && uploadProgress.total > 0
244+
? `Uploading ${uploadProgress.completed}/${uploadProgress.total}...`
245+
: uploading
246+
? 'Uploading...'
247+
: 'Upload File'}
237248
</Button>
238249
</div>
239250
)}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export function SettingsNavigation({
203203

204204
return (
205205
<div className='flex h-full flex-col'>
206-
<div className='flex-1 px-2 py-4'>
206+
<div className='flex-1 overflow-y-auto px-2 py-4'>
207207
{navigationItems.map((item) => (
208208
<div key={item.id} className='mb-1'>
209209
<button

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ export function CancelSubscription({ subscription, subscriptionData }: CancelSub
235235
? 'Your subscription is set to cancel at the end of the billing period. You can reactivate it or manage other settings.'
236236
: `You'll be redirected to Stripe to manage your subscription. You'll keep access until ${formatDate(
237237
periodEndDate
238-
)}, then downgrade to free plan.`}
238+
)}, then downgrade to free plan.`}{' '}
239+
{!isCancelAtPeriodEnd && (
240+
<span className='text-red-500 dark:text-red-500'>
241+
This action cannot be undone.
242+
</span>
243+
)}
239244
</AlertDialogDescription>
240245
</AlertDialogHeader>
241246

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/components/remove-member-dialog/remove-member-dialog.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export function RemoveMemberDialog({
3737
<DialogDescription>
3838
{isSelfRemoval
3939
? 'Are you sure you want to leave this organization? You will lose access to all team resources.'
40-
: `Are you sure you want to remove ${memberName} from the team?`}
40+
: `Are you sure you want to remove ${memberName} from the team?`}{' '}
41+
<span className='text-red-500 dark:text-red-500'>This action cannot be undone.</span>
4142
</DialogDescription>
4243
</DialogHeader>
4344

@@ -68,7 +69,7 @@ export function RemoveMemberDialog({
6869
<Button
6970
variant='destructive'
7071
onClick={() => onConfirmRemove(shouldReduceSeats)}
71-
className='h-9 rounded-[8px]'
72+
className='h-9 rounded-[8px] bg-red-500 text-white transition-all duration-200 hover:bg-red-600 dark:bg-red-500 dark:hover:bg-red-600'
7273
>
7374
{isSelfRemoval ? 'Leave Organization' : 'Remove'}
7475
</Button>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ export function TeamMembers({
279279
}
280280
onRemoveMember(currentUserMember)
281281
}}
282-
className='w-full text-red-600 hover:bg-red-50 hover:text-red-700 dark:hover:bg-red-950/20'
282+
className='w-full hover:bg-muted'
283283
>
284284
<LogOut className='mr-2 h-4 w-4' />
285285
Leave Organization

0 commit comments

Comments
 (0)