Skip to content

auto-resolve sso provider icons via simple icons#8

Open
masnwilliams wants to merge 1 commit into
mainfrom
hypeship/auto-resolve-sso-icons
Open

auto-resolve sso provider icons via simple icons#8
masnwilliams wants to merge 1 commit into
mainfrom
hypeship/auto-resolve-sso-icons

Conversation

@masnwilliams
Copy link
Copy Markdown
Contributor

@masnwilliams masnwilliams commented May 12, 2026

Summary

Replaces the hardcoded provider switch in getSSOProviderInfo with a generic resolver, so any provider key works out of the box — no more per-provider PRs.

  • provider is slugified (google, github, okta, auth0, discord, slack, etc.).
  • Icon comes from the Simple Icons CDN (https://cdn.simpleicons.org/<slug>) via a regular <img> — 3000+ brands, MIT, no API key, no bundle cost.
  • On <img> error, falls back to a circular letter avatar with the provider's first letter — so unknown providers still render something.
  • Labels are title-cased from the provider string.
  • Non-brand keys (passkey, sso, saml) keep their existing built-in icons.
  • Removed the inline GoogleMark/GitHubMark/GitLabMark/MicrosoftMark/FacebookMark/AppleMark SVGs from icons.tsx — net -22 lines and a smaller bundle.

Trade-offs

  • Adds a CDN request per icon (cacheable). If that's not acceptable, the same shape could load icons from the simple-icons npm package with dynamic import.
  • Label loses brand-specific casing (e.g. "Github" not "GitHub"). Could be restored with a small override map, or by fetching Simple Icons' JSON metadata.

Test plan

  • bun run typecheck passes
  • Library builds (bundle shrinks ~4 KB)
  • Demo renders google/github/gitlab/facebook/okta/auth0/discord/slack via CDN, and a fake provider falls back to a letter avatar
  • Decide on the label-casing trade-off

Note

Medium Risk
Introduces runtime CDN-loaded provider icons (and a fallback) which can affect UI rendering and reliability if the network/CDN or provider slug is unavailable; otherwise changes are localized to SSO button display.

Overview
SSO provider rendering is generalized: getSSOProviderInfo now slugifies the provider string, title-cases the label, and renders an icon by loading https://cdn.simpleicons.org/<slug> with an on-error fallback to a circular first-letter avatar.

Built-in icons are retained only for non-brand providers (passkey, sso, saml), and the previously inlined brand SVG marks (Google/GitHub/Microsoft/Facebook/Apple) are removed from icons.tsx. Styling adds kma-sso-icon--letter to support the new fallback avatar.

Reviewed by Cursor Bugbot for commit 0c8c226. Bugbot is set up for automated code reviews on this repo. Configure here.

@masnwilliams masnwilliams marked this pull request as ready for review May 12, 2026 20:45
@firetiger-agent
Copy link
Copy Markdown

Firetiger deploy monitoring skipped

This PR didn't match the auto-monitor filter configured on your GitHub connection:

Any PR that changes the kernel API. Monitor changes to API endpoints (packages/api/cmd/api/) and Temporal workflows (packages/api/lib/temporal) in the kernel repo

Reason: PR modifies SSO provider icon handling in the UI layer, not kernel API endpoints or Temporal workflows as specified in the filter.

To monitor this PR anyway, reply with @firetiger monitor this.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0c8c226. Configure here.

return { label: provider, icon: null };
const key = slugify(provider);
const nonBrand = NON_BRAND_ICONS[key];
if (nonBrand) return nonBrand;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-brand providers lose substring matching, breaking compound names

Medium Severity

The old code used p.includes("saml") || p.includes("sso") to match provider strings, so compound names like "enterprise-sso" or "saml-provider" would correctly get the building icon. The new code slugifys the provider (yielding e.g. "enterprisesso") and does an exact dictionary lookup against NON_BRAND_ICONS, which only has keys "passkey", "sso", and "saml". These compound names now miss the non-brand check entirely, hit the CDN path, fail to load, and degrade to a letter avatar instead of the intended BuildingIcon or KeyIcon.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c8c226. Configure here.

onError={() => setErrored(true)}
/>
);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale error state persists across provider prop changes

Low Severity

SSOProviderIcon stores CDN load failure in errored state via useState, but never resets it when the provider prop changes. If a CDN request fails for one provider and then the component receives a different provider (e.g., ssoProvider changes in the parent while the tree position stays mounted), the stale errored = true causes the new provider to immediately render the letter-avatar fallback instead of attempting its own CDN fetch.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0c8c226. Configure here.

@masnwilliams masnwilliams requested a review from dcruzeneil2 May 12, 2026 23:06
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