Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Column editor default value field to be mono if type selected is json

Joshen Limda68f15139f9
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx
index 460b4fb811d..d804a88d2ba 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx
@@ -21,6 +21,7 @@ const ColumnDefaultValue: FC<Props> = ({
enumTypes = [],
onUpdateField = () => {},
}) => {
+ console.log('DefaultValue', columnFields)
const suggestions: Suggestion[] = typeExpressionSuggestions?.[columnFields.format] ?? []
// If selected column type is a user-defined enum, show a dropdown list of options
@@ -55,6 +56,7 @@ const ColumnDefaultValue: FC<Props> = ({
description="Can either be a literal or an expression (e.g uuid_generate_v4())"
placeholder="NULL"
value={columnFields?.defaultValue ?? ''}
+ format={columnFields?.format}
suggestionsHeader="Suggested expressions"
suggestions={suggestions}
onChange={(event: any) => onUpdateField({ defaultValue: event.target.value })}
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/InputWithSuggestions.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/InputWithSuggestions.tsx
index 8e97f235a4e..b73579ecfb0 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/InputWithSuggestions.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/InputWithSuggestions.tsx
@@ -21,6 +21,7 @@ interface Props {
disabled?: boolean
className?: string
value: string
+ format?: string
suggestionsHeader?: string
suggestionsWidth?: number
suggestions: Suggestion[]
@@ -37,8 +38,7 @@ const InputWithSuggestions: FC<Props> = ({
disabled = false,
className = '',
value = '',
- suggestionsHeader = 'Suggestions',
- suggestionsWidth,
+ format,
suggestions = [],
onChange = () => {},
onSelectSuggestion = () => {},
@@ -75,7 +75,7 @@ const InputWithSuggestions: FC<Props> = ({
size={size}
layout={layout}
disabled={disabled}
- className={className}
+ className={`${className} ${format?.includes('json') ? 'input-mono' : ''}`}
type="text"
value={value}
onChange={onInputChange}
@@ -95,7 +95,7 @@ const InputWithSuggestions: FC<Props> = ({
onClick={() => onSelectSuggestion(suggestion)}
>
<div className="text-sm">{suggestion.name}</div>
- <div className="text-xs text-scale-900">{suggestion.description}</div>
+ <div className="text-scale-900 text-xs">{suggestion.description}</div>
</Dropdown.Item>
))}
</>