Skip to content

feat(ui): add DataTypeIcon component with inline schema integration#1189

Open
danyelf wants to merge 25 commits intomainfrom
worktree-datatypeicon
Open

feat(ui): add DataTypeIcon component with inline schema integration#1189
danyelf wants to merge 25 commits intomainfrom
worktree-datatypeicon

Conversation

@danyelf
Copy link
Contributor

@danyelf danyelf commented Mar 7, 2026

Summary

  • Add DataTypeIcon component that displays semantic icons for SQL data types (integer, number, text, boolean, date, datetime, time, binary, json, array, unknown)
  • classifyType() maps raw SQL type strings (e.g. VARCHAR(256), TIMESTAMP_NTZ, TINYINT(1)) to visual categories across Snowflake, PostgreSQL, BigQuery, and DuckDB
  • Inline DataTypeIcon next to column names in schema diff views, profile views, and column-level lineage nodes
  • Remove standalone data_type column from schema grids — type info is now shown via the icon with tooltip
  • Add buildColumnTooltip() for rich column status tooltips (type, diff status, CLL availability)
  • Storybook stories use design system tokens (var(--schema-color-muted), row CSS classes) instead of hardcoded colors

Test plan

  • 3410 tests pass (pnpm test)
  • TypeScript type check passes (pnpm type:check)
  • Biome lint passes (pnpm lint:fix)
  • Visual check in Storybook: UI/DataTypeIcon stories render all categories, sizes, and real-world types
  • Visual check in Storybook: Schema diff stories show inline icons with correct badges
  • Manual test with recce server: schema diff view shows icons inline with column names
  • Manual test: profile view shows icons, lineage column nodes show icons

DCO

All commits signed off.

image image image

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

danyelf and others added 24 commits March 5, 2026 21:01
Pure function that maps raw database type strings (e.g. VARCHAR(256),
TIMESTAMP_NTZ) to a TypeCategory enum. Handles case insensitivity,
parameterized types, and the TINYINT(1)->boolean special case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Replace text-based type labels with DataTypeIcon SVG icons in the
schema diff view's type column. Icons inherit currentColor from the
existing type-badge CSS classes for diff coloring. DataTypeIcon provides
its own tooltip, so title attributes are removed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Renders data_type values as DataTypeIcon with tooltip in profile and
profile_diff grids. Renames dataGridFactory to .tsx to support JSX.
Handles both flat columns (single env) and grouped columns (side-by-side diff).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Replace plain text column type display with DataTypeIcon component
in CLL nodes. The 16px icon fits the compact 24px node height, with
0.7 opacity to keep it visually secondary to the column name.

Update tests to assert on data-type-icon testid instead of plain
text type strings, since DataTypeIcon renders an SVG with tooltip.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
All icons now share a uniform viewBox (30x18) with a rounded-rect
border. Content (text or line-art) is drawn inside the box, making
the border part of the icon itself (Tableau-style).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Use dominantBaseline="central" instead of manual y offset
for proper vertical centering at all zoom levels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
The schema story had its own inline cellRenderer that wasn't using
DataTypeIcon. Updated to match the real renderTypeCell implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
In inline diff mode, data_type column values are stored under
base__data_type and current__data_type prefixed keys, not directly
under "data_type". The simple dataTypeIconCellRenderer reads
params.value which resolves to undefined for inline diff columns.

Add dataTypeIconInlineDiffCellRenderer that reads from both prefixed
keys and renders appropriate DataTypeIcon(s) with diff styling when
types differ between base and current.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
The previous check used cellRenderer presence to distinguish inline diff
from simple profile columns, but buildSimpleColumnDefinitions always sets
a defaultRenderCell — causing simple profile data_type columns to be
incorrectly treated as inline diff and rendering nothing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Allow parent components to suppress the built-in MUI Tooltip when they
provide their own tooltip wrapper around DataTypeIcon.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Pure function that generates tooltip text from column status info
(added, removed, type_changed, definition_changed, unchanged).
Shared between schema and profile views. Includes CLL suffix
when column lineage is available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
…s tooltips

- Import DataTypeIcon and buildColumnTooltip into ColumnNameCell
- Show single icon for unchanged/added/removed columns, dual icons
  (old → new) for type-changed columns
- Replace static "View column lineage" tooltip with contextual status
  tooltip from buildColumnTooltip (always shown, not just when CLL available)
- Handle singleEnv mode by falling back to row.type for column type
- Add 4 new test cases covering unchanged, type-changed, added, and
  removed column icon rendering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
The DataTypeIcon is now rendered inline in the ColumnNameCell, making
the separate Type column redundant. Remove the type column definition
from both toSchemaDataGrid and toSingleEnvDataGrid, delete the
renderTypeCell function and its tests, and clean up the associated
CSS classes (schema-column-type, schema-type-old, schema-type-new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
…ype column

Replace injectDataTypeIconRenderer with injectProfileColumnNameRenderer that:
- Removes data_type columns (flat and side-by-side children) from profile grids
- Injects custom cell renderers on column_name that show name + DataTypeIcon inline
- Uses Tooltip with buildColumnTooltip for rich hover text
- Handles inline diff mode with base/current type change visualization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
…layout

Remove the standalone Type column from storybook schema fixtures and render
DataTypeIcon inline within the Name cell, matching the production ColumnNameCell
component. Removes references to deleted CSS classes (schema-column-type,
schema-type-old, schema-type-new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
4px margin-left in schema ColumnNameCell, 6px gap in profile renderers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Icons were too small at 16px and the bottom border was getting clipped
by overflow:hidden. Bumped to size={20} and added height:100% to the
flex container.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Use buildColumnTooltip and disableTooltip on DataTypeIcons to match
the real ColumnNameCell tooltip behavior. Export buildColumnTooltip
from @datarecce/ui top-level barrel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Remove DiffContext story (diff integration already covered by schema
stories). Fix React Fragment keys in AllCategories and RealWorldTypes.
Replace hardcoded hex colors with var(--schema-color-muted). Add
schema/style.css to @datarecce/ui/styles entry point.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
@danyelf danyelf requested a review from gcko March 7, 2026 00:29
Replace polynomial regex /\s*\(.*\)$/ with indexOf("(") + slice()
to eliminate potential backtracking on adversarial input.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Danyel Fisher <danyel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant