Skip to content

Conversation

@amcaplan
Copy link
Contributor

@amcaplan amcaplan commented Nov 6, 2025

WHY are these changes introduced?

This PR builds on PRs #6578 and #6579 by adding the foundational UI components that will be used throughout the GraphiQL console. This is the third PR in the 8-PR migration stack.

Context: The current template-based GraphiQL implementation manipulates the DOM directly and uses CSS toggling to show/hide status indicators. By creating reusable React components using Shopify Polaris, we can:

  • Replace manual DOM manipulation with declarative React components
  • Ensure consistent styling and behavior across the UI
  • Make components easier to test and maintain
  • Use Shopify's design system for a cohesive look and feel

WHAT is this pull request doing?

This PR adds three essential UI components that handle status display, error messaging, and navigation links.

Key Changes:

1. StatusBadge Component (src/components/StatusBadge/):

  • Displays current server and app connection status
  • Three states with priority order: Disconnected (critical) > App uninstalled (warning) > Running (success)
  • Uses Polaris Badge with appropriate tones and icons
  • Replaces: 3 pre-rendered badges toggled via CSS classes in the old implementation

Visual States:

🔴 Disconnected    (serverIsLive = false)
⚠️  App uninstalled (serverIsLive = true, appIsInstalled = false)  
✅ Running         (both true)

2. ErrorBanner Component (src/components/ErrorBanner/):

  • Shows critical error banner when server disconnects
  • Instructs user to restart dev CLI command
  • Uses Polaris Banner with critical tone
  • Replaces: Manual CSS class toggling to show/hide error message

3. LinkPills Component (src/components/LinkPills/):

  • Displays clickable links to store admin and app preview
  • Only renders when all required data is available (storeFqdn, appName, appUrl)
  • Uses Polaris Badge + Link with info tone and link icon
  • Replaces: Direct innerHTML manipulation in the old implementation

All Components Include:

  • TypeScript interfaces for props
  • Comprehensive test coverage (173 total test lines)
  • SCSS modules for custom styling
  • Clean barrel exports via index.ts

Files Added:

  • src/components/StatusBadge/ - Status display component (58 test lines)
  • src/components/ErrorBanner/ - Error messaging component (42 test lines)
  • src/components/LinkPills/ - Navigation links component (73 test lines)

Dependencies

Builds on:

How to test your changes?

# Run all component tests
pnpm --filter @shopify/graphiql-console test src/components

# Run specific component tests
pnpm --filter @shopify/graphiql-console test StatusBadge.test.tsx
pnpm --filter @shopify/graphiql-console test ErrorBanner.test.tsx
pnpm --filter @shopify/graphiql-console test LinkPills.test.tsx

# Type check
pnpm --filter @shopify/graphiql-console tsc --noEmit

# All 173 lines of tests should pass

Manual Testing:
You can test the components in isolation by importing them into the App component:

import {StatusBadge} from './components/StatusBadge'
import {ErrorBanner} from './components/ErrorBanner'
import {LinkPills} from './components/LinkPills'

// Test different states
<StatusBadge status={{serverIsLive: true, appIsInstalled: true, ...}} />
<ErrorBanner isVisible={true} />
<LinkPills status={{storeFqdn: 'test.myshopify.com', ...}} />

Measuring impact

  • n/a - these are foundational UI components

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

amcaplan commented Nov 6, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 79.33% 13668/17229
🟡 Branches 73.24% 6696/9143
🟡 Functions 79.44% 3523/4435
🟡 Lines 79.69% 12909/16199

Test suite run success

3399 tests passing in 1391 suites.

Report generated by 🧪jest coverage report action from cb351dd

@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch from 106240c to ece610f Compare November 6, 2025 16:53
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_shared_types_constants_and_validation branch from b199d75 to f14423d Compare November 6, 2025 17:27
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch from ece610f to b31bbbe Compare November 6, 2025 17:27
@amcaplan amcaplan changed the base branch from 11-06-feat_graphiql_add_shared_types_constants_and_validation to graphite-base/6580 November 6, 2025 21:20
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch from b31bbbe to 4ff63c5 Compare November 6, 2025 21:20
@amcaplan amcaplan changed the base branch from graphite-base/6580 to 11-06-feat_graphiql_add_shared_types_constants_and_validation November 6, 2025 21:20
@amcaplan amcaplan changed the base branch from 11-06-feat_graphiql_add_shared_types_constants_and_validation to graphite-base/6580 November 6, 2025 21:27
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch from 4ff63c5 to 47297ec Compare November 6, 2025 21:28
@amcaplan amcaplan changed the base branch from graphite-base/6580 to 11-06-feat_graphiql_add_shared_types_constants_and_validation November 6, 2025 21:28
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch 3 times, most recently from d2a007d to f3f94ef Compare November 6, 2025 22:14
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_shared_types_constants_and_validation branch from 8c2c496 to fdf8d16 Compare November 6, 2025 22:14
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch from f3f94ef to e4e87e9 Compare November 6, 2025 22:27
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_shared_types_constants_and_validation branch 2 times, most recently from 1c51420 to 1e1e3f6 Compare November 6, 2025 22:46
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch 2 times, most recently from db5e515 to 0cd0b46 Compare November 6, 2025 22:55
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_shared_types_constants_and_validation branch from 1e1e3f6 to d5b6f9a Compare November 6, 2025 23:17
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch 2 times, most recently from 45c17b5 to d34bd65 Compare November 6, 2025 23:21
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_shared_types_constants_and_validation branch from d5b6f9a to 3274ef0 Compare November 6, 2025 23:21
Adds simple, self-contained UI components using Shopify Polaris.

- Add StatusBadge component with connection status display
- Add ErrorBanner component for error messaging
- Add LinkPills component for store/app links
- Include comprehensive tests (173 lines)

All component tests pass
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_base_ui_components branch from d34bd65 to cb351dd Compare November 6, 2025 23:34
@amcaplan amcaplan force-pushed the 11-06-feat_graphiql_add_shared_types_constants_and_validation branch from 3274ef0 to 9296984 Compare November 6, 2025 23:34
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