Files
supabase/apps/studio/components/interfaces/ProjectCreation/ProjectCreationStatusAdmonition.tsx
Joshen Lim 6d08d66b7d Add eslint rule for google translate dynamic spans + address all issues (#52949)
## Context

We've been seeing many `NotFoundError: Failed to execute 'removeChild'
on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on
'Node'` events on Sentry which are historically known to be caused by
Google Translate in the browser.

There's technically no _right way_ to address this unfortunately, but
one of the solutions which should address most of these issues is to
wrap any dynamic text within a span - we've considered that quite a
while back tbh but never took the time to do this until today with the
help of Claude. Although just a heads up that it might not necessarily
completely eradicate those issues.

Also added an eslint rule which should prevent future occurences of this
<img width="1264" height="192" alt="image"
src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29"
/>
2026-11-05 23:28:46 +08:00

44 lines
1.5 KiB
TypeScript

import { useQuery } from '@tanstack/react-query'
import { Admonition } from 'ui-patterns/Admonition'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { getItemsAffectingProjectCreation } from './RegionSelector.utils'
import { InlineLink } from '@/components/ui/InlineLink'
import { statusPageQueryOptions } from '@/data/platform/status-page-query'
import { normalizeStatusPage } from '@/lib/status-page/status-page.utils'
export const ProjectCreationStatusAdmonition = ({
selectedRegionCode,
}: {
selectedRegionCode?: string
}) => {
const { data } = useQuery({ ...statusPageQueryOptions(), select: normalizeStatusPage })
if (!data) return null
const items = getItemsAffectingProjectCreation(data.items, selectedRegionCode)
const item = items[0]
if (!item) return null
const isMaintenance = item.kind === 'maintenance'
const isRegionSpecific = item.projectCreationScope?.type === 'regions'
return (
<FormItemLayout layout="horizontal">
<Admonition
type="warning"
title={isMaintenance ? 'Maintenance in progress' : 'Incident in progress'}
description={
<>
{isMaintenance ? 'Maintenance' : 'An incident'} <span>may affect project creation</span>
{isRegionSpecific ? ' in this region' : ''}
<span>. Follow updates on</span>{' '}
<InlineLink href={data.pageUrl}>status page</InlineLink>
<span>.</span>
</>
}
className="mt-3"
/>
</FormItemLayout>
)
}