From 0249516cab546d89ec60fc9524b885071d08a7f2 Mon Sep 17 00:00:00 2001 From: Waleed Date: Fri, 3 Jul 2026 20:58:13 -0700 Subject: [PATCH] fix(compare): swap LangChain logo, fix comparison-table horizontal scroll (#5409) * fix(compare): swap LangChain logo, fix comparison-table horizontal scroll Replace LangChainIcon's path with the official brand mark (light-blue link icon) instead of the prior monochrome recreation. The comparison table's grid cells were missing min-w-0, so a grid item without it sizes to its content's max-content width instead of respecting its column's fr track, pushing the whole table wider than its container and forcing a horizontal scrollbar. Add min-w-0 to every grid cell/header, and size the row-label column to minmax(140px, max-content) instead of a guessed fr ratio, so it's exactly as wide as its longest label ("Vetted first-party integrations") needs and no wider, leaving the Sim/competitor value columns their full share. * fix(compare): stacked mobile layout for the comparison table Below sm (640px) a 3-column table has no room to be legible even with the sticky label column, so switch to the standard responsive-table pattern instead: each fact stacks as label -> Sim's value -> the competitor's value, each value tagged with its product name since the column headers are no longer directly above. Pure CSS (max-sm:/sm: variants), no JS, keeping this a zero-hydration server component. * fix(compare): fix SourceLink inline-anchor overflow, align table breakpoint Root cause of the persistent table-overflow/mobile-scroll issues: SourceLink renders a plain with no explicit display, so it defaults to 'display: inline'. min-width and truncate are no-ops on inline elements, so any fact with a source (nearly all of them) ignored its flex/grid parent's width constraint and could force the whole row (and thus the whole table) wider than intended, regardless of any container-level min-w-0/max-content fix. Give the anchor 'block min-w-0' so width constraints and truncation actually cascade down to the wrapped value. Also aligns the table's mobile-stack breakpoint from an ad hoc sm (640px) to lg (1024px), matching this route group's own tablet-and-below convention (.claude/rules for the (landing) group), and fixes the stacked mobile cells to override the cell's base items-center with items-stretch so the name tag and value get a real full-width box to truncate within instead of shrinking to their own content size with no boundary. * fix(compare): add min-w-0 to ColumnHeader per Greptile review ColumnHeader (the Sim/competitor logo header cells in the two fr columns) still had default min-width: auto, so an unusually long competitor name could size the header to its min-content width and push the grid wider than its column allows, same root cause as the rows already fixed. --- .../comparison-table/comparison-table.tsx | 79 ++++++++++++++++--- .../components/source-info/source-info.tsx | 4 +- apps/sim/components/icons.tsx | 4 +- 3 files changed, 72 insertions(+), 15 deletions(-) diff --git a/apps/sim/app/(landing)/comparison/components/comparison-table/comparison-table.tsx b/apps/sim/app/(landing)/comparison/components/comparison-table/comparison-table.tsx index 70a21ae4e2..2b13db9483 100644 --- a/apps/sim/app/(landing)/comparison/components/comparison-table/comparison-table.tsx +++ b/apps/sim/app/(landing)/comparison/components/comparison-table/comparison-table.tsx @@ -10,6 +10,39 @@ export interface ComparisonTableProps { competitor: CompetitorProfile } +/** + * Pins the row-label column during horizontal scroll on genuinely spacious + * viewports (the standard pattern for responsive data tables, e.g. + * Stripe/GitHub/Notion comparison tables) so a reader keeps row context while + * scrolling to see the Sim/competitor values. Below `lg` (this page's own + * tablet-and-below tier, per `.claude/rules` for this route group) the table + * switches to a stacked layout instead (see `MOBILE_STACK_*`) rather than + * relying on horizontal scroll at a width too narrow to render a 3-column + * table comfortably, so sticky positioning is scoped to `lg:` only. The + * shadow is a permanent CSS-only affordance (no scroll-position JS) so this + * stays a zero-hydration server component. + */ +const STICKY_LABEL_COL = 'lg:sticky lg:left-0 lg:z-10 lg:shadow-[2px_0_4px_-2px_rgba(0,0,0,0.08)]' + +/** + * Below `lg` (1024px) a 3-column grid doesn't reliably have room to be + * legible, so each fact instead stacks as label -> Sim's value -> the + * competitor's value, with a small name tag on each value since the column + * headers are no longer directly above. Applied to the label cell. + */ +const MOBILE_STACK_LABEL = 'max-lg:border-r-0 max-lg:border-b-0 max-lg:pt-3 max-lg:pb-1' + +/** + * Applied to a value cell (Sim's or the competitor's) in the stacked mobile + * layout. `items-stretch` overrides the cell's base `items-center` (which + * would otherwise shrink-wrap and center each child horizontally in a + * flex-col): stretching gives the name tag and the value their own + * full-width box to left-align and truncate within, instead of a + * content-sized box with no boundary to clip against. + */ +const MOBILE_STACK_VALUE = + 'max-lg:flex-col max-lg:items-stretch max-lg:gap-0.5 max-lg:border-r-0 max-lg:px-4' + function ColumnHeader({ name, iconTile, @@ -22,12 +55,14 @@ function ColumnHeader({ return (
{iconTile} - {name} + + {name} +
) } @@ -49,15 +84,21 @@ export function ComparisonTable({ sim, competitor }: ComparisonTableProps) {
- Compare - + + Compare + + {sim.name} vs {competitor.name}
@@ -89,6 +130,8 @@ export function ComparisonTable({ sim, competitor }: ComparisonTableProps) { role='columnheader' className={cn( 'border-[var(--border)] border-r bg-[var(--surface-1)] px-4 py-2', + STICKY_LABEL_COL, + 'max-lg:border-r-0', sectionIdx > 0 && 'border-[var(--border-1)] border-t' )} > @@ -99,7 +142,7 @@ export function ComparisonTable({ sim, competitor }: ComparisonTableProps) {
0 && 'border-[var(--border-1)] border-t' )} /> @@ -115,28 +158,42 @@ export function ComparisonTable({ sim, competitor }: ComparisonTableProps) {
- {row.label} + + {row.label} +
+ + {sim.name} +
+ + {competitor.name} +
diff --git a/apps/sim/app/(landing)/comparison/components/source-info/source-info.tsx b/apps/sim/app/(landing)/comparison/components/source-info/source-info.tsx index fba0e4debd..200d1c35aa 100644 --- a/apps/sim/app/(landing)/comparison/components/source-info/source-info.tsx +++ b/apps/sim/app/(landing)/comparison/components/source-info/source-info.tsx @@ -1,7 +1,7 @@ 'use client' import type { ReactNode } from 'react' -import { Tooltip } from '@sim/emcn' +import { cn, Tooltip } from '@sim/emcn' import type { FactSource } from '@/lib/compare/data' export interface SourceLinkProps { @@ -29,7 +29,7 @@ export function SourceLink({ source, children, className }: SourceLinkProps) { target='_blank' rel='noopener noreferrer' aria-label={`${source.label} (opens source)`} - className={className} + className={cn('block min-w-0', className)} > {children}
diff --git a/apps/sim/components/icons.tsx b/apps/sim/components/icons.tsx index 9505f29ee9..ea1eeea8a1 100644 --- a/apps/sim/components/icons.tsx +++ b/apps/sim/components/icons.tsx @@ -1565,8 +1565,8 @@ export function LangChainIcon(props: SVGProps) { return ( )