Skip to content

feat: add clickable status badges for GitHub Projects status changes#78

Merged
kubrickcode merged 1 commit into
mainfrom
develop/shlee/40
Dec 1, 2025
Merged

feat: add clickable status badges for GitHub Projects status changes#78
kubrickcode merged 1 commit into
mainfrom
develop/shlee/40

Conversation

@kubrickcode
Copy link
Copy Markdown
Owner

Implement dropdown UI to change status directly from issue list like Linear

  • Integrate GitHub GraphQL updateProjectV2ItemFieldValue mutation
  • Change OAuth scope from read:project to project (write access)
  • Optimistic UI for instant feedback with rollback on failure
  • Add esbuild bundler for browser compatibility
  • Add message validation and input validation

fix #40

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
github-project-status-viewer Ready Ready Preview Comment Dec 1, 2025 10:26am
github-project-status-viewer-p4ii Ready Ready Preview Comment Dec 1, 2025 10:26am

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience for managing GitHub Projects by introducing interactive status badges directly within issue lists. Users can now click on a project status badge to reveal a dropdown menu, enabling them to update an issue's status without navigating away from the current page. This feature is powered by integrating GitHub's GraphQL API for write operations, supported by an updated OAuth scope, and includes an optimistic UI for a seamless and responsive interaction. The project's build process has also been streamlined with the adoption of esbuild.

Highlights

  • Interactive Status Badges: Introduced clickable status badges for GitHub Projects, allowing users to change an issue's status directly from the issue list.
  • Dropdown UI for Status Updates: Implemented a dropdown user interface that appears when a status badge is clicked, providing options to update the project status.
  • GitHub GraphQL Integration: Integrated the GitHub GraphQL API's updateProjectV2ItemFieldValue mutation to facilitate status changes.
  • OAuth Scope Update: Changed the OAuth scope from read:project to project to enable write access for updating project statuses.
  • Optimistic UI: Implemented optimistic UI updates, providing instant feedback to the user when a status is changed, with a rollback mechanism in case of API failure.
  • Esbuild Bundler: Added esbuild as a bundler for improved performance and browser compatibility of the extension's JavaScript and TypeScript files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an excellent new feature: clickable status badges that allow users to change an issue's project status directly from the list view. The implementation is robust, featuring an optimistic UI with rollback on failure, good separation of concerns with new services for the dropdown and badge rendering, and strong adherence to accessibility best practices. My review focuses on a few areas to further improve code quality and align with the repository's style guide, such as reducing minor code duplication, consistently applying function argument patterns, and extracting constants. Overall, this is a well-executed and valuable addition.

Comment thread extension/public/styles.css Outdated
Comment on lines +159 to +161
.project-status-badge--clickable.project-status-badge--compact:hover {
cursor: pointer;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This CSS rule is redundant. The .project-status-badge--clickable class, defined on line 141, already sets cursor: pointer;. This rule can be safely removed to avoid unnecessary code.

Comment thread extension/src/content.ts Outdated
Comment on lines +114 to +122
const addStatusBadge = async (
issueNumber: number,
status: string,
color: string | null,
projectId: string | null,
projectItemId: string | null,
statusFieldId: string | null,
statusOptions: StatusOption[] | null
) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This function addStatusBadge takes 7 arguments, which can make it hard to read and prone to errors. According to the style guide, functions with two or more arguments should use an object for parameters to improve readability and make future modifications easier.1

I suggest refactoring this to accept a single object parameter.

Footnotes

  1. Style Guide (lines 110-116): "Object form in most situations with 2+ arguments."

Comment on lines +93 to +121
badge.addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
onBadgeClick({
badge,
currentStatus: status,
issueNumber,
projectId,
projectItemId,
statusFieldId,
statusOptions,
});
});

badge.addEventListener("keydown", (e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
e.stopPropagation();
onBadgeClick({
badge,
currentStatus: status,
issueNumber,
projectId,
projectItemId,
statusFieldId,
statusOptions,
});
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The logic for handling the click and keydown events is duplicated. To adhere to the "Don't Repeat Yourself" (DRY) principle and the style guide's rule on modularization, you can extract the shared logic into a separate handler function.1

    const handleInteraction = (e: MouseEvent | KeyboardEvent) => {
      e.preventDefault();
      e.stopPropagation();
      onBadgeClick({
        badge,
        currentStatus: status,
        issueNumber,
        projectId,
        projectItemId,
        statusFieldId,
        statusOptions,
      });
    };

    badge.addEventListener("click", handleInteraction);

    badge.addEventListener("keydown", (e) => {
      if (e.key === "Enter" || e.key === " ") {
        handleInteraction(e);
      }
    });

Footnotes

  1. Style Guide (lines 34-37): "While it might be missed when contexts are far apart, code repetition is absolutely prohibited in recognized situations. Modularize similar pattern repetitions (not just identical code) into reusable forms."

Comment on lines 212 to 233
export const updateBadgeStatus = (
issueNumber: number,
newStatus: string,
newColor: string | null
): void => {
const badge = document.querySelector<HTMLElement>(
`.${CSS_CLASSES.BADGE}[data-issue-number="${issueNumber}"]`
);

if (!badge) return;

badge.setAttribute("data-status", newStatus);
badge.style.setProperty("--status-color", newColor || UI_DEFAULTS.BADGE_COLOR);

const isCompact = badge.classList.contains(CSS_CLASSES.BADGE_COMPACT);
if (isCompact) {
badge.title = newStatus;
badge.setAttribute("aria-label", `Status: ${newStatus}`);
} else {
badge.textContent = newStatus;
}
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This function updateBadgeStatus takes 3 arguments. According to the style guide, functions with 2 or more arguments should generally use an object for parameters to improve readability and make it easier to add/remove arguments in the future.1

I suggest refactoring this to accept a single object parameter. This will also make the call sites in content.ts more explicit.

export const updateBadgeStatus = ({
  issueNumber,
  newStatus,
  newColor,
}: {
  issueNumber: number;
  newStatus: string;
  newColor: string | null;
}): void => {
  const badge = document.querySelector<HTMLElement>(
    `.${CSS_CLASSES.BADGE}[data-issue-number="${issueNumber}"]`
  );

  if (!badge) return;

  badge.setAttribute("data-status", newStatus);
  badge.style.setProperty("--status-color", newColor || UI_DEFAULTS.BADGE_COLOR);

  const isCompact = badge.classList.contains(CSS_CLASSES.BADGE_COMPACT);
  if (isCompact) {
    badge.title = newStatus;
    badge.setAttribute("aria-label", `Status: ${newStatus}`);
  } else {
    badge.textContent = newStatus;
  }
};

Footnotes

  1. Style Guide (lines 110-116): "Object form in most situations with 2+ arguments."

Comment thread extension/src/services/github-api.service.spec.ts
Comment thread extension/src/services/github-api.service.ts Outdated
Comment thread extension/src/services/status-dropdown.service.ts
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an excellent new feature that allows users to change a project's status directly from the issue list. The implementation is robust, featuring a clean separation of concerns with the new status-dropdown.service.ts, optimistic UI updates with error rollbacks, and the use of esbuild for a streamlined build process. My review focuses on a few areas to enhance code quality and ensure alignment with the repository's coding conventions, primarily by reducing code duplication and adhering to function signature guidelines. Overall, this is a very strong contribution.

Comment thread extension/public/styles.css
Comment thread extension/src/content.ts Outdated
Comment thread extension/src/services/badge-renderer.service.ts Outdated
Comment thread extension/src/services/github-api.service.ts Outdated
Comment thread extension/src/services/status-dropdown.service.ts
Implement dropdown UI to change status directly from issue list like Linear
- Integrate GitHub GraphQL updateProjectV2ItemFieldValue mutation
- Change OAuth scope from read:project to project (write access)
- Optimistic UI for instant feedback with rollback on failure
- Add esbuild bundler for browser compatibility
- Add message validation and input validation

fix #40
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature improvement Improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

consider how to change the project status on the Issues List page.

1 participant