Skip to content

Commit 2a5072d

Browse files
authored
chore: replace Markdown component in some generic studio components (supabase#30666)
We no longer want to use Markdown when not necessary. I checked the props for these components and we were only passing in a regular text without any actual markdown
1 parent d8a3eb6 commit 2a5072d

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

apps/studio/components/grid/components/header/Header.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { toast } from 'sonner'
77

88
import { useDispatch, useTrackedState } from 'components/grid/store/Store'
99
import type { Filter, Sort, SupaTable } from 'components/grid/types'
10-
import { Markdown } from 'components/interfaces/Markdown'
1110
import { formatTableRowsToSQL } from 'components/interfaces/TableGridEditor/TableEntity.utils'
1211
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
1312
import { ButtonTooltip } from 'components/ui/ButtonTooltip'
@@ -31,12 +30,22 @@ import {
3130
} from 'ui'
3231
import FilterPopover from './filter/FilterPopover'
3332
import { SortPopover } from './sort'
33+
import Link from 'next/link'
3434

3535
// [Joshen] CSV exports require this guard as a fail-safe if the table is
3636
// just too large for a browser to keep all the rows in memory before
3737
// exporting. Either that or export as multiple CSV sheets with max n rows each
3838
export const MAX_EXPORT_ROW_COUNT = 500000
39-
export const MAX_EXPORT_ROW_COUNT_MESSAGE = `Sorry! We're unable to support exporting row counts larger than ${MAX_EXPORT_ROW_COUNT.toLocaleString()} at the moment. Alternatively, you may consider using [pg_dump](https://supabase.com/docs/reference/cli/supabase-db-dump) via our CLI instead.`
39+
export const MAX_EXPORT_ROW_COUNT_MESSAGE = (
40+
<>
41+
Sorry! We're unable to support exporting row counts larger than $
42+
{MAX_EXPORT_ROW_COUNT.toLocaleString()} at the moment. Alternatively, you may consider using
43+
<Link href="https://supabase.com/docs/reference/cli/supabase-db-dump" target="_blank">
44+
pg_dump
45+
</Link>{' '}
46+
via our CLI instead.
47+
</>
48+
)
4049

4150
export type HeaderProps = {
4251
table: SupaTable
@@ -290,7 +299,9 @@ const RowHeader = ({ table, sorts, filters }: RowHeaderProps) => {
290299
setIsExporting(true)
291300

292301
if (allRowsSelected && totalRows > MAX_EXPORT_ROW_COUNT) {
293-
toast.error(<Markdown content={MAX_EXPORT_ROW_COUNT_MESSAGE} className="text-foreground" />)
302+
toast.error(
303+
<div className="prose text-sm text-foreground">{MAX_EXPORT_ROW_COUNT_MESSAGE}</div>
304+
)
294305
return setIsExporting(false)
295306
}
296307

@@ -331,7 +342,9 @@ const RowHeader = ({ table, sorts, filters }: RowHeaderProps) => {
331342
setIsExporting(true)
332343

333344
if (allRowsSelected && totalRows > MAX_EXPORT_ROW_COUNT) {
334-
toast.error(<Markdown content={MAX_EXPORT_ROW_COUNT_MESSAGE} className="text-foreground" />)
345+
toast.error(
346+
<div className="prose text-sm text-foreground">{MAX_EXPORT_ROW_COUNT_MESSAGE}</div>
347+
)
335348
return setIsExporting(false)
336349
}
337350

apps/studio/components/layouts/TableEditorLayout/EntityListItem.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
MAX_EXPORT_ROW_COUNT_MESSAGE,
2222
} from 'components/grid/components/header/Header'
2323
import { parseSupaTable } from 'components/grid/SupabaseGrid.utils'
24-
import { Markdown } from 'components/interfaces/Markdown'
2524
import {
2625
formatTableRowsToSQL,
2726
getEntityLintDetails,
@@ -117,7 +116,7 @@ const EntityListItem: ItemRenderer<Entity, EntityListItemProps> = ({
117116
})
118117
if (isTableLike(table) && table.live_rows_estimate > MAX_EXPORT_ROW_COUNT) {
119118
return toast.error(
120-
<Markdown content={MAX_EXPORT_ROW_COUNT_MESSAGE} className="text-foreground" />,
119+
<div className="text-foreground prose text-sm">{MAX_EXPORT_ROW_COUNT_MESSAGE}</div>,
121120
{ id: toastId }
122121
)
123122
}
@@ -171,7 +170,7 @@ const EntityListItem: ItemRenderer<Entity, EntityListItemProps> = ({
171170

172171
if (isTableLike(table) && table.live_rows_estimate > MAX_EXPORT_ROW_COUNT) {
173172
return toast.error(
174-
<Markdown content={MAX_EXPORT_ROW_COUNT_MESSAGE} className="text-foreground" />,
173+
<div className="text-foreground prose text-sm">{MAX_EXPORT_ROW_COUNT_MESSAGE}</div>,
175174
{ id: toastId }
176175
)
177176
}

apps/studio/components/ui/Forms/FormHeader.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import ReactMarkdown from 'react-markdown'
2-
3-
import { Markdown } from 'components/interfaces/Markdown'
41
import { ReactNode } from 'react'
52
import { cn } from 'ui'
63
import { DocsButton } from '../DocsButton'
@@ -21,12 +18,8 @@ const FormHeader = ({
2118
return (
2219
<div className={cn(`mb-6 flex items-center justify-between gap-x-4 ${className}`)}>
2320
<div className="space-y-1">
24-
<h3 className="text-foreground text-xl">
25-
<ReactMarkdown unwrapDisallowed disallowedElements={['p']}>
26-
{title}
27-
</ReactMarkdown>
28-
</h3>
29-
{description && <Markdown content={description} className="max-w-full" />}
21+
<h3 className="text-foreground text-xl prose">{title}</h3>
22+
{description && <div className="prose text-sm max-w-full">{description}</div>}
3023
</div>
3124
<div className="flex items-center gap-x-2">
3225
{docsUrl !== undefined && <DocsButton href={docsUrl} />}

apps/studio/components/ui/Panel.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Megaphone } from 'lucide-react'
22
import { forwardRef, PropsWithChildren, ReactNode } from 'react'
3-
import ReactMarkdown from 'react-markdown'
43
import { Badge, Button, Loading, cn } from 'ui'
54

65
interface PanelProps {
@@ -109,11 +108,9 @@ const PanelNotice = forwardRef<
109108
{/* <span className="font-medium text-foreground text-sm">{title}</span> */}
110109
</div>
111110
{description && (
112-
<span className="text-foreground-light text-sm flex flex-col gap-0">
113-
<ReactMarkdown className="prose text-xs max-w-none [&_p]:mt-2 [&_p]:mb-0">
114-
{description}
115-
</ReactMarkdown>
116-
</span>
111+
<div className="text-foreground-light text-sm flex flex-col gap-0">
112+
<div className="prose text-xs max-w-none [&_p]:mt-2 [&_p]:mb-0">{description}</div>
113+
</div>
117114
)}
118115
</div>
119116

0 commit comments

Comments
 (0)