:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(desktop): replace the dead login support button with affirmations (#89045)
Peter Kirkham5a2042594c24
diff --git a/products/desktop/packages/ui/src/features/auth/components/AffirmationButton.stories.tsx b/products/desktop/packages/ui/src/features/auth/components/AffirmationButton.stories.tsxnew file mode 100644index 000000000000..d46ffab0c0d3--- /dev/null+++ b/products/desktop/packages/ui/src/features/auth/components/AffirmationButton.stories.tsx@@ -0,0 +1,16 @@+import type { Meta, StoryObj } from "@storybook/react-vite";+import { AffirmationButton } from "./AffirmationButton";++const meta = {+ title: "Auth/Affirmation button",+ component: AffirmationButton,+} satisfies Meta<typeof AffirmationButton>;++export default meta;+type Story = StoryObj<typeof meta>;++export const Default: Story = {+ args: {+ onOpenSupport: () => {},+ },+};diff --git a/products/desktop/packages/ui/src/features/auth/components/AffirmationButton.tsx b/products/desktop/packages/ui/src/features/auth/components/AffirmationButton.tsxnew file mode 100644index 000000000000..78b277693eca--- /dev/null+++ b/products/desktop/packages/ui/src/features/auth/components/AffirmationButton.tsx@@ -0,0 +1,50 @@+import { Heart, Lifebuoy } from "@phosphor-icons/react";+import { Button } from "@posthog/quill";+import { useState } from "react";++const AFFIRMATIONS = [+ "You don't need help. You are enough.",+ "You can do it. Try harder.",+ "Have you tried believing in yourself?",+ "The answer was inside you the whole time.",+ "This is not a setback. It is a growth opportunity.",+ "You are exactly where you need to be.",+ "Somewhere out there, someone believes in you.",+];++function pickAffirmation(): string {+ return AFFIRMATIONS[Math.floor(Math.random() * AFFIRMATIONS.length)];+}++interface AffirmationButtonProps {+ onOpenSupport: () => void;+}++export function AffirmationButton({ onOpenSupport }: AffirmationButtonProps) {+ const [affirmation, setAffirmation] = useState<string | null>(null);++ return (+ <div className="flex items-center gap-3">+ <Button+ variant="default"+ size="sm"+ className="text-(--gray-11) opacity-50"+ onClick={() => {+ if (affirmation === null) {+ setAffirmation(pickAffirmation());+ } else {+ onOpenSupport();+ }+ }}+ >+ {affirmation === null ? <Heart size={14} /> : <Lifebuoy size={14} />}+ {affirmation === null ? "Need support?" : "Get support"}+ </Button>+ {affirmation !== null && (+ <span aria-live="polite" className="text-(--gray-11) text-xs">+ {affirmation}+ </span>+ )}+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/auth/components/AuthScreen.tsx b/products/desktop/packages/ui/src/features/auth/components/AuthScreen.tsxindex 2fc2488e80db..11d8cf998eb9 100644--- a/products/desktop/packages/ui/src/features/auth/components/AuthScreen.tsx+++ b/products/desktop/packages/ui/src/features/auth/components/AuthScreen.tsx@@ -1,40 +1,35 @@import { SignInCard } from "@posthog/ui/features/auth/SignInCard";import { FullScreenLayout } from "@posthog/ui/primitives/FullScreenLayout";-import { Callout, Flex } from "@radix-ui/themes";import { useAuthStateValue } from "../store";+import { AffirmationButton } from "./AffirmationButton";-export function AuthScreen() {+interface AuthScreenProps {+ onOpenSupport: () => void;+}++export function AuthScreen({ onOpenSupport }: AuthScreenProps) {const sessionEndReason = useAuthStateValue((state) => state.sessionEndReason);return (- <FullScreenLayout>- <Flex align="center" justify="center" height="100%" px="8">- <Flex- direction="column"- align="center"- className="h-full w-full max-w-[480px] pt-[24px] pb-[40px]"- >- <Flex- direction="column"- justify="center"- align="center"- className="min-h-0 w-full flex-1"- >- <Flex direction="column" align="start" gap="6" className="w-full">- <Flex direction="column" gap="5" className="w-full">+ <FullScreenLayout+ footerLeft={<AffirmationButton onOpenSupport={onOpenSupport} />}+ >+ <div className="flex h-full items-center justify-center px-12">+ <div className="flex h-full w-full max-w-[480px] flex-col items-center pt-[24px] pb-[40px]">+ <div className="flex min-h-0 w-full flex-1 flex-col items-center justify-center">+ <div className="flex w-full flex-col items-start gap-8">+ <div className="flex w-full flex-col gap-6">{sessionEndReason === "impersonation_expired" && (- <Callout.Root color="amber">- <Callout.Text>- Your impersonated session ended. Impersonate the user- again, then sign in to continue.- </Callout.Text>- </Callout.Root>+ <div className="rounded-(--radius-4) bg-(--amber-a3) p-4 text-(--amber-a11) text-[14px] leading-[20px]">+ Your impersonated session ended. Impersonate the user again,+ then sign in to continue.+ </div>)}<SignInCard />- </Flex>- </Flex>- </Flex>- </Flex>- </Flex>+ </div>+ </div>+ </div>+ </div>+ </div></FullScreenLayout>);}diff --git a/products/desktop/packages/ui/src/shell/App.tsx b/products/desktop/packages/ui/src/shell/App.tsxindex b23eefce578a..8d86c3047b5e 100644--- a/products/desktop/packages/ui/src/shell/App.tsx+++ b/products/desktop/packages/ui/src/shell/App.tsx@@ -254,7 +254,9 @@ function App({ devToolbar }: AppProps) {if (!isAuthenticated) {return (<motion.div key="auth" initial={{ opacity: 1 }} className="h-full">- <AuthScreen />+ <AuthScreen+ onOpenSupport={() => openExternalUrl(EXTERNAL_LINKS.talkToHuman)}+ /></motion.div>);}