Skip to content

Add PR card UI with Query Github Event Data#4087

Open
lucaslyl wants to merge 5 commits intomainfrom
CS-10224-pr-card
Open

Add PR card UI with Query Github Event Data#4087
lucaslyl wants to merge 5 commits intomainfrom
CS-10224-pr-card

Conversation

@lucaslyl
Copy link
Contributor

@lucaslyl lucaslyl commented Feb 28, 2026

Summary

  • Blocked by Cs 10217 trigger command on webhook event #4074 (real PR data integration). Creating this PR card ahead of time with mock data so the UI can be reviewed and iterated on independently.
  • Adds a PrCard card type with isolated and fitted templates, styled using a github-pr-brand-guide.json Theme card.

What's Included

  • pr-card.gts: PrCard card definition with fields (prTitle, prNumber, prUrl, submittedBy, submittedAt, listing)
  • github-pr-brand-guide.json: GitHub-themed color palette as a Boxel Theme card
  • Sample instance JSON wired to a demo owner

Demo:

Isolated:
image

Fitted:
image

@lucaslyl lucaslyl self-assigned this Feb 28, 2026
@lucaslyl lucaslyl requested a review from a team February 28, 2026 12:35
@github-actions
Copy link

Host Test Results

    1 files  ±0      1 suites  ±0   1h 53m 25s ⏱️ + 1m 1s
1 915 tests ±0  1 900 ✅ +1  15 💤 ±0  0 ❌ ±0 
1 930 runs  ±0  1 915 ✅ +2  15 💤 ±0  0 ❌  - 1 

Results for commit d850a5d. ± Comparison against base commit 079e239.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new PrCard UI in the catalog realm using mock PR state/review/CI data, along with a GitHub-styled Theme card and a demo card instance to showcase the design before real data integration (blocked by #4074).

Changes:

  • Added PrCard card definition with isolated/embedded/fitted templates and styling.
  • Added a GitHub PR-themed Brand Guide (Theme card) to supply design tokens/palette.
  • Added a sample PrCard instance JSON wired to a demo listing + theme.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
packages/catalog-realm/pr-card/pr-card.gts New PrCard card definition + isolated/fitted templates with mock CI/review state and extensive scoped CSS.
packages/catalog-realm/Theme/github-pr-brand-guide.json New GitHub PR brand guide Theme card (palette/typography/variables) for consistent styling.
packages/catalog-realm/PrCard/b306784c-a34b-40fb-90c8-61bba0d1e9c7.json Demo PrCard instance referencing the PrCard module, a listing, and the new theme.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +687 to +706
class FittedTemplate extends Component<typeof PrCard> {
get mockCi() {
return MOCK_CI;
}
get mockReviews() {
return MOCK_REVIEWS;
}
get stateLabel() {
return prStateLabel(MOCK_STATE);
}
get pillColor() {
return stateColor(this.stateLabel);
}

get prTitle() {
return this.args.model.prTitle ?? 'Pull Request';
}
get prUrl() {
return this.args.model.prUrl ?? '#';
}
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

IsolatedTemplate and FittedTemplate duplicate the same mock-data getters and derived computations (mockCi, mockReviews, stateLabel, pillColor, prTitle, prUrl, review aggregations). This makes future changes error-prone (easy to update one template and forget the other). Consider extracting shared logic into a helper module or a base component/mixin used by both templates.

Copilot uses AI. Check for mistakes.
Comment on lines +1393 to +1400
/* Horizontal divider between CI and reviews */
.status-divider {
height: 1px;
background: var(--border, #d0d7de);
flex-shrink: 0;
margin: 0 var(--boxel-sp-lg);
}

Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

FittedTemplate’s styles define .status-divider (and container-query tweaks for it), but the fitted template markup doesn’t render an element with class='status-divider'. This is dead CSS (or a missing divider in the layout). Either add the divider element where intended, or remove the unused styles and container-query adjustments.

Suggested change
/* Horizontal divider between CI and reviews */
.status-divider {
height: 1px;
background: var(--border, #d0d7de);
flex-shrink: 0;
margin: 0 var(--boxel-sp-lg);
}

Copilot uses AI. Check for mistakes.
// === Computed ===
@field cardTitle = contains(StringField, {
computeVia(this: PrCard) {
return this.prTitle ?? `PR #${this.prNumber}`;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

cardTitle can become PR #undefined when both prTitle and prNumber are unset. This produces a confusing title and may leak "undefined" into UI/search. Consider falling back to a generic title when prNumber is null/undefined (or require prNumber).

Suggested change
return this.prTitle ?? `PR #${this.prNumber}`;
if (this.prTitle) {
return this.prTitle;
}
if (this.prNumber !== null && this.prNumber !== undefined) {
return `PR #${this.prNumber}`;
}
return 'Pull request';

Copilot uses AI. Check for mistakes.
}

get prUrl() {
return this.args.model.prUrl ?? '#';
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

Using '#' as a fallback for prUrl means the external-link anchors will still render and open a meaningless URL in a new tab when the field is missing. Prefer returning null/undefined and conditionally rendering the link only when a real URL is present (same applies to the fitted template’s prUrl getter).

Suggested change
return this.args.model.prUrl ?? '#';
return this.args.model.prUrl ?? null;

Copilot uses AI. Check for mistakes.
target='_blank'
rel='noopener noreferrer'
class='pr-external-link'
title='Open PR on GitHub'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

This external-link anchor is icon-only. Add an accessible name (e.g., aria-label or visually-hidden text) so screen readers can announce the purpose. The same pattern appears on the review link(s) and in the fitted template.

Suggested change
title='Open PR on GitHub'
title='Open PR on GitHub'
aria-label='Open PR on GitHub'

Copilot uses AI. Check for mistakes.
target='_blank'
rel='noopener noreferrer'
class='review-external-link'
title='View review on GitHub'
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The link title says "View review on GitHub" but the href points to the PR URL (this.prUrl), not a review-specific URL. This is misleading; either adjust the copy to match what the link does, or (once available) link directly to the review/comment permalink.

Suggested change
title='View review on GitHub'
title='View pull request on GitHub'

Copilot uses AI. Check for mistakes.
@lucaslyl lucaslyl changed the title Add PR card UI with mock data Add PR card UI with Query Github Event Data Mar 3, 2026
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.

2 participants