mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
* advisor panel title * refactor * use badge for critical * Update apps/studio/components/ui/AdvisorPanel/AdvisorPanel.utils.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import LintDetail from 'components/interfaces/Linter/LintDetail'
|
|
import { Lint } from 'data/lint/lint-query'
|
|
import { Notification } from 'data/notifications/notifications-v2-query'
|
|
import { noop } from 'lodash'
|
|
import type { AdvisorItem } from './AdvisorPanel.types'
|
|
import { NotificationDetail } from './NotificationDetail'
|
|
|
|
interface AdvisorDetailProps {
|
|
item: AdvisorItem
|
|
projectRef: string
|
|
onUpdateNotificationStatus?: (id: string, status: 'archived' | 'seen') => void
|
|
}
|
|
|
|
export const AdvisorDetail = ({
|
|
item,
|
|
projectRef,
|
|
onUpdateNotificationStatus = noop,
|
|
}: AdvisorDetailProps) => {
|
|
if (item.source === 'lint') {
|
|
const lint = item.original as Lint
|
|
return (
|
|
<div className="px-6 py-6">
|
|
<LintDetail lint={lint} projectRef={projectRef} />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
if (item.source === 'notification') {
|
|
const notification = item.original as Notification
|
|
return (
|
|
<div className="px-6 py-6">
|
|
<NotificationDetail
|
|
notification={notification}
|
|
onUpdateStatus={onUpdateNotificationStatus}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return null
|
|
}
|