From 2ebfb576ae96fc3455115f469ef7afe139a49aaf Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 21 Aug 2025 21:29:20 -0700 Subject: [PATCH] fix(day-picker): remove unused react-day-picker (#1094) --- .../sub-block/components/date-input.tsx | 73 ------------------- .../components/sub-block/components/index.ts | 1 - .../components/tool-input/tool-input.tsx | 40 ---------- .../components/sub-block/sub-block.tsx | 12 --- apps/sim/blocks/types.ts | 1 - apps/sim/components/ui/calendar.tsx | 62 ---------------- apps/sim/components/ui/index.ts | 1 - apps/sim/package.json | 1 - bun.lock | 5 +- 9 files changed, 1 insertion(+), 195 deletions(-) delete mode 100644 apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/date-input.tsx delete mode 100644 apps/sim/components/ui/calendar.tsx diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/date-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/date-input.tsx deleted file mode 100644 index 7ba477647..000000000 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/date-input.tsx +++ /dev/null @@ -1,73 +0,0 @@ -'use client' - -import * as React from 'react' -import { format } from 'date-fns' -import { Calendar as CalendarIcon } from 'lucide-react' -import { Button } from '@/components/ui/button' -import { Calendar } from '@/components/ui/calendar' -import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' -import { cn } from '@/lib/utils' -import { useSubBlockValue } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/hooks/use-sub-block-value' - -interface DateInputProps { - blockId: string - subBlockId: string - placeholder?: string - isPreview?: boolean - previewValue?: string | null - disabled?: boolean -} - -export function DateInput({ - blockId, - subBlockId, - placeholder, - isPreview = false, - previewValue, - disabled = false, -}: DateInputProps) { - const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlockId) - - // Use preview value when in preview mode, otherwise use store value - const value = isPreview ? previewValue : storeValue - const date = value ? new Date(value) : undefined - - const isPastDate = React.useMemo(() => { - if (!date) return false - const today = new Date() - today.setHours(0, 0, 0, 0) - return date < today - }, [date]) - - const handleDateSelect = (selectedDate: Date | undefined) => { - if (isPreview || disabled) return - - if (selectedDate) { - const today = new Date() - today.setHours(0, 0, 0, 0) - } - setStoreValue(selectedDate?.toISOString() || '') - } - - return ( - - - - - - - - - ) -} diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/index.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/index.ts index 22aa0ef4b..a5fc85401 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/index.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/index.ts @@ -4,7 +4,6 @@ export { Code } from './code' export { ComboBox } from './combobox' export { ConditionInput } from './condition-input' export { CredentialSelector } from './credential-selector/credential-selector' -export { DateInput } from './date-input' export { DocumentSelector } from './document-selector/document-selector' export { Dropdown } from './dropdown' export { EvalInput } from './eval-input' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/tool-input/tool-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/tool-input/tool-input.tsx index f52473cad..42034514b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/tool-input/tool-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/tool-input/tool-input.tsx @@ -20,7 +20,6 @@ import { CheckboxList, Code, ComboBox, - DateInput, FileSelectorInput, FileUpload, LongInput, @@ -172,33 +171,6 @@ function TableSyncWrapper({ ) } -function DateInputSyncWrapper({ - blockId, - paramId, - value, - onChange, - uiComponent, - disabled, -}: { - blockId: string - paramId: string - value: string - onChange: (value: string) => void - uiComponent: any - disabled: boolean -}) { - return ( - - - - ) -} - function TimeInputSyncWrapper({ blockId, paramId, @@ -1159,18 +1131,6 @@ export function ToolInput({ /> ) - case 'date-input': - return ( - - ) - case 'time-input': return ( ) - case 'date-input': - return ( - - ) case 'time-input': return ( - -function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) { - return ( - ( - - ), - IconRight: ({ className, ...props }) => ( - - ), - }} - {...props} - /> - ) -} -Calendar.displayName = 'Calendar' - -export { Calendar } diff --git a/apps/sim/components/ui/index.ts b/apps/sim/components/ui/index.ts index be4c83fef..2465e521f 100644 --- a/apps/sim/components/ui/index.ts +++ b/apps/sim/components/ui/index.ts @@ -22,7 +22,6 @@ export { BreadcrumbSeparator, } from './breadcrumb' export { Button, buttonVariants } from './button' -export { Calendar } from './calendar' export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './card' export { Checkbox } from './checkbox' export { CodeBlock } from './code-block' diff --git a/apps/sim/package.json b/apps/sim/package.json index 47f28c476..2ae444d90 100644 --- a/apps/sim/package.json +++ b/apps/sim/package.json @@ -105,7 +105,6 @@ "prismjs": "^1.30.0", "react": "19.1.0", "react-colorful": "5.6.1", - "react-day-picker": "8.10.1", "react-dom": "19.1.0", "react-google-drive-picker": "^1.2.2", "react-hook-form": "^7.54.2", diff --git a/bun.lock b/bun.lock index 461b71519..efad3b979 100644 --- a/bun.lock +++ b/bun.lock @@ -134,7 +134,6 @@ "prismjs": "^1.30.0", "react": "19.1.0", "react-colorful": "5.6.1", - "react-day-picker": "8.10.1", "react-dom": "19.1.0", "react-google-drive-picker": "^1.2.2", "react-hook-form": "^7.54.2", @@ -2688,8 +2687,6 @@ "react-colorful": ["react-colorful@5.6.1", "", { "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw=="], - "react-day-picker": ["react-day-picker@8.10.1", "", { "peerDependencies": { "date-fns": "^2.28.0 || ^3.0.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, "sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA=="], - "react-dom": ["react-dom@19.1.0", "", { "dependencies": { "scheduler": "^0.26.0" }, "peerDependencies": { "react": "^19.1.0" } }, "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g=="], "react-email": ["react-email@4.2.8", "", { "dependencies": { "@babel/parser": "^7.27.0", "@babel/traverse": "^7.27.0", "chalk": "^5.0.0", "chokidar": "^4.0.3", "commander": "^13.0.0", "debounce": "^2.0.0", "esbuild": "^0.25.0", "glob": "^11.0.0", "jiti": "2.4.2", "log-symbols": "^7.0.0", "mime-types": "^3.0.0", "normalize-path": "^3.0.0", "nypm": "0.6.0", "ora": "^8.0.0", "prompts": "2.4.2", "socket.io": "^4.8.1", "tsconfig-paths": "4.2.0" }, "bin": { "email": "dist/index.js" } }, "sha512-Eqzs/xZnS881oghPO/4CQ1cULyESuUhEjfYboXmYNOokXnJ6QP5GKKJZ6zjkg9SnKXxSrIxSo5PxzCI5jReJMA=="], @@ -4444,4 +4441,4 @@ "lint-staged/listr2/log-update/cli-cursor/restore-cursor/onetime": ["onetime@7.0.0", "", { "dependencies": { "mimic-function": "^5.0.0" } }, "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ=="], } -} \ No newline at end of file +}