Skip to content

Commit fe2070a

Browse files
Copilothotlong
andcommitted
fix: address code review feedback
- Remove 'as any' cast in EmbeddableForm, use proper FormField[] type - Fix file extension edge case for files without extensions in FileField - Rename KanbanColumnComponent to KanbanColumnView for consistency Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 41eb2b9 commit fe2070a

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

packages/fields/src/widgets/FileField.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ export function FileField({ value, onChange, field, readonly, ...props }: FieldW
7575
if (accept) {
7676
const acceptedTypes = accept.split(',').map(t => t.trim().toLowerCase());
7777
const filtered = droppedFiles.filter(file => {
78-
const ext = '.' + file.name.split('.').pop()?.toLowerCase();
78+
const parts = file.name.split('.');
79+
const ext = parts.length > 1 ? '.' + parts.pop()?.toLowerCase() : '';
7980
return acceptedTypes.some(t =>
80-
t === file.type || t === ext || (t.endsWith('/*') && file.type.startsWith(t.replace('/*', '/')))
81+
t === file.type || (ext && t === ext) || (t.endsWith('/*') && file.type.startsWith(t.replace('/*', '/')))
8182
);
8283
});
8384
processFiles(filtered);

packages/plugin-form/src/EmbeddableForm.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222

2323
import React, { useState, useCallback, useMemo } from 'react';
24-
import type { DataSource } from '@object-ui/types';
24+
import type { DataSource, FormField } from '@object-ui/types';
2525
import { ObjectForm } from './ObjectForm';
2626

2727
export interface EmbeddableFormConfig {
@@ -36,14 +36,7 @@ export interface EmbeddableFormConfig {
3636
/** Fields to include in the form (subset of object fields) */
3737
fields?: string[];
3838
/** Custom field definitions for inline forms */
39-
customFields?: Array<{
40-
name: string;
41-
label: string;
42-
type: string;
43-
required?: boolean;
44-
placeholder?: string;
45-
options?: Array<{ label: string; value: string }>;
46-
}>;
39+
customFields?: FormField[];
4740
/** Branding configuration */
4841
branding?: {
4942
logo?: string;
@@ -214,7 +207,7 @@ export const EmbeddableForm: React.FC<EmbeddableFormProps> = ({
214207
objectName: config.objectName,
215208
mode: 'create',
216209
fields: config.fields,
217-
customFields: config.customFields as any,
210+
customFields: config.customFields,
218211
initialData,
219212
onSuccess: handleSubmit,
220213
submitLabel: submitting ? 'Submitting...' : 'Submit',

packages/plugin-kanban/src/KanbanImpl.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function QuickAddForm({ columnId, onAdd }: { columnId: string; onAdd: (columnId:
221221
)
222222
}
223223

224-
function KanbanColumnComponent({
224+
function KanbanColumnView({
225225
column,
226226
cards,
227227
onCardClick,
@@ -467,7 +467,7 @@ function KanbanBoardInner({ columns, onCardMove, onCardClick, className, dnd, qu
467467
</div>
468468
<div className={cn("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 [-webkit-overflow-scrolling:touch]", className)} role="region" aria-label="Kanban board">
469469
{boardColumns.map((column) => (
470-
<KanbanColumnComponent
470+
<KanbanColumnView
471471
key={column.id}
472472
column={column}
473473
cards={column.cards}

0 commit comments

Comments
 (0)