Skip to content

Commit e589aa1

Browse files
committed
standardized all modals
1 parent e87f2fa commit e589aa1

File tree

10 files changed

+100
-28
lines changed

10 files changed

+100
-28
lines changed

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/delete-chunk-modal/delete-chunk-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function DeleteChunkModal({
7777
</p>
7878
</ModalBody>
7979
<ModalFooter>
80-
<Button variant='active' disabled={isDeleting} onClick={onClose}>
80+
<Button variant='default' disabled={isDeleting} onClick={onClose}>
8181
Cancel
8282
</Button>
8383
<Button variant='destructive' onClick={handleDeleteChunk} disabled={isDeleting}>

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,15 +1161,19 @@ export function Document({
11611161
<ModalHeader>Delete Document</ModalHeader>
11621162
<ModalBody>
11631163
<p className='text-[12px] text-[var(--text-secondary)]'>
1164-
Are you sure you want to delete "{effectiveDocumentName}"? This will permanently
1165-
delete the document and all {documentData?.chunkCount ?? 0} chunk
1164+
Are you sure you want to delete{' '}
1165+
<span className='font-medium text-[var(--text-primary)]'>
1166+
{effectiveDocumentName}
1167+
</span>
1168+
? This will permanently delete the document and all {documentData?.chunkCount ?? 0}{' '}
1169+
chunk
11661170
{documentData?.chunkCount === 1 ? '' : 's'} within it.{' '}
11671171
<span className='text-[var(--text-error)]'>This action cannot be undone.</span>
11681172
</p>
11691173
</ModalBody>
11701174
<ModalFooter>
11711175
<Button
1172-
variant='active'
1176+
variant='default'
11731177
onClick={() => setShowDeleteDocumentDialog(false)}
11741178
disabled={isDeletingDocument}
11751179
>

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,15 +1523,16 @@ export function KnowledgeBase({
15231523
<ModalHeader>Delete Knowledge Base</ModalHeader>
15241524
<ModalBody>
15251525
<p className='text-[12px] text-[var(--text-secondary)]'>
1526-
Are you sure you want to delete "{knowledgeBaseName}"? This will permanently delete
1527-
the knowledge base and all {pagination.total} document
1526+
Are you sure you want to delete{' '}
1527+
<span className='font-medium text-[var(--text-primary)]'>{knowledgeBaseName}</span>?
1528+
This will permanently delete the knowledge base and all {pagination.total} document
15281529
{pagination.total === 1 ? '' : 's'} within it.{' '}
15291530
<span className='text-[var(--text-error)]'>This action cannot be undone.</span>
15301531
</p>
15311532
</ModalBody>
15321533
<ModalFooter>
15331534
<Button
1534-
variant='active'
1535+
variant='default'
15351536
onClick={() => setShowDeleteDialog(false)}
15361537
disabled={isDeleting}
15371538
>
@@ -1549,14 +1550,16 @@ export function KnowledgeBase({
15491550
<ModalHeader>Delete Document</ModalHeader>
15501551
<ModalBody>
15511552
<p className='text-[12px] text-[var(--text-secondary)]'>
1552-
Are you sure you want to delete "
1553-
{documents.find((doc) => doc.id === documentToDelete)?.filename ?? 'this document'}"?{' '}
1554-
<span className='text-[var(--text-error)]'>This action cannot be undone.</span>
1553+
Are you sure you want to delete{' '}
1554+
<span className='font-medium text-[var(--text-primary)]'>
1555+
{documents.find((doc) => doc.id === documentToDelete)?.filename ?? 'this document'}
1556+
</span>
1557+
? <span className='text-[var(--text-error)]'>This action cannot be undone.</span>
15551558
</p>
15561559
</ModalBody>
15571560
<ModalFooter>
15581561
<Button
1559-
variant='active'
1562+
variant='default'
15601563
onClick={() => {
15611564
setShowDeleteDocumentModal(false)
15621565
setDocumentToDelete(null)
@@ -1582,7 +1585,7 @@ export function KnowledgeBase({
15821585
</p>
15831586
</ModalBody>
15841587
<ModalFooter>
1585-
<Button variant='active' onClick={() => setShowBulkDeleteModal(false)}>
1588+
<Button variant='default' onClick={() => setShowBulkDeleteModal(false)}>
15861589
Cancel
15871590
</Button>
15881591
<Button variant='destructive' onClick={confirmBulkDelete} disabled={isBulkOperating}>

apps/sim/app/workspace/[workspaceId]/knowledge/components/delete-knowledge-base-modal/delete-knowledge-base-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function DeleteKnowledgeBaseModal({
5555
</p>
5656
</ModalBody>
5757
<ModalFooter>
58-
<Button variant='active' onClick={onClose} disabled={isDeleting}>
58+
<Button variant='default' onClick={onClose} disabled={isDeleting}>
5959
Cancel
6060
</Button>
6161
<Button variant='destructive' onClick={onConfirm} disabled={isDeleting}>

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,17 @@ export function Panel() {
556556
<ModalHeader>Delete Workflow</ModalHeader>
557557
<ModalBody>
558558
<p className='text-[12px] text-[var(--text-secondary)]'>
559-
Deleting this workflow will permanently remove all associated blocks, executions, and
560-
configuration.{' '}
559+
Are you sure you want to delete{' '}
560+
<span className='font-medium text-[var(--text-primary)]'>
561+
{currentWorkflow?.name ?? 'this workflow'}
562+
</span>
563+
? This will permanently remove all associated blocks, executions, and configuration.{' '}
561564
<span className='text-[var(--text-error)]'>This action cannot be undone.</span>
562565
</p>
563566
</ModalBody>
564567
<ModalFooter>
565568
<Button
566-
variant='active'
569+
variant='default'
567570
onClick={() => setIsDeleteModalOpen(false)}
568571
disabled={isDeleting}
569572
>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export function CancelSubscription({ subscription, subscriptionData }: CancelSub
266266
</ModalBody>
267267
<ModalFooter>
268268
<Button
269-
variant='active'
269+
variant='default'
270270
onClick={isCancelAtPeriodEnd ? () => setIsDialogOpen(false) : handleKeep}
271271
disabled={isLoading}
272272
>

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ export function RemoveMemberDialog({
3737
<ModalHeader>{isSelfRemoval ? 'Leave Organization' : 'Remove Team Member'}</ModalHeader>
3838
<ModalBody>
3939
<p className='text-[12px] text-[var(--text-secondary)]'>
40-
{isSelfRemoval
41-
? 'Are you sure you want to leave this organization? You will lose access to all team resources.'
42-
: `Are you sure you want to remove ${memberName} from the team?`}{' '}
40+
{isSelfRemoval ? (
41+
'Are you sure you want to leave this organization? You will lose access to all team resources.'
42+
) : (
43+
<>
44+
Are you sure you want to remove{' '}
45+
<span className='font-medium text-[var(--text-primary)]'>{memberName}</span> from
46+
the team?
47+
</>
48+
)}{' '}
4349
<span className='text-[var(--text-error)]'>This action cannot be undone.</span>
4450
</p>
4551

@@ -71,7 +77,7 @@ export function RemoveMemberDialog({
7177
)}
7278
</ModalBody>
7379
<ModalFooter>
74-
<Button variant='active' onClick={onCancel}>
80+
<Button variant='default' onClick={onCancel}>
7581
Cancel
7682
</Button>
7783
<Button variant='destructive' onClick={() => onConfirmRemove(shouldReduceSeats)}>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/delete-modal/delete-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function DeleteModal({
111111
</p>
112112
</ModalBody>
113113
<ModalFooter>
114-
<Button variant='active' onClick={onClose} disabled={isDeleting}>
114+
<Button variant='default' onClick={onClose} disabled={isDeleting}>
115115
Cancel
116116
</Button>
117117
<Button variant='destructive' onClick={onConfirm} disabled={isDeleting}>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/invite-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ export function InviteModal({ open, onOpenChange, workspaceName }: InviteModalPr
740740

741741
{/* Remove Member Confirmation Dialog */}
742742
<Modal open={!!memberToRemove} onOpenChange={handleRemoveMemberCancel}>
743-
<ModalContent>
743+
<ModalContent className='w-[400px]'>
744744
<ModalHeader>Remove Member</ModalHeader>
745745
<ModalBody>
746746
<p className='text-[12px] text-[var(--text-secondary)]'>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import {
77
Badge,
88
Button,
99
ChevronDown,
10+
Modal,
11+
ModalBody,
12+
ModalContent,
13+
ModalFooter,
14+
ModalHeader,
1015
PanelLeft,
1116
Popover,
1217
PopoverContent,
@@ -143,6 +148,9 @@ export function WorkspaceHeader({
143148
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)
144149
const [isDeleting, setIsDeleting] = useState(false)
145150
const [deleteTarget, setDeleteTarget] = useState<Workspace | null>(null)
151+
const [isLeaveModalOpen, setIsLeaveModalOpen] = useState(false)
152+
const [isLeaving, setIsLeaving] = useState(false)
153+
const [leaveTarget, setLeaveTarget] = useState<Workspace | null>(null)
146154
const [editingWorkspaceId, setEditingWorkspaceId] = useState<string | null>(null)
147155
const [editingName, setEditingName] = useState('')
148156
const [isListRenaming, setIsListRenaming] = useState(false)
@@ -278,13 +286,35 @@ export function WorkspaceHeader({
278286
}
279287

280288
/**
281-
* Handles leave action from context menu
289+
* Handles leave action from context menu - shows confirmation modal
282290
*/
283-
const handleLeaveAction = async () => {
284-
if (!capturedWorkspaceRef.current || !onLeaveWorkspace) return
291+
const handleLeaveAction = () => {
292+
if (!capturedWorkspaceRef.current) return
285293

286-
await onLeaveWorkspace(capturedWorkspaceRef.current.id)
287-
setIsWorkspaceMenuOpen(false)
294+
const workspace = workspaces.find((w) => w.id === capturedWorkspaceRef.current?.id)
295+
if (workspace) {
296+
setLeaveTarget(workspace)
297+
setIsLeaveModalOpen(true)
298+
setIsWorkspaceMenuOpen(false)
299+
}
300+
}
301+
302+
/**
303+
* Handle leave workspace after confirmation
304+
*/
305+
const handleLeaveWorkspace = async () => {
306+
if (!leaveTarget || !onLeaveWorkspace) return
307+
308+
setIsLeaving(true)
309+
try {
310+
await onLeaveWorkspace(leaveTarget.id)
311+
setIsLeaveModalOpen(false)
312+
setLeaveTarget(null)
313+
} catch (error) {
314+
logger.error('Error leaving workspace:', error)
315+
} finally {
316+
setIsLeaving(false)
317+
}
288318
}
289319

290320
/**
@@ -573,6 +603,32 @@ export function WorkspaceHeader({
573603
itemType='workspace'
574604
itemName={deleteTarget?.name || activeWorkspaceFull?.name || activeWorkspace?.name}
575605
/>
606+
{/* Leave Confirmation Modal */}
607+
<Modal open={isLeaveModalOpen} onOpenChange={() => setIsLeaveModalOpen(false)}>
608+
<ModalContent className='w-[400px]'>
609+
<ModalHeader>Leave Workspace</ModalHeader>
610+
<ModalBody>
611+
<p className='text-[12px] text-[var(--text-secondary)]'>
612+
Are you sure you want to leave{' '}
613+
<span className='font-medium text-[var(--text-primary)]'>{leaveTarget?.name}</span>?
614+
You will lose access to all workflows and data in this workspace.{' '}
615+
<span className='text-[var(--text-error)]'>This action cannot be undone.</span>
616+
</p>
617+
</ModalBody>
618+
<ModalFooter>
619+
<Button
620+
variant='default'
621+
onClick={() => setIsLeaveModalOpen(false)}
622+
disabled={isLeaving}
623+
>
624+
Cancel
625+
</Button>
626+
<Button variant='destructive' onClick={handleLeaveWorkspace} disabled={isLeaving}>
627+
{isLeaving ? 'Leaving...' : 'Leave Workspace'}
628+
</Button>
629+
</ModalFooter>
630+
</ModalContent>
631+
</Modal>
576632
</div>
577633
)
578634
}

0 commit comments

Comments
 (0)