diff --git a/.agents/skills/make-interfaces-feel-better/SKILL.md b/.agents/skills/make-interfaces-feel-better/SKILL.md new file mode 100644 index 00000000000..cd19691da58 --- /dev/null +++ b/.agents/skills/make-interfaces-feel-better/SKILL.md @@ -0,0 +1,148 @@ +--- +name: make-interfaces-feel-better +description: Design engineering principles for making interfaces feel polished. Use when building UI components, reviewing frontend code, implementing animations, hover states, shadows, borders, typography, micro-interactions, enter/exit animations, or any visual detail work. Triggers on UI polish, design details, "make it feel better", "feels off", stagger animations, border radius, optical alignment, font smoothing, tabular numbers, image outlines, box shadows. +--- + +# Details that make interfaces feel better + +Great interfaces rarely come from a single thing. It's usually a collection of small details that compound into a great experience. Apply these principles when building or reviewing UI code. + +## Quick Reference + +| Category | When to Use | +| --- | --- | +| [Typography](typography.md) | Text wrapping, font smoothing, tabular numbers | +| [Surfaces](surfaces.md) | Border radius, optical alignment, shadows, image outlines, hit areas | +| [Animations](animations.md) | Interruptible animations, enter/exit transitions, icon animations, scale on press | +| [Performance](performance.md) | Transition specificity, `will-change` usage | + +## Core Principles + +### 1. Concentric Border Radius + +Outer radius = inner radius + padding. Mismatched radii on nested elements is the most common thing that makes interfaces feel off. + +### 2. Optical Over Geometric Alignment + +When geometric centering looks off, align optically. Buttons with icons, play triangles, and asymmetric icons all need manual adjustment. + +### 3. Shadows Over Borders + +Layer multiple transparent `box-shadow` values for natural depth. Shadows adapt to any background; solid borders don't. + +### 4. Interruptible Animations + +Use CSS transitions for interactive state changes — they can be interrupted mid-animation. Reserve keyframes for staged sequences that run once. + +### 5. Split and Stagger Enter Animations + +Don't animate a single container. Break content into semantic chunks and stagger each with ~100ms delay. + +### 6. Subtle Exit Animations + +Use a small fixed `translateY` instead of full height. Exits should be softer than enters. + +### 7. Contextual Icon Animations + +Animate icons with `opacity`, `scale`, and `blur` instead of toggling visibility. Use exactly these values: scale from `0.25` to `1`, opacity from `0` to `1`, blur from `4px` to `0px`. If the project has `motion` or `framer-motion` in `package.json`, use `transition: { type: "spring", duration: 0.3, bounce: 0 }` — bounce must always be `0`. If no motion library is installed, keep both icons in the DOM (one absolute-positioned) and cross-fade with CSS transitions using `cubic-bezier(0.2, 0, 0, 1)` — this gives both enter and exit animations without any dependency. + +### 8. Font Smoothing + +Apply `-webkit-font-smoothing: antialiased` to the root layout on macOS for crisper text. + +### 9. Tabular Numbers + +Use `font-variant-numeric: tabular-nums` for any dynamically updating numbers to prevent layout shift. + +### 10. Text Wrapping + +Use `text-wrap: balance` on headings. Use `text-wrap: pretty` for body text to avoid orphans. + +### 11. Image Outlines + +Add a subtle `1px` outline with low opacity to images for consistent depth. The color must be pure black in light mode (`rgba(0, 0, 0, 0.1)`) and pure white in dark mode (`rgba(255, 255, 255, 0.1)`) — never a near-black like slate, zinc, or any tinted neutral. A tinted outline picks up the surface color underneath it and reads as dirt on the image edge. + +### 12. Scale on Press + +A subtle `scale(0.96)` on click gives buttons tactile feedback. Always use `0.96`. Never use a value smaller than `0.95` — anything below feels exaggerated. Add a `static` prop to disable it when motion would be distracting. + +### 13. Skip Animation on Page Load + +Use `initial={false}` on `AnimatePresence` to prevent enter animations on first render. Verify it doesn't break intentional entrance animations. + +### 14. Never Use `transition: all` + +Always specify exact properties: `transition-property: scale, opacity`. Tailwind's `transition-transform` covers `transform, translate, scale, rotate`. + +### 15. Use `will-change` Sparingly + +Only for `transform`, `opacity`, `filter` — properties the GPU can composite. Never use `will-change: all`. Only add when you notice first-frame stutter. + +### 16. Minimum Hit Area + +Interactive elements need at least 40×40px hit area. Extend with a pseudo-element if the visible element is smaller. Never let hit areas of two elements overlap. + +## Common Mistakes + +| Mistake | Fix | +| --- | --- | +| Same border radius on parent and child | Calculate `outerRadius = innerRadius + padding` | +| Icons look off-center | Adjust optically with padding or fix SVG directly | +| Hard borders between sections | Use layered `box-shadow` with transparency | +| Jarring enter/exit animations | Split, stagger, and keep exits subtle | +| Numbers cause layout shift | Apply `tabular-nums` | +| Heavy text on macOS | Apply `antialiased` to root | +| Animation plays on page load | Add `initial={false}` to `AnimatePresence` | +| `transition: all` on elements | Specify exact properties | +| First-frame animation stutter | Add `will-change: transform` (sparingly) | +| Tiny hit areas on small controls | Extend with pseudo-element to 40×40px | + +## Review Output Format + +Always present changes as a markdown table with **Before** and **After** columns. Include every change you made — not just a subset. Never list findings as separate "Before:" / "After:" lines outside of a table. Group changes by principle using a heading above each table, and keep each row focused on a single diff so the reader can scan the whole list quickly. + +### Example + +#### Concentric border radius +| Before | After | +| --- | --- | +| `rounded-xl` on card + `rounded-xl` on inner button (`p-2`) | `rounded-2xl` on card (`12 + 8`), `rounded-lg` on inner button | +| `border-radius: 16px` on both nested surfaces | Outer `24px`, inner `16px` with `8px` padding | + +#### Tabular numbers +| Before | After | +| --- | --- | +| `{count}` on animated counter | `{count}` | +| Default numerals on timer | Added `font-variant-numeric: tabular-nums` to root | + +#### Scale on press +| Before | After | +| --- | --- | +| ` + + + ); +} +``` + +### CSS-Only Stagger + +```css +.stagger-item { + opacity: 0; + transform: translateY(12px); + filter: blur(4px); + animation: fadeInUp 400ms ease-out forwards; +} + +.stagger-item:nth-child(1) { animation-delay: 0ms; } +.stagger-item:nth-child(2) { animation-delay: 100ms; } +.stagger-item:nth-child(3) { animation-delay: 200ms; } + +@keyframes fadeInUp { + to { + opacity: 1; + transform: translateY(0); + filter: blur(0); + } +} +``` + +## Exit Animations + +Exit animations should be softer and less attention-grabbing than enter animations. The user's focus is moving to the next thing — don't fight for attention. + +### Subtle Exit (Recommended) + +```tsx +// Small fixed translateY — indicates direction without drama + + {content} + +``` + +### Full Exit (When Context Matters) + +```tsx +// Slide fully out — use when spatial context is important +// (e.g., a card returning to a list, a drawer closing) + + {content} + +``` + +### Good vs. Bad + +```css +/* Good — subtle exit */ +.item-exit { + opacity: 0; + transform: translateY(-12px); + transition: opacity 150ms ease-in, transform 150ms ease-in; +} + +/* Bad — dramatic exit that steals focus */ +.item-exit { + opacity: 0; + transform: translateY(-100%) scale(0.5); + transition: all 400ms ease-in; +} + +/* Bad — no exit animation at all (element just vanishes) */ +.item-exit { + display: none; +} +``` + +**Key points:** +- Use a small fixed `translateY` (e.g., `-12px`) instead of the full container height +- Keep some directional movement to indicate where the element went +- Exit duration should be shorter than enter duration (150ms vs 300ms) +- Don't remove exit animations entirely — subtle motion preserves context + +## Contextual Icon Animations + +When icons appear or disappear contextually (on hover, on state change), animate them with `opacity`, `scale`, and `blur` rather than just toggling visibility. + +### Motion Example + +```tsx +import { AnimatePresence, motion } from "motion/react"; + +function IconButton({ isActive, icon: Icon }) { + return ( + + ); +} +``` + +### CSS Transition Approach (No Motion) + +If the project doesn't use Motion (Framer Motion), keep both icons in the DOM and cross-fade them with CSS transitions. Because neither icon unmounts, both enter and exit animate smoothly. + +The trick: one icon is absolutely positioned on top of the other. Toggling state cross-fades them — the entering icon scales up from `0.25` while the exiting icon scales down to `0.25`, both with opacity and blur. + +```tsx +function IconButton({ isActive, ActiveIcon, InactiveIcon }) { + return ( + + ); +} +``` + +The non-absolute icon (InactiveIcon) defines the layout size. The absolute icon (ActiveIcon) overlays it without affecting flow. + +### Choosing Between Motion and CSS + +| | Motion (Framer Motion) | CSS transitions (both icons in DOM) | +| --- | --- | --- | +| **Enter animation** | Yes | Yes | +| **Exit animation** | Yes (via `AnimatePresence`) | Yes (cross-fade — icon never unmounts) | +| **Spring physics** | Yes | No — use `cubic-bezier(0.2, 0, 0, 1)` as approximation | +| **When to use** | Project already uses `motion/react` | No motion dependency, or keeping bundle small | + +**Rule:** Check the project's `package.json` for `motion` or `framer-motion`. If present, use the Motion approach. If not, use the CSS cross-fade pattern — don't add a dependency just for icon transitions. + +### When to Animate Icons + +| Animate | Don't animate | +| --- | --- | +| Icons that appear on hover (action buttons) | Static navigation icons | +| State change icons (play → pause, like → liked) | Decorative icons | +| Icons in contextual toolbars | Icons that are always visible | +| Loading/success state indicators | Icon labels (text next to icon) | + +**Important:** Always use exactly these values for contextual icon animations — do not deviate: +- `scale`: `0.25` → `1` (never use `0.5` or `0.6`) +- `opacity`: `0` → `1` +- `filter`: `"blur(4px)"` → `"blur(0px)"` +- `transition`: `{ type: "spring", duration: 0.3, bounce: 0 }` — **bounce must always be `0`**, never `0.1` or any other value + +## Scale on Press + +A subtle scale-down on click gives buttons tactile feedback. Always use `scale(0.96)`. Never use a value smaller than `0.95` — anything below feels exaggerated. Use CSS transitions for interruptibility — if the user releases mid-press, it should smoothly return. + +Not every button needs this. Add a `static` prop to your button component that disables the scale effect when the motion would be distracting. + +### CSS Example + +```css +.button { + transition-property: scale; + transition-duration: 150ms; + transition-timing-function: ease-out; +} + +.button:active { + scale: 0.96; +} +``` + +### Tailwind Example + +```tsx + +``` + +### Motion Example + +```tsx + + Click me + +``` + +### Static Prop Pattern + +Extract the scale class into a variable and conditionally apply it based on a `static` prop: + +```tsx +const tapScale = "active:not-disabled:scale-[0.96]"; + +function Button({ static: isStatic, className, children, ...props }) { + return ( + + ); +} + +// Usage + {/* scales on press */} + {/* no scale */} +``` + +## Skip Animation on Page Load + +Use `initial={false}` on `AnimatePresence` to prevent enter animations from firing on first render. Elements that are already in their default state shouldn't animate in on page load — only on subsequent state changes. + +### When It Works + +```tsx +// Good — icon doesn't animate in on mount, only on state change + + + + + +``` + +Works well for: icon swaps, toggles, tabs, segmented controls — anything that has a default state on page load. + +### When It Breaks + +Don't use `initial={false}` when the component relies on its `initial` prop to set up a first-time enter animation, like a staggered page hero or a loading state. In those cases, removing the initial animation skips the entire entrance. + +```tsx +// Bad — initial={false} would skip the staggered page enter entirely + + + ... + + +``` + +Verify the component still looks right on a full page refresh before applying this. diff --git a/.agents/skills/make-interfaces-feel-better/performance.md b/.agents/skills/make-interfaces-feel-better/performance.md new file mode 100644 index 00000000000..155954988e9 --- /dev/null +++ b/.agents/skills/make-interfaces-feel-better/performance.md @@ -0,0 +1,88 @@ +# Performance + +Transition specificity and GPU compositing hints. + +## Transition Only What Changes + +Never use `transition: all` or Tailwind's `transition` shorthand (which maps to `transition-property: all`). Always specify the exact properties that change. + +### Why + +- `transition: all` forces the browser to watch every property for changes +- Causes unexpected transitions on properties you didn't intend to animate (colors, padding, shadows) +- Prevents browser optimizations + +### CSS Example + +```css +/* Good — only transition what changes */ +.button { + transition-property: scale, background-color; + transition-duration: 150ms; + transition-timing-function: ease-out; +} + +/* Bad — transition everything */ +.button { + transition: all 150ms ease-out; +} +``` + +### Tailwind + +```tsx +// Good — explicit properties + +``` + +### Play Button Triangles + +Play icons are triangular and their geometric center is not their visual center. Shift slightly right: + +```css +/* Good — optically centered */ +.play-button svg { + margin-left: 2px; /* shift right to account for triangle shape */ +} + +/* Bad — geometrically centered but looks off */ +.play-button svg { + /* no adjustment */ +} +``` + +### Asymmetric Icons (Stars, Arrows, Carets) + +Some icons have uneven visual weight. The best fix is adjusting the SVG directly so no extra margin/padding is needed in the component code. + +```tsx +// Best — fix in the SVG itself +// Adjust the viewBox or path to visually center the icon + +// Fallback — adjust with margin + + + +``` + +## Shadows Instead of Borders + +For **buttons, cards, and containers** that use a border for depth or elevation, prefer replacing it with a subtle `box-shadow`. Shadows adapt to any background since they use transparency; solid borders don't. This also helps when using images or multiple colors as backgrounds — solid border colors don't work well on backgrounds other than the ones they were designed for. + +**Do not apply this to dividers** (`border-b`, `border-t`, side borders) or any border whose purpose is layout separation rather than element depth. Those should stay as borders. + +### Shadow as Border (Light Mode) + +The shadow is comprised of three layers. The first acts as a 1px border ring, the second adds subtle lift, and the third provides ambient depth: + +```css +:root { + --shadow-border: + 0px 0px 0px 1px rgba(0, 0, 0, 0.06), + 0px 1px 2px -1px rgba(0, 0, 0, 0.06), + 0px 2px 4px 0px rgba(0, 0, 0, 0.04); + --shadow-border-hover: + 0px 0px 0px 1px rgba(0, 0, 0, 0.08), + 0px 1px 2px -1px rgba(0, 0, 0, 0.08), + 0px 2px 4px 0px rgba(0, 0, 0, 0.06); +} +``` + +### Shadow as Border (Dark Mode) + +In dark mode, simplify to a single white ring — layered depth shadows aren't visible on dark backgrounds: + +```css +/* Dark mode — adapt to whatever setup the project uses + (prefers-color-scheme, class, data attribute, etc.) */ +--shadow-border: 0 0 0 1px rgba(255, 255, 255, 0.08); +--shadow-border-hover: 0 0 0 1px rgba(255, 255, 255, 0.13); +``` + +### Usage with Hover Transition + +Apply the variable and add `transition-[box-shadow]` for a smooth hover: + +```css +.card { + box-shadow: var(--shadow-border); + transition-property: box-shadow; + transition-duration: 150ms; + transition-timing-function: ease-out; +} + +.card:hover { + box-shadow: var(--shadow-border-hover); +} +``` + +### When to Use Shadows vs. Borders + +| Use shadows | Use borders | +| --- | --- | +| Cards, containers with depth | Dividers between list items | +| Buttons with bordered styles | Table cell boundaries | +| Elevated elements (dropdowns, modals) | Form input outlines (for accessibility) | +| Elements on varied backgrounds | Hairline separators in dense UI | +| Hover/focus states for lift effect | | + +## Image Outlines + +Add a subtle `1px` outline with low opacity to images. This creates consistent depth, especially in design systems where other elements use borders or shadows. + +### Color rules (non-negotiable) + +- **Light mode**: pure black — `rgba(0, 0, 0, 0.1)`. Exact values: R=0, G=0, B=0. +- **Dark mode**: pure white — `rgba(255, 255, 255, 0.1)`. Exact values: R=255, G=255, B=255. +- Never use a near-black or near-white from the project palette (e.g. slate-900, zinc-900, `#0a0a0a`, `#111827`, `#f5f5f7`). Tinted outlines pick up the surrounding surface color and read as dirt on the image edge. +- Never match the outline to the project's accent or ink color. The outline is a neutral separator, not a themed element. + +### Light Mode + +```css +img { + outline: 1px solid rgba(0, 0, 0, 0.1); + outline-offset: -1px; /* inset so it doesn't add to layout */ +} +``` + +### Dark Mode + +```css +img { + outline: 1px solid rgba(255, 255, 255, 0.1); + outline-offset: -1px; +} +``` + +### Tailwind with Dark Mode + +```tsx +{alt} +``` + +Use `outline-black/10` and `outline-white/10` specifically — not `outline-slate-*`, `outline-zinc-*`, `outline-neutral-*`, or any tinted scale. + +**Why outline instead of border?** `outline` doesn't affect layout (no added width/height), and `outline-offset: -1px` keeps it inset so images stay their intended size. + +## Minimum Hit Area + +Interactive elements should have a minimum hit area of 44×44px (WCAG) or at least 40×40px. If the visible element is smaller (e.g., a 20×20 checkbox), extend the hit area with a pseudo-element. + +### CSS Example + +```css +/* Small checkbox with expanded hit area */ +.checkbox { + position: relative; + width: 20px; + height: 20px; +} + +.checkbox::after { + content: ""; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 40px; + height: 40px; +} +``` + +### Tailwind Example + +```tsx + +``` + +### Collision Rule + +If the extended hit area overlaps another interactive element, shrink the pseudo-element — but make it as large as possible without colliding. Two interactive elements should never have overlapping hit areas. diff --git a/.agents/skills/make-interfaces-feel-better/typography.md b/.agents/skills/make-interfaces-feel-better/typography.md new file mode 100644 index 00000000000..6ca7ac7e6ed --- /dev/null +++ b/.agents/skills/make-interfaces-feel-better/typography.md @@ -0,0 +1,135 @@ +# Typography + +Typography rendering details that make interfaces feel better. + +## Text Wrapping + +### text-wrap: balance + +Distributes text evenly across lines, preventing orphaned words on headings and short text blocks. **Only works on blocks of 6 lines or fewer** (Chromium) or 10 lines or fewer (Firefox) — the balancing algorithm is computationally expensive, so browsers limit it to short text. + +```css +/* Good — even line lengths on short text */ +h1, h2, h3 { + text-wrap: balance; +} +``` + +```css +/* Bad — default wrapping leaves orphans */ +h1 { + /* no text-wrap rule → "Read our + blog" instead of balanced lines */ +} +``` + +```css +/* Bad — balance on long paragraphs (silently ignored, wastes intent) */ +.article-body p { + text-wrap: balance; +} +``` + +**Tailwind:** `text-balance` + +### text-wrap: pretty + +Prevents orphaned words (a single word dangling on the last line) by adjusting line breaks throughout the paragraph. Unlike `balance`, it doesn't try to equalize line lengths — it just ensures the last line isn't embarrassingly short. Works on text of any length with no line-count limit. + +This should be your **default for short-to-medium text** — paragraphs, descriptions, captions, list items, card text. For very long text (10+ lines), skip both `pretty` and `balance` — the browser's default wrapping is fine and you avoid unnecessary layout cost. + +```css +/* Good — descriptions, captions, short paragraphs */ +p, li, figcaption, blockquote { + text-wrap: pretty; +} +``` + +```tsx +// Tailwind +

+ A short paragraph that won't leave an orphan on the last line. +

+``` + +**Tailwind:** `text-pretty` + +### When to Use Which + +| Scenario | Use | +| --- | --- | +| Headings, titles where even distribution matters | `text-wrap: balance` | +| Short-to-medium text — paragraphs, descriptions, captions, UI text | `text-wrap: pretty` | +| Long text (10+ lines), code blocks, pre-formatted text | Neither — leave default | + +## Font Smoothing (macOS) + +On macOS, text renders heavier than intended by default. Apply antialiased smoothing to the root layout so all text renders crisper and thinner. + +```css +/* CSS */ +html { + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +``` + +```tsx +// Tailwind — apply to root layout + +``` + +### Good vs. Bad + +```css +/* Good — applied once at the root */ +html { + -webkit-font-smoothing: antialiased; +} + +/* Bad — applied per-element, inconsistent */ +.heading { + -webkit-font-smoothing: antialiased; +} +.body { + /* no smoothing → heavier than heading */ +} +``` + +**Note:** This only affects macOS rendering. Other platforms ignore these properties, so it's safe to apply universally. + +## Tabular Numbers + +When numbers update dynamically (counters, prices, timers, table columns), use tabular-nums to make all digits equal width. This prevents layout shift as values change. + +```css +/* CSS */ +.counter { + font-variant-numeric: tabular-nums; +} +``` + +```tsx +// Tailwind +{count} +``` + +### When to Use + +| Use tabular-nums | Don't use tabular-nums | +| --- | --- | +| Counters and timers | Static display numbers | +| Prices that update | Decorative large numbers | +| Table columns with numbers | Phone numbers, zip codes | +| Animated number transitions | Version numbers (v2.1.0) | +| Scoreboards, dashboards | | + +### Caveat + +Some fonts (like Inter) change the visual appearance of numerals with this property — specifically, the digit `1` becomes wider and centered. This is expected behavior and usually desirable for alignment, but verify it looks right in your specific font. + +```css +/* With Inter font: + Default: 1234 → proportional, "1" is narrow + Tabular: 1234 → all digits equal width, "1" centered */ +``` diff --git a/.claude/skills/make-interfaces-feel-better b/.claude/skills/make-interfaces-feel-better new file mode 120000 index 00000000000..d97f371ccf9 --- /dev/null +++ b/.claude/skills/make-interfaces-feel-better @@ -0,0 +1 @@ +../../.agents/skills/make-interfaces-feel-better \ No newline at end of file diff --git a/apps/sim/app/(landing)/components/footer/footer.tsx b/apps/sim/app/(landing)/components/footer/footer.tsx index 0607613b4e1..b0849740fba 100644 --- a/apps/sim/app/(landing)/components/footer/footer.tsx +++ b/apps/sim/app/(landing)/components/footer/footer.tsx @@ -27,6 +27,7 @@ interface FooterItem { } const PRODUCT_LINKS: FooterItem[] = [ + { label: 'Enterprise', href: '/enterprise' }, { label: 'Mothership', href: 'https://docs.sim.ai/mothership', external: true }, { label: 'Workflows', href: 'https://docs.sim.ai', external: true }, { label: 'Knowledge Base', href: 'https://docs.sim.ai/knowledgebase', external: true }, diff --git a/apps/sim/app/(landing)/components/hero/components/hero-header/hero-header.tsx b/apps/sim/app/(landing)/components/hero/components/hero-header/hero-header.tsx new file mode 100644 index 00000000000..c2e9b566956 --- /dev/null +++ b/apps/sim/app/(landing)/components/hero/components/hero-header/hero-header.tsx @@ -0,0 +1,48 @@ +import type { ReactNode } from 'react' +import { cn } from '@sim/emcn' +import { HeroStat } from '@/app/(landing)/components/hero/components/hero-stat' +import { HeroCta } from '@/app/(landing)/components/hero-cta' +import { LANDING_HERO_CTA_GAP } from '@/app/(landing)/components/landing-layout' + +interface LandingHeroHeaderProps { + description: string + eyebrow?: ReactNode + heading: ReactNode + headingId: string +} + +/** + * Shared homepage hero header geometry. Marketing routes use this component so + * the headline measure, CTA stack, and right-side global-work stat cannot drift. + */ +export function LandingHeroHeader({ + description, + eyebrow, + heading, + headingId, +}: LandingHeroHeaderProps) { + return ( +
+
+ {eyebrow} + +

+ {heading} +

+ +

+ {description} +

+ +
+ +
+
+ + +
+ ) +} diff --git a/apps/sim/app/(landing)/components/hero/components/hero-header/index.ts b/apps/sim/app/(landing)/components/hero/components/hero-header/index.ts new file mode 100644 index 00000000000..8d84bd58bca --- /dev/null +++ b/apps/sim/app/(landing)/components/hero/components/hero-header/index.ts @@ -0,0 +1 @@ +export { LandingHeroHeader } from './hero-header' diff --git a/apps/sim/app/(landing)/components/hero/components/hero-platform-loop/hero-workflow-stage.tsx b/apps/sim/app/(landing)/components/hero/components/hero-platform-loop/hero-workflow-stage.tsx index 3265e49e389..20d1ffbb057 100644 --- a/apps/sim/app/(landing)/components/hero/components/hero-platform-loop/hero-workflow-stage.tsx +++ b/apps/sim/app/(landing)/components/hero/components/hero-platform-loop/hero-workflow-stage.tsx @@ -10,7 +10,10 @@ import { STAGE_EDGES, verticalSmoothStep, } from '@/app/(landing)/components/hero/components/hero-platform-loop/stage-data' -import { BLOCK_WIDTH } from '@/app/(landing)/components/hero/components/hero-visual/workflow-data' +import { + BLOCK_WIDTH, + type BlockDef, +} from '@/app/(landing)/components/hero/components/hero-visual/workflow-data' /** Upper bound on the canvas render scale (the scale at the full 1300px cap). */ const MAX_STAGE_SCALE = 0.71 @@ -18,12 +21,16 @@ const MAX_STAGE_SCALE = 0.71 const STAGE_MARGIN = 20 interface HeroWorkflowStageProps { - /** How many of {@link STAGE_BLOCKS} (in build order) are on canvas. */ + /** How many of the stage's blocks (in build order) are on canvas. */ builtCount: number + /** Blocks to stage, in build order. Defaults to the homepage's lead flow. */ + blocks?: BlockDef[] + /** Source → target pairs among {@link blocks}. Defaults with them. */ + edges?: ReadonlyArray + /** Design-space bounding box of the block layout. Defaults with them. */ + canvas?: { width: number; height: number } } -const STAGE_BLOCKS_BY_ID = new Map(STAGE_BLOCKS.map((b) => [b.id, b])) - /** * The hero window's live workflow canvas - the right-pane counterpart of the * chat loop. Blocks pop in one by one as `builtCount` advances (staggered @@ -38,10 +45,20 @@ const STAGE_BLOCKS_BY_ID = new Map(STAGE_BLOCKS.map((b) => [b.id, b])) * Blocks reuse the hero-visual's {@link WorkflowBlockContent} (the faithful * icon-tile + rows card body) in a card shell with vertical-flow handle nubs * (top in / bottom out), matching the real editor's vertical layout. + * + * The staged flow is injectable (`blocks`/`edges`/`canvas`), defaulting to the + * homepage's lead-enrichment flow - the enterprise loop stages its own flow + * through the same component. */ -export function HeroWorkflowStage({ builtCount }: HeroWorkflowStageProps) { +export function HeroWorkflowStage({ + builtCount, + blocks = STAGE_BLOCKS, + edges = STAGE_EDGES, + canvas = STAGE_CANVAS, +}: HeroWorkflowStageProps) { const containerRef = useRef(null) const [scale, setScale] = useState(MAX_STAGE_SCALE) + const blocksById = useMemo(() => new Map(blocks.map((b) => [b.id, b])), [blocks]) // Fit the design canvas to the card: scale down when the pane narrows so the // branch blocks never clip, capped at the full-width scale. Measures LAYOUT @@ -58,8 +75,8 @@ export function HeroWorkflowStage({ builtCount }: HeroWorkflowStageProps) { setScale( Math.min( MAX_STAGE_SCALE, - (w - STAGE_MARGIN) / STAGE_CANVAS.width, - (h - STAGE_MARGIN) / STAGE_CANVAS.height + (w - STAGE_MARGIN) / canvas.width, + (h - STAGE_MARGIN) / canvas.height ) ) } @@ -67,11 +84,11 @@ export function HeroWorkflowStage({ builtCount }: HeroWorkflowStageProps) { const ro = new ResizeObserver(measure) ro.observe(el) return () => ro.disconnect() - }, []) + }, [canvas.width, canvas.height]) const builtIds = useMemo( - () => new Set(STAGE_BLOCKS.slice(0, builtCount).map((b) => b.id)), - [builtCount] + () => new Set(blocks.slice(0, builtCount).map((b) => b.id)), + [blocks, builtCount] ) return ( @@ -82,30 +99,30 @@ export function HeroWorkflowStage({ builtCount }: HeroWorkflowStageProps) {
- {STAGE_BLOCKS.map((block) => { + {blocks.map((block) => { const built = builtIds.has(block.id) return (

Sim is the open-source AI workspace where teams build, deploy, and manage AI agents. Connect @@ -72,25 +82,16 @@ export function Hero() { production-ready for teams of every size.

-
-
-

+ Sim is your AI workspace
for building agentic workflows. -

- -

- The open-source workspace where teams build, deploy, and manage AI agents. -

- - -
- - -
+ + } + description='The open-source workspace where teams build, deploy, and manage AI agents.' + />