|
| 1 | +import React from 'react' |
| 2 | +import { IconX } from '@posthog/icons' |
| 3 | +import CloudinaryImage from 'components/CloudinaryImage' |
| 4 | +import WizardCommand from 'components/WizardCommand' |
| 5 | + |
| 6 | +// Persist dismissal so the hint doesn't nag a user who has already seen it. Mirrors the |
| 7 | +// product app's WarehouseWizardHint, which uses the same localStorage key. |
| 8 | +// theme-init.js sets `warehouse-wizard-hint-dismissed` on <html> before paint when this |
| 9 | +// key is set; global.css hides `.warehouse-wizard-hint` when that class is present. |
| 10 | +const DISMISSED_KEY = 'warehouse-wizard-hint-dismissed' |
| 11 | +const DISMISSED_CLASS = 'warehouse-wizard-hint-dismissed' |
| 12 | + |
| 13 | +/** |
| 14 | + * Agent-flavored nudge that pushes the `npx @posthog/wizard warehouse` CLI, which auto-detects |
| 15 | + * and connects a user's databases/APIs straight from their codebase instead of setting up a |
| 16 | + * source by hand. Visual design matches [`WizardCTA`](../WizardCTA). |
| 17 | + */ |
| 18 | +export default function WarehouseWizardHint({ className = '' }: { className?: string }): JSX.Element { |
| 19 | + const handleDismiss = () => { |
| 20 | + localStorage.setItem(DISMISSED_KEY, '1') |
| 21 | + document.documentElement.classList.add(DISMISSED_CLASS) |
| 22 | + } |
| 23 | + |
| 24 | + return ( |
| 25 | + <div className={`warehouse-wizard-hint relative ${className}`}> |
| 26 | + <button |
| 27 | + type="button" |
| 28 | + onClick={handleDismiss} |
| 29 | + aria-label="Dismiss" |
| 30 | + className="absolute cursor-pointer rounded-full bg-white dark:bg-secondary p-1 top-1 right-1 translate-x-1/2 -translate-y-1/2 z-10 text-secondary hover:text-primary border border-secondary" |
| 31 | + > |
| 32 | + <IconX className="size-4" /> |
| 33 | + </button> |
| 34 | + <div className="relative overflow-hidden rounded not-prose border border-secondary"> |
| 35 | + <CloudinaryImage |
| 36 | + src="https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_9608fcca70.png" |
| 37 | + className="dark:hidden absolute inset-0 -bottom-12" |
| 38 | + imgClassName="h-full w-full object-cover" |
| 39 | + /> |
| 40 | + <CloudinaryImage |
| 41 | + src="https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_dark_a92b0e022d.png" |
| 42 | + className="hidden dark:block absolute inset-0 -bottom-12" |
| 43 | + imgClassName="h-full w-full object-cover" |
| 44 | + /> |
| 45 | + <div className="relative flex flex-col-reverse @lg:flex-row items-center justify-between pl-5 @lg:pl-8 pr-8 py-4 @lg:py-3 gap-4"> |
| 46 | + <div className="flex-1 text-center @lg:text-left max-w-lg"> |
| 47 | + <p className="text-lg font-bold !mb-0">Let AI connect your sources for you</p> |
| 48 | + <p className="!mt-1 !mb-3 text-sm opacity-75"> |
| 49 | + Skip the manual setup — run this in your project and the wizard auto-detects your databases |
| 50 | + and APIs and connects them to PostHog. |
| 51 | + </p> |
| 52 | + <WizardCommand command="warehouse" /> |
| 53 | + </div> |
| 54 | + <div className="shrink-0"> |
| 55 | + <img |
| 56 | + src="https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png" |
| 57 | + alt="PostHog Wizard hedgehog" |
| 58 | + className="w-36 @lg:w-32 @xl:w-40 @2xl:w-48" |
| 59 | + /> |
| 60 | + </div> |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + </div> |
| 64 | + ) |
| 65 | +} |
0 commit comments