mirror of
https://github.com/supabase/supabase.git
synced 2026-06-20 21:16:00 +08:00
* o11y: mirror and sanitize breadcrumbs Mirror Sentry breadcrumbs as the basis for our own support logging. Also adds more sanitization to breadcrumbs. * feat(support form): toggle for attaching dashboard logs Add a toggle to the support form when the category is "Dashboard bug", to attach recent dashboard logs. Users can preview the attached logs and opt out. * feat(support links): dedicated support link component Add a new component for support links, which: - Uses the serializer for support link params to ensure serialization/deserialization pairs correctly - Snapshots breadcrumbs so the attached log on the support form will be cut off at the support link click (otherwise we will get support form actions cluttering up the log) * tests(support form): extend timeout on flaky test * Minor clean up * fix(support form): allow url to specifically indicate no specified project * minor nits * Fix tests * Fix tests --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import Link from 'next/link'
|
|
import { PropsWithChildren } from 'react'
|
|
|
|
import { SupportLink } from 'components/interfaces/Support/SupportLink'
|
|
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
|
|
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
|
|
import { Button } from 'ui'
|
|
|
|
interface ToggleSpendCapButtonProps {
|
|
action?: 'disable' | 'enable'
|
|
type?: 'default' | 'primary'
|
|
}
|
|
|
|
export const ToggleSpendCapButton = ({
|
|
action = 'disable',
|
|
type = 'default',
|
|
children,
|
|
}: PropsWithChildren<ToggleSpendCapButtonProps>) => {
|
|
const { data: organization } = useSelectedOrganizationQuery()
|
|
const slug = organization?.slug ?? '_'
|
|
|
|
const { billingAll } = useIsFeatureEnabled(['billing:all'])
|
|
|
|
const subject = `Enquiry to ${action} spend cap for organization`
|
|
const message = `Name: ${organization?.name}\nSlug: ${organization?.slug}`
|
|
|
|
const href = billingAll ? `/org/${slug}/billing?panel=costControl` : ''
|
|
const linkChildren = children || `${action} spend cap`
|
|
const link = billingAll ? (
|
|
<Link href={href} className="capitalize">
|
|
{linkChildren}
|
|
</Link>
|
|
) : (
|
|
<SupportLink queryParams={{ orgSlug: slug, category: 'Plan_upgrade', subject, message }}>
|
|
{linkChildren}
|
|
</SupportLink>
|
|
)
|
|
|
|
return (
|
|
<Button type={type} asChild>
|
|
{link}
|
|
</Button>
|
|
)
|
|
}
|