Skip to content

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

Fix JSON side panel edit0r

Joshen Lim8b032abe5e26
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownBreadCrumbs.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownBreadCrumbs.tsx
index 9fa23dda559..6c9599b1531 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownBreadCrumbs.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownBreadCrumbs.tsx
@@ -1,6 +1,6 @@
import { FC } from 'react'
import { last } from 'lodash'
-import { Typography, IconHome, IconChevronRight } from '@supabase/ui'
+import { IconHome, IconChevronRight } from '@supabase/ui'
interface Props {
breadcrumbs: string[]
@@ -10,17 +10,15 @@ interface Props {
const DrilldownBreadCrumbs: FC<Props> = ({ breadcrumbs = [], onSelectBreadcrumb = () => {} }) => {
return (
<div className="flex items-center space-x-2">
- <Typography>
- <IconHome size={16} strokeWidth={2} />
- </Typography>
+ <IconHome size={16} strokeWidth={2} />
{breadcrumbs.length > 0 &&
breadcrumbs.map((crumb) => (
<div className="flex items-center space-x-2" key={crumb}>
<IconChevronRight size={16} strokeWidth={2} />
{crumb === last(breadcrumbs) ? (
- <Typography.Text>{crumb}</Typography.Text>
+ <p className="text-xs font-mono">{crumb}</p>
) : (
- <Typography.Text>
+ <p className="text-xs font-mono">
<div
className="cursor-pointer"
onClick={() =>
@@ -29,7 +27,7 @@ const DrilldownBreadCrumbs: FC<Props> = ({ breadcrumbs = [], onSelectBreadcrumb
>
{crumb}
</div>
- </Typography.Text>
+ </p>
)}
</div>
))}
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownPane.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownPane.tsx
index c486bf743f0..f1cabb8240c 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownPane.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/DrilldownViewer/DrilldownPane.tsx
@@ -1,5 +1,5 @@
import { FC } from 'react'
-import { IconChevronRight, Typography } from '@supabase/ui'
+import { IconChevronRight } from '@supabase/ui'
import { isNull } from 'lodash'
import { Dictionary } from '@supabase/grid'
@@ -15,9 +15,7 @@ const DrilldownPane: FC<Props> = ({ pane, jsonData, activeKey, onSelectKey = ()
return (
<div className={`flex-1 ${pane === 2 ? 'border-l border-gray-500' : ''}`}>
<div className="py-2 px-5 flex space-x-2">
- <Typography.Text small type="danger">
- Invalid JSON
- </Typography.Text>
+ <p className="text-sm">Invalid JSON</p>
</div>
</div>
)
@@ -27,9 +25,7 @@ const DrilldownPane: FC<Props> = ({ pane, jsonData, activeKey, onSelectKey = ()
return (
<div className={`flex-1 max-w-[50%] ${pane === 2 ? 'border-l border-gray-500' : ''}`}>
<div className="py-2 px-5 flex space-x-2">
- <Typography.Text small className="opacity-50">
- No data available
- </Typography.Text>
+ <p className="opacity-50 text-sm">No data available</p>
</div>
</div>
)
@@ -55,25 +51,20 @@ const DrilldownPane: FC<Props> = ({ pane, jsonData, activeKey, onSelectKey = ()
`}
onClick={() => onSelectKey(key, pane)}
>
- <Typography.Text small className="font-mono !text-blue-700 dark:!text-blue-300">
- {key}
- </Typography.Text>
+ <p className="text-xs font-mono !text-blue-700 dark:!text-blue-1100">{key}</p>
<div className={`${key === activeKey ? 'block' : 'hidden'} group-hover:block`}>
- <Typography>
- <IconChevronRight strokeWidth={2} size={16} />
- </Typography>
+ <IconChevronRight strokeWidth={2} size={16} />
</div>
</div>
))}
{keysWithoutChildren.map((key: string) => (
<div key={key} className="py-2 px-5 flex space-x-2">
- <Typography.Text small className="font-mono !text-blue-700 dark:!text-blue-300">
- {key}:
- </Typography.Text>
- <Typography.Text
- small
- className={`font-mono break-all ${
- typeof jsonData[key] !== 'string' ? '!text-green-700 dark:!text-green-400' : '!text-yellow-700 dark:!text-yellow-500'
+ <p className="text-xs font-mono !text-blue-700 dark:!text-blue-1100">{key}:</p>
+ <p
+ className={`text-xs font-mono break-all ${
+ typeof jsonData[key] !== 'string'
+ ? '!text-green-700 dark:!text-green-1000'
+ : '!text-yellow-700 dark:!text-yellow-900'
}`}
>
{isNull(jsonData[key])
@@ -81,7 +72,7 @@ const DrilldownPane: FC<Props> = ({ pane, jsonData, activeKey, onSelectKey = ()
: typeof jsonData[key] === 'string'
? `"${jsonData[key]}"`
: jsonData[key].toString()}
- </Typography.Text>
+ </p>
</div>
))}
</div>
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx
index d28d0ebecf1..965ce2d71d3 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/JsonEditor/JsonEditor.tsx
@@ -56,20 +56,22 @@ const JsonEdit: FC<JsonEditProps> = ({ column, jsonString, visible, closePanel,
onCancel={closePanel}
customFooter={<ActionBar closePanel={closePanel} applyFunction={validateJSON} />}
>
- <TwoOptionToggle
- options={['view', 'edit']}
- activeOption={view}
- borderOverride="border-gray-500"
- onClickOption={onToggleClick}
- />
+ <SidePanel.Content>
+ <TwoOptionToggle
+ options={['view', 'edit']}
+ activeOption={view}
+ borderOverride="border-gray-500"
+ onClickOption={onToggleClick}
+ />
- <div className="flex-auto flex flex-col mt-4">
- {view === 'edit' ? (
- <Editor column={column} value={jsonStr} onChange={onInputChange} />
- ) : (
- <Viewer column={column} value={jsonStr} />
- )}
- </div>
+ <div className="flex-auto flex flex-col mt-4 space-y-2">
+ {view === 'edit' ? (
+ <Editor column={column} value={jsonStr} onChange={onInputChange} />
+ ) : (
+ <Viewer column={column} value={jsonStr} />
+ )}
+ </div>
+ </SidePanel.Content>
</SidePanel>
)
}