Skip to content

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

feat(studio): log drains empty state update (#39977)

kemal.earth085e68c61819
diff --git a/apps/studio/components/interfaces/LogDrains/AnimatedLogos.tsx b/apps/studio/components/interfaces/LogDrains/AnimatedLogos.tsx
new file mode 100644
index 00000000000..1b171f9ca2b
--- /dev/null
+++ b/apps/studio/components/interfaces/LogDrains/AnimatedLogos.tsx
@@ -0,0 +1,121 @@
+import { useState, useEffect } from 'react'
+import { motion, AnimatePresence } from 'framer-motion'
+import { cn } from 'ui'
+import { Datadog, Grafana, Sentry } from 'icons'
+import { BracesIcon } from 'lucide-react'
+
+export const AnimatedLogos = () => {
+ const [currIndex, setCurrIndex] = useState(0)
+ const timer = 2500
+ const iconSize = 36
+
+ const logos = [
+ {
+ id: 'datadog',
+ name: 'Datadog',
+ icon: <Datadog fill="currentColor" strokeWidth={0} size={iconSize} />,
+ },
+ {
+ id: 'loki',
+ name: 'Loki',
+ icon: <Grafana fill="currentColor" strokeWidth={0} size={iconSize} />,
+ },
+ { id: 'https', name: 'HTTPS', icon: <BracesIcon size={iconSize} /> },
+ {
+ id: 'sentry',
+ name: 'Sentry',
+ icon: <Sentry fill="currentColor" strokeWidth={0} size={iconSize} />,
+ },
+ ]
+
+ useEffect(() => {
+ const interval = setInterval(() => {
+ setCurrIndex((prev) => (prev + 1) % logos.length)
+ }, timer)
+ return () => clearInterval(interval)
+ }, [logos.length])
+
+ const getPreviousIndex = () => (currIndex - 1 + logos.length) % logos.length
+ const getNextIndex = () => (currIndex + 1) % logos.length
+
+ const getPosition = (index: number) => {
+ if (index === currIndex) return 'center'
+ if (index === getPreviousIndex()) return 'left'
+ if (index === getNextIndex()) return 'right'
+ return 'hidden'
+ }
+
+ const logoVariants = {
+ hidden: {
+ x: 'calc(-50% + 120px)',
+ y: '-50%',
+ scale: 0.6,
+ opacity: 0,
+ filter: 'blur(1px)',
+ },
+ right: {
+ x: 'calc(-50% + 80px)',
+ y: '-50%',
+ scale: 0.8,
+ opacity: 0.5,
+ zIndex: 2,
+ filter: 'blur(1px)',
+ },
+ center: {
+ x: '-50%',
+ y: '-50%',
+ scale: 1,
+ opacity: 1,
+ zIndex: 3,
+ filter: 'blur(0px)',
+ },
+ left: {
+ x: 'calc(-50% - 80px)',
+ y: '-50%',
+ scale: 0.8,
+ opacity: 0.5,
+ zIndex: 2,
+ filter: 'blur(1px)',
+ },
+ exit: {
+ x: 'calc(-50% - 120px)',
+ y: '-50%',
+ scale: 0.6,
+ opacity: 0,
+ filter: 'blur(1px)',
+ },
+ }
+
+ const visibleIndices = [getPreviousIndex(), currIndex, getNextIndex()]
+
+ return (
+ <div className="relative w-48 h-32 mx-auto mb-8 overflow-hidden">
+ <AnimatePresence initial={false}>
+ {logos.map((logo, index) => {
+ if (!visibleIndices.includes(index)) return null
+
+ const position = getPosition(index)
+ const isCenter = index === currIndex
+
+ return (
+ <motion.div
+ key={logo.id}
+ className={cn(
+ 'absolute top-1/2 left-1/2 flex items-center justify-center rounded-lg',
+ isCenter ? 'w-24 h-24' : 'w-20 h-20'
+ )}
+ variants={logoVariants}
+ initial="hidden"
+ animate={position}
+ exit="exit"
+ transition={{ duration: 0.5, ease: 'easeInOut' }}
+ >
+ <span>{logo.icon}</span>
+ </motion.div>
+ )
+ })}
+ </AnimatePresence>
+ <div className="absolute -inset-4 bg-gradient-to-r from-background-surface-75 via-transparent to-background-surface-75 z-40" />
+ </div>
+ )
+}
diff --git a/apps/studio/components/interfaces/LogDrains/LogDrains.tsx b/apps/studio/components/interfaces/LogDrains/LogDrains.tsx
index f9a8341b800..01ef4efc2bc 100644
--- a/apps/studio/components/interfaces/LogDrains/LogDrains.tsx
+++ b/apps/studio/components/interfaces/LogDrains/LogDrains.tsx
@@ -1,5 +1,4 @@
import { MoreHorizontal, Pencil, TrashIcon } from 'lucide-react'
-import Link from 'next/link'
import { useState } from 'react'
import { toast } from 'sonner'
@@ -10,7 +9,6 @@ import Panel from 'components/ui/Panel'
import { useDeleteLogDrainMutation } from 'data/log-drains/delete-log-drain-mutation'
import { LogDrainData, useLogDrainsQuery } from 'data/log-drains/log-drains-query'
import { useCurrentOrgPlan } from 'hooks/misc/useCurrentOrgPlan'
-import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
import {
Button,
DropdownMenu,
@@ -27,6 +25,7 @@ import {
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { LOG_DRAIN_TYPES, LogDrainType } from './LogDrains.constants'
+import { LogDrainsEmpty } from './LogDrainsEmpty'
export function LogDrains({
onNewDrainClick,
@@ -35,8 +34,6 @@ export function LogDrains({
onNewDrainClick: (src: LogDrainType) => void
onUpdateDrainClick: (drain: LogDrainData) => void
}) {
- const { data: org } = useSelectedOrganizationQuery()
-
const { isLoading: orgPlanLoading, plan } = useCurrentOrgPlan()
const logDrainsEnabled = !orgPlanLoading && (plan?.id === 'team' || plan?.id === 'enterprise')
@@ -71,16 +68,7 @@ export function LogDrains({
})
if (!orgPlanLoading && !logDrainsEnabled) {
- return (
- <CardButton
- title="Upgrade to a Team Plan"
- description="Upgrade to a Team or Enterprise Plan to use Log Drains"
- >
- <Button className="mt-2" asChild>
- <Link href={`/org/${org?.slug}/billing`}>Upgrade to Team</Link>
- </Button>
- </CardButton>
- )
+ return <LogDrainsEmpty />
}
if (isLoading || orgPlanLoading) {
diff --git a/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx b/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx
new file mode 100644
index 00000000000..9beca599536
--- /dev/null
+++ b/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx
@@ -0,0 +1,87 @@
+import { Button, Card, cn } from 'ui'
+import Link from 'next/link'
+import { AnimatedLogos } from './AnimatedLogos'
+import Image from 'next/image'
+import { BASE_PATH } from 'lib/constants'
+import { UpgradePlanButton } from 'components/ui/UpgradePlanButton'
+
+export const LogDrainsEmpty = () => {
+ const items = [
+ {
+ step: 1,
+ title: 'Log drain pricing',
+ description:
+ 'Log Drains are available as a project Add-On for all Team and Enterprise users. Each Log Drain costs $60 per month.',
+ label: 'See our pricing',
+ link: 'https://supabase.com/docs/guides/platform/manage-your-usage/log-drains',
+ },
+ {
+ step: 2,
+ title: 'Connect to your drain',
+ description:
+ 'We offer support for multiple destinations including HTTPS, Datadog, Loki and Sentry.',
+ label: 'Read our documentation',
+ link: 'https://supabase.com/docs/guides/telemetry/log-drains',
+ },
+ ]
+
+ return (
+ <div className="flex grow h-full pt-16">
+ <div className="flex grow items-center justify-center p-12 @container">
+ <div className="w-full max-w-4xl flex flex-col items-center gap-0">
+ <div className="text-center mb-12">
+ <AnimatedLogos />
+ <h2 className="heading-section mb-1">Capture your logs, your way</h2>
+ <p className="text-foreground-light mb-6">
+ Upgrade to a Team or Enterprise Plan to send your logs to your preferred platform
+ </p>
+ <UpgradePlanButton type="primary" plan="Team" source="log-drains-empty-state">
+ Upgrade plan
+ </UpgradePlanButton>
+ </div>
+ <Card className="grid grid-cols-1 @xl:grid-cols-2 bg divide-x mb-8">
+ {items.map((item, i) => (
+ <div className="flex flex-col h-full p-6" key={i}>
+ <div className="flex items-center gap-3 mb-2">
+ <span
+ className={cn(
+ 'text-xs shrink-0 font-mono text-foreground-light w-7 h-7 bg border flex items-center justify-center rounded-md'
+ )}
+ >
+ {item.step}
+ </span>
+ <h3 className="heading-default">{item.title}</h3>
+ </div>
+ <p className="text-foreground-light text-sm mb-4 flex-1">{item.description}</p>
+ <Button type="default" className="w-full" asChild>
+ <Link href={item.link} target="_blank">
+ {item.label}
+ </Link>
+ </Button>
+ </div>
+ ))}
+ </Card>
+ <div className="flex items-center justify-center gap-1.5 text-sm">
+ <Image
+ className={cn('dark:invert text-muted')}
+ src={`${BASE_PATH}/img/icons/github-icon.svg`}
+ width={16}
+ height={16}
+ alt="GitHub icon"
+ />
+ <p className="text-foreground-light">
+ Don't see your preferred drain?{' '}
+ <Link
+ href="https://github.com/orgs/supabase/discussions/28324?sort=top"
+ className="text-foreground underline underline-offset-2 decoration-foreground-muted hover:decoration-foreground transition-all"
+ target="_blank"
+ >
+ Vote here
+ </Link>
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/apps/studio/pages/project/[ref]/settings/log-drains.tsx b/apps/studio/pages/project/[ref]/settings/log-drains.tsx
index 259adfc3569..e1f34d83e70 100644
--- a/apps/studio/pages/project/[ref]/settings/log-drains.tsx
+++ b/apps/studio/pages/project/[ref]/settings/log-drains.tsx
@@ -81,32 +81,36 @@ const LogDrainsSettings: NextPageWithLayout = () => {
return (
<>
<ScaffoldContainer>
- <ScaffoldHeader className="flex flex-row justify-between">
- <div>
- <ScaffoldTitle>Log Drains</ScaffoldTitle>
- <ScaffoldDescription>
- Send your project logs to third party destinations
- </ScaffoldDescription>
- </div>
- <div className="flex items-center justify-end gap-2">
- <DocsButton href={`${DOCS_URL}/guides/platform/log-drains`} />
-
- {!(logDrains?.length === 0) && (
- <Button
- disabled={!logDrainsEnabled || !canManageLogDrains}
- onClick={() => {
- setSelectedLogDrain(null)
- setMode('create')
- setOpen(true)
- }}
- type="primary"
- >
- Add destination
- </Button>
- )}
- </div>
- </ScaffoldHeader>
+ {(logDrainsEnabled || planLoading) && (
+ <ScaffoldHeader className="flex flex-row justify-between">
+ <div>
+ <ScaffoldTitle>Log Drains</ScaffoldTitle>
+ <ScaffoldDescription>
+ Send your project logs to third party destinations
+ </ScaffoldDescription>
+ </div>
+
+ <div className="flex items-center justify-end gap-2">
+ <DocsButton href={`${DOCS_URL}/guides/platform/log-drains`} />
+
+ {!(logDrains?.length === 0) && (
+ <Button
+ disabled={!logDrainsEnabled || !canManageLogDrains}
+ onClick={() => {
+ setSelectedLogDrain(null)
+ setMode('create')
+ setOpen(true)
+ }}
+ type="primary"
+ >
+ Add destination
+ </Button>
+ )}
+ </div>
+ </ScaffoldHeader>
+ )}
</ScaffoldContainer>
+
<ScaffoldContainer className="flex flex-col gap-10" bottomPadding>
<LogDrainDestinationSheetForm
mode={mode}