Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-posthog-ai--welcome--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-posthog-ai--welcome--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 28 additions & 2 deletions frontend/src/scenes/max/Intro.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useValues } from 'kea'
import { useState } from 'react'

import { Link, Tooltip } from '@posthog/lemon-ui'

Expand All @@ -8,19 +9,44 @@ import { userLogic } from 'scenes/userLogic'

import { maxLogic } from './maxLogic'

const LOGOMARK_AIRTIME_MS = 400 // Sync with --logomark-airtime in base.scss

export function Intro(): JSX.Element {
const { headline } = useValues(maxLogic)
const { user } = useValues(userLogic)
const [hedgehogLastJumped, setHedgehogLastJumped] = useState<number | null>(Date.now())
const [hedgehogJumpIteration, setHedgehogJumpIteration] = useState(0)

const shouldShowMaxRebrandMessage: boolean = !!user && dayjs(user.date_joined).isBefore('2025-10-21')

const handleLogomarkClick = (): void => {
const now = Date.now()
if (hedgehogLastJumped && now - hedgehogLastJumped < LOGOMARK_AIRTIME_MS) {
return // Disallows interrupting the jump animation!
}
setHedgehogJumpIteration(hedgehogJumpIteration + 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: use functional state update to avoid stale closure value

Suggested change
setHedgehogJumpIteration(hedgehogJumpIteration + 1)
setHedgehogJumpIteration((prev) => prev + 1)
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/max/Intro.tsx
Line: 27:27

Comment:
**logic:** use functional state update to avoid stale closure value

```suggestion
        setHedgehogJumpIteration((prev) => prev + 1)
```

How can I resolve this? If you propose a fix, please make it concise.

setHedgehogLastJumped(null)
requestAnimationFrame(() => setHedgehogLastJumped(now))
}

return (
<>
<div className="flex *:h-full *:w-12 animate-logomark-jump">
<div
className={`flex *:h-full *:w-12 p-2 cursor-pointer ${hedgehogLastJumped ? 'animate-logomark-jump' : ''}`}
// eslint-disable-next-line react/forbid-dom-props
style={
{
'--logomark-jump-magnitude': hedgehogJumpIteration
? 1.5 ** ((hedgehogJumpIteration % 8) - 2)
: 1,
} as React.CSSProperties
}
onClick={handleLogomarkClick}
>
<Logomark />
</div>
<div className="text-center mb-1">
<h2 className="text-xl @md/max-welcome:text-2xl font-bold my-2 text-balance">{headline}</h2>
<h2 className="text-xl @md/max-welcome:text-2xl font-bold mb-2 text-balance">{headline}</h2>
<div className="text-sm italic text-tertiary text-pretty py-0.5">
{shouldShowMaxRebrandMessage ? (
<Tooltip
Expand Down
9 changes: 6 additions & 3 deletions frontend/src/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,8 @@
}

.animate-logomark-jump {
--logomark-airtime: 0.4s;
--logomark-jump-magnitude: 1;
--logomark-airtime: 0.4s; // Sync with LOGOMARK_AIRTIME_MS in Intro.tsx

svg {
overflow: visible;
Expand All @@ -1792,7 +1793,9 @@
@for $i from 1 through 4 {
> *:nth-child(#{$i}) {
// Dividing by 15 just because it feels good
animation-delay: calc(var(--logomark-airtime) / 15 * ($i - 1));
animation-delay: calc(
var(--logomark-airtime) / 15 / calc(sqrt(var(--logomark-jump-magnitude))) * ($i - 1)
);
}
}
}
Expand All @@ -1804,7 +1807,7 @@
}

2% {
transform: translateY(-10px);
transform: translateY(calc(-10px * var(--logomark-jump-magnitude)));
}

4% {
Expand Down
Loading