-
+
{truncateMiddle(file.name)}
({formatFileSize(file.size)})
@@ -468,19 +502,30 @@ export function FileUpload({
const comboboxOptions = useMemo(
() => [
{ label: 'Upload New File', value: '__upload_new__' },
- ...availableWorkspaceFiles.map((file) => ({
- label: file.name,
- value: file.id,
- })),
+ ...availableWorkspaceFiles.map((file) => {
+ const isAccepted =
+ !acceptedTypes || acceptedTypes === '*' || isFileTypeAccepted(file.type, acceptedTypes)
+ return {
+ label: file.name,
+ value: file.id,
+ disabled: !isAccepted,
+ }
+ }),
],
- [availableWorkspaceFiles]
+ [availableWorkspaceFiles, acceptedTypes]
)
const handleComboboxChange = (value: string) => {
setInputValue(value)
- const isValidOption =
- value === '__upload_new__' || availableWorkspaceFiles.some((file) => file.id === value)
+ const selectedFile = availableWorkspaceFiles.find((file) => file.id === value)
+ const isAcceptedType =
+ selectedFile &&
+ (!acceptedTypes ||
+ acceptedTypes === '*' ||
+ isFileTypeAccepted(selectedFile.type, acceptedTypes))
+
+ const isValidOption = value === '__upload_new__' || isAcceptedType
if (!isValidOption) {
return
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx
index 3799c9c5e5..7bafdc05df 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/starter/input-format.tsx
@@ -28,6 +28,7 @@ interface Field {
name: string
type?: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'files'
value?: string
+ description?: string
collapsed?: boolean
}
@@ -41,7 +42,9 @@ interface FieldFormatProps {
placeholder?: string
showType?: boolean
showValue?: boolean
+ showDescription?: boolean
valuePlaceholder?: string
+ descriptionPlaceholder?: string
config?: any
}
@@ -73,6 +76,7 @@ const createDefaultField = (): Field => ({
name: '',
type: 'string',
value: '',
+ description: '',
collapsed: false,
})
@@ -93,7 +97,9 @@ export function FieldFormat({
placeholder = 'fieldName',
showType = true,
showValue = false,
+ showDescription = false,
valuePlaceholder = 'Enter default value',
+ descriptionPlaceholder = 'Describe this field',
}: FieldFormatProps) {
const [storeValue, setStoreValue] = useSubBlockValue
(blockId, subBlockId)
const valueInputRefs = useRef>({})
@@ -554,6 +560,18 @@ export function FieldFormat({
)}
+ {showDescription && (
+