Skip to content

Commit dc2523c

Browse files
committed
improvement(emcn): modal padding, api, chat, form
1 parent 51f9380 commit dc2523c

File tree

28 files changed

+783
-386
lines changed

28 files changed

+783
-386
lines changed

apps/sim/app/api/form/utils.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ describe('Form API Utils', () => {
358358
const { DEFAULT_FORM_CUSTOMIZATIONS } = await import('@/app/api/form/utils')
359359

360360
expect(DEFAULT_FORM_CUSTOMIZATIONS).toEqual({
361-
primaryColor: '#3972F6',
362361
welcomeMessage: '',
363362
thankYouTitle: 'Thank you!',
364363
thankYouMessage: 'Your response has been submitted successfully.',

apps/sim/app/api/form/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ export interface FormCustomizations {
195195

196196
/**
197197
* Default form customizations
198+
* Note: primaryColor is intentionally undefined to allow thank you screen to use its green default
198199
*/
199200
export const DEFAULT_FORM_CUSTOMIZATIONS: FormCustomizations = {
200-
primaryColor: '#3972F6',
201201
welcomeMessage: '',
202202
thankYouTitle: 'Thank you!',
203203
thankYouMessage: 'Your response has been submitted successfully.',

apps/sim/app/form/[identifier]/components/form-field.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface FormFieldProps {
2121
primaryColor?: string
2222
label?: string
2323
description?: string
24+
required?: boolean
2425
}
2526

2627
function formatFileSize(bytes: number): string {
@@ -36,6 +37,7 @@ export function FormField({
3637
primaryColor,
3738
label,
3839
description,
40+
required,
3941
}: FormFieldProps) {
4042
const [isDragging, setIsDragging] = useState(false)
4143
const fileInputRef = useRef<HTMLInputElement>(null)
@@ -50,6 +52,7 @@ export function FormField({
5052

5153
const displayLabel = label || formatLabel(field.name)
5254
const placeholder = description || field.description || ''
55+
const isRequired = required ?? field.required
5356

5457
const handleFileDrop = useCallback(
5558
(e: React.DragEvent) => {
@@ -216,7 +219,7 @@ export function FormField({
216219
<div className='space-y-2'>
217220
<Label className={`${inter.className} font-medium text-[14px] text-foreground`}>
218221
{displayLabel}
219-
{field.required && <span className='ml-0.5 text-red-500'>*</span>}
222+
{isRequired && <span className='ml-0.5 text-[var(--text-error)]'>*</span>}
220223
</Label>
221224
{renderInput()}
222225
</div>

apps/sim/app/form/[identifier]/components/thank-you-screen.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,29 @@ interface ThankYouScreenProps {
1010
primaryColor?: string
1111
}
1212

13+
/** Default green color matching --brand-tertiary-2 */
14+
const DEFAULT_THANK_YOU_COLOR = '#32bd7e'
15+
16+
/** Legacy blue default that should be treated as "no custom color" */
17+
const LEGACY_BLUE_DEFAULT = '#3972F6'
18+
1319
export function ThankYouScreen({ title, message, primaryColor }: ThankYouScreenProps) {
20+
// Treat legacy blue default as no custom color, fall back to green
21+
const thankYouColor =
22+
primaryColor && primaryColor !== LEGACY_BLUE_DEFAULT ? primaryColor : DEFAULT_THANK_YOU_COLOR
23+
1424
return (
1525
<main className='flex flex-1 flex-col items-center justify-center p-4'>
1626
<div className='flex flex-col items-center text-center'>
1727
<div
1828
className='flex h-20 w-20 items-center justify-center rounded-full'
19-
style={{ backgroundColor: `${primaryColor}15` }}
29+
style={{ backgroundColor: `${thankYouColor}15` }}
2030
>
21-
<CheckCircle2 className='h-10 w-10' style={{ color: primaryColor }} />
31+
<CheckCircle2 className='h-10 w-10' style={{ color: thankYouColor }} />
2232
</div>
2333
<h2
2434
className={`${soehne.className} mt-6 font-medium text-[32px] tracking-tight`}
25-
style={{ color: primaryColor }}
35+
style={{ color: thankYouColor }}
2636
>
2737
{title}
2838
</h2>

apps/sim/app/form/[identifier]/form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export default function Form({ identifier }: { identifier: string }) {
244244
<ThankYouScreen
245245
title={thankYouData.title}
246246
message={thankYouData.message}
247-
primaryColor={primaryColor}
247+
primaryColor={formConfig?.customizations?.primaryColor}
248248
/>
249249
</div>
250250
{formConfig?.showBranding !== false ? (
@@ -307,6 +307,7 @@ export default function Form({ identifier }: { identifier: string }) {
307307
primaryColor={primaryColor}
308308
label={config?.label}
309309
description={config?.description}
310+
required={config?.required}
310311
/>
311312
)
312313
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export function CreateChunkModal({
123123
<ModalHeader>Create Chunk</ModalHeader>
124124

125125
<form>
126-
<ModalBody className='!pb-[16px]'>
126+
<ModalBody>
127127
<div className='flex flex-col gap-[8px]'>
128128
{error && <p className='text-[12px] text-[var(--text-error)]'>{error}</p>}
129129

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export function DocumentTagsModal({
399399
</div>
400400
</ModalHeader>
401401

402-
<ModalBody className='!pb-[16px]'>
402+
<ModalBody>
403403
<div className='min-h-0 flex-1 overflow-y-auto'>
404404
<div className='space-y-[8px]'>
405405
<Label>Tags</Label>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export function EditChunkModal({
260260
</ModalHeader>
261261

262262
<form>
263-
<ModalBody className='!pb-[16px]'>
263+
<ModalBody>
264264
<div className='flex flex-col gap-[8px]'>
265265
{error && <p className='text-[12px] text-[var(--text-error)]'>{error}</p>}
266266

apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-documents-modal/add-documents-modal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export function AddDocumentsModal({
224224
<ModalContent>
225225
<ModalHeader>Add Documents</ModalHeader>
226226

227-
<ModalBody className='!pb-[16px]'>
227+
<ModalBody>
228228
<div className='min-h-0 flex-1 overflow-y-auto'>
229229
<div className='space-y-[12px]'>
230230
{fileError && (
@@ -242,8 +242,8 @@ export function AddDocumentsModal({
242242
onDragLeave={handleDragLeave}
243243
onDrop={handleDrop}
244244
className={cn(
245-
'!bg-[var(--surface-1)] hover:!bg-[var(--surface-4)] w-full justify-center border border-[var(--c-575757)] border-dashed py-[10px]',
246-
isDragging && 'border-[var(--brand-primary-hex)]'
245+
'!bg-[var(--surface-1)] hover:!bg-[var(--surface-4)] w-full justify-center border border-[var(--border-1)] border-dashed py-[10px]',
246+
isDragging && 'border-[var(--surface-7)]'
247247
)}
248248
>
249249
<input

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export function BaseTagsModal({ open, onOpenChange, knowledgeBaseId }: BaseTagsM
313313
</div>
314314
</ModalHeader>
315315

316-
<ModalBody className='!pb-[16px]'>
316+
<ModalBody>
317317
<div className='min-h-0 flex-1 overflow-y-auto'>
318318
<div className='space-y-[8px]'>
319319
<Label>
@@ -458,7 +458,7 @@ export function BaseTagsModal({ open, onOpenChange, knowledgeBaseId }: BaseTagsM
458458
<Modal open={deleteTagDialogOpen} onOpenChange={setDeleteTagDialogOpen}>
459459
<ModalContent size='sm'>
460460
<ModalHeader>Delete Tag</ModalHeader>
461-
<ModalBody className='!pb-[16px]'>
461+
<ModalBody>
462462
<div className='space-y-[8px]'>
463463
<p className='text-[12px] text-[var(--text-secondary)]'>
464464
Are you sure you want to delete the "{selectedTag?.displayName}" tag? This will
@@ -497,7 +497,7 @@ export function BaseTagsModal({ open, onOpenChange, knowledgeBaseId }: BaseTagsM
497497
<Modal open={viewDocumentsDialogOpen} onOpenChange={setViewDocumentsDialogOpen}>
498498
<ModalContent size='sm'>
499499
<ModalHeader>Documents using "{selectedTag?.displayName}"</ModalHeader>
500-
<ModalBody className='!pb-[16px]'>
500+
<ModalBody>
501501
<div className='space-y-[8px]'>
502502
<p className='text-[12px] text-[var(--text-tertiary)]'>
503503
{selectedTagUsage?.documentCount || 0} document

0 commit comments

Comments
 (0)