Skip to content

Commit 26d62fc

Browse files
committed
improvement: schedules, auto-scroll
1 parent 1628ffe commit 26d62fc

File tree

16 files changed

+91
-533
lines changed

16 files changed

+91
-533
lines changed

apps/sim/app/workspace/[workspaceId]/components/resource/resource.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ResourceOptionsBar } from './components/resource-options-bar'
1313
export interface ResourceColumn {
1414
id: string
1515
header: string
16+
widthMultiplier?: number
1617
}
1718

1819
export interface ResourceCell {
@@ -426,7 +427,14 @@ function ResourceColGroup({
426427
<colgroup>
427428
{hasCheckbox && <col className='w-[52px]' />}
428429
{columns.map((col, colIdx) => (
429-
<col key={col.id} className={colIdx === 0 ? 'min-w-[200px]' : 'w-[160px]'} />
430+
<col
431+
key={col.id}
432+
style={
433+
colIdx === 0
434+
? { minWidth: 200 * (col.widthMultiplier ?? 1) }
435+
: { width: 160 * (col.widthMultiplier ?? 1) }
436+
}
437+
/>
430438
))}
431439
</colgroup>
432440
)

apps/sim/app/workspace/[workspaceId]/home/hooks/use-auto-scroll.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export function useAutoScroll(isStreaming: boolean) {
9797
el.removeEventListener('scroll', onScroll)
9898
observer.disconnect()
9999
cancelAnimationFrame(rafIdRef.current)
100+
if (stickyRef.current) scrollToBottom()
100101
}
101102
}, [isStreaming, scrollToBottom])
102103

apps/sim/app/workspace/[workspaceId]/schedules/components/create-schedule-modal/index.ts renamed to apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/create-schedule-modal/index.ts

File renamed without changes.

apps/sim/app/workspace/[workspaceId]/schedules/components/create-schedule-modal/schedule-modal.tsx renamed to apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/create-schedule-modal/schedule-modal.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,18 +306,17 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
306306
} catch (error: unknown) {
307307
logger.error('Schedule submission failed:', { error })
308308
setSubmitError(
309-
error instanceof Error ? error.message : 'Failed to save schedule. Please try again.'
309+
error instanceof Error ? error.message : 'Failed to save scheduled task. Please try again.'
310310
)
311311
}
312312
}
313313

314314
return (
315315
<Modal open={open} onOpenChange={onOpenChange}>
316316
<ModalContent size='lg'>
317-
<ModalHeader>{isEditing ? 'Edit schedule' : 'Create new schedule'}</ModalHeader>
317+
<ModalHeader>{isEditing ? 'Edit scheduled task' : 'Create new scheduled task'}</ModalHeader>
318318
<ModalBody>
319319
<div className='flex flex-col gap-[18px]'>
320-
{/* Title */}
321320
<div className='flex flex-col gap-[8px]'>
322321
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>Title</p>
323322
<EmcnInput
@@ -333,7 +332,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
333332
/>
334333
</div>
335334

336-
{/* Prompt */}
337335
<div className='flex flex-col gap-[8px]'>
338336
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>
339337
Task description
@@ -349,7 +347,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
349347
/>
350348
</div>
351349

352-
{/* Schedule Type */}
353350
<div className='flex flex-col gap-[8px]'>
354351
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>Run frequency</p>
355352
<Combobox
@@ -360,7 +357,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
360357
/>
361358
</div>
362359

363-
{/* Conditional schedule fields */}
364360
{scheduleType === 'minutes' && (
365361
<div className='flex flex-col gap-[8px]'>
366362
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>
@@ -455,7 +451,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
455451
</div>
456452
)}
457453

458-
{/* Timezone */}
459454
{showTimezone && (
460455
<div className='flex flex-col gap-[8px]'>
461456
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>Timezone</p>
@@ -484,7 +479,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
484479
</div>
485480
)}
486481

487-
{/* Lifecycle */}
488482
<div className='flex flex-col gap-[8px]'>
489483
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>Lifecycle</p>
490484
<ButtonGroup
@@ -496,7 +490,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
496490
</ButtonGroup>
497491
</div>
498492

499-
{/* Max Runs */}
500493
{lifecycle === 'until_complete' && (
501494
<div className='flex flex-col gap-[8px]'>
502495
<p className='font-medium text-[14px] text-[var(--text-secondary)]'>
@@ -514,7 +507,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
514507
</div>
515508
)}
516509

517-
{/* Schedule Preview */}
518510
{computedCron && schedulePreview && (
519511
<div>
520512
{'error' in schedulePreview ? (
@@ -538,7 +530,6 @@ export function ScheduleModal({ open, onOpenChange, workspaceId, schedule }: Sch
538530
</div>
539531
)}
540532

541-
{/* Error */}
542533
{submitError && (
543534
<p className='text-[13px] text-[var(--text-error)] leading-tight'>{submitError}</p>
544535
)}

apps/sim/app/workspace/[workspaceId]/schedules/components/schedule-context-menu/index.ts renamed to apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/schedule-context-menu/index.ts

File renamed without changes.

apps/sim/app/workspace/[workspaceId]/schedules/components/schedule-context-menu/schedule-context-menu.tsx renamed to apps/sim/app/workspace/[workspaceId]/scheduled-tasks/components/schedule-context-menu/schedule-context-menu.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ interface ScheduleContextMenuProps {
1313
position: { x: number; y: number }
1414
menuRef: React.RefObject<HTMLDivElement | null>
1515
onClose: () => void
16-
isJob: boolean
1716
isActive: boolean
1817
onEdit?: () => void
1918
onPause?: () => void
@@ -26,7 +25,6 @@ export function ScheduleContextMenu({
2625
position,
2726
menuRef,
2827
onClose,
29-
isJob,
3028
isActive,
3129
onEdit,
3230
onPause,
@@ -50,7 +48,7 @@ export function ScheduleContextMenu({
5048
}}
5149
/>
5250
<PopoverContent ref={menuRef} align='start' side='bottom' sideOffset={4}>
53-
{isJob && onEdit && (
51+
{onEdit && (
5452
<PopoverItem
5553
onClick={() => {
5654
onEdit()
@@ -60,7 +58,7 @@ export function ScheduleContextMenu({
6058
Edit
6159
</PopoverItem>
6260
)}
63-
{isJob && onEdit && <PopoverDivider />}
61+
{onEdit && <PopoverDivider />}
6462
{isActive && onPause && (
6563
<PopoverItem
6664
onClick={() => {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function ScheduledTasksLayout({ children }: { children: React.ReactNode }) {
2+
return <div className='flex h-full flex-1 flex-col overflow-hidden'>{children}</div>
3+
}

apps/sim/app/workspace/[workspaceId]/schedules/page.tsx renamed to apps/sim/app/workspace/[workspaceId]/scheduled-tasks/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import type { Metadata } from 'next'
22
import { redirect } from 'next/navigation'
33
import { getSession } from '@/lib/auth'
44
import { verifyWorkspaceMembership } from '@/app/api/workflows/utils'
5-
import { Schedules } from './schedules'
5+
import { ScheduledTasks } from './scheduled-tasks'
66

77
export const metadata: Metadata = {
8-
title: 'Schedules',
8+
title: 'Scheduled Tasks',
99
}
1010

11-
interface SchedulesPageProps {
11+
interface ScheduledTasksPageProps {
1212
params: Promise<{
1313
workspaceId: string
1414
}>
1515
}
1616

17-
export default async function SchedulesPage({ params }: SchedulesPageProps) {
17+
export default async function ScheduledTasksPage({ params }: ScheduledTasksPageProps) {
1818
const { workspaceId } = await params
1919
const session = await getSession()
2020

@@ -27,5 +27,5 @@ export default async function SchedulesPage({ params }: SchedulesPageProps) {
2727
redirect('/')
2828
}
2929

30-
return <Schedules />
30+
return <ScheduledTasks />
3131
}

0 commit comments

Comments
 (0)