Skip to content

added "Clear All" button to clrear repos in one shot#412

Open
JaYRaNa213 wants to merge 6 commits intofossasia:mainfrom
JaYRaNa213:Feature/add-clear-all-repo-button
Open

added "Clear All" button to clrear repos in one shot#412
JaYRaNa213 wants to merge 6 commits intofossasia:mainfrom
JaYRaNa213:Feature/add-clear-all-repo-button

Conversation

@JaYRaNa213
Copy link

@JaYRaNa213 JaYRaNa213 commented Mar 2, 2026

📌 Fixes

Fixes #411


📝 Summary of Changes

  • Added a "Clear All" button near the selected repository tags section.
  • Implemented functionality to remove all selected repositories in a single click.
  • Reset the repository selection state after clearing.
  • Improved usability when handling multiple selected repositories.

📸 Screenshots / Demo (if UI-related)

Before:
Users could only remove repositories one by one.

Image Image

After:
A "Clear All" button is available next to the selected repository tags, allowing users to remove all selections at once.

image Image ---

✅ Checklist

  • I’ve tested my changes locally
  • I’ve added tests (if applicable)
  • I’ve updated documentation (if applicable)
  • My code follows the project’s code style guidelines

👀 Reviewer Notes

This is a small UI enhancement focused on improving usability.
The existing functionality for removing individual repositories remains unchanged.
The "Clear All" button only resets the selected repository state and does not affect other extension settings.

Summary by Sourcery

Add a dedicated control in the popup to clear all selected repositories at once and keep the selection state and UI in sync.

New Features:

  • Introduce a "Clear All" button in the repository selection section to remove all selected repositories with a single action.

Enhancements:

  • Automatically toggle visibility of the "Clear All" control based on whether any repositories are selected and persist the cleared state.
  • Extend i18n message catalogs to support the new "Clear All" button label across locales.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 2, 2026

Reviewer's Guide

Implements a new "Clear All" control in the popup UI to clear all selected repositories at once, wiring it into the existing selection state, persistence, and localization system.

Sequence diagram for Clear All repositories interaction

sequenceDiagram
  actor User
  participant ClearAllReposButton
  participant PopupScript
  participant ChromeStorage

  User->>ClearAllReposButton: Click
  ClearAllReposButton->>PopupScript: click_event_listener
  PopupScript->>PopupScript: clearAllRepos()
  PopupScript->>PopupScript: selectedRepos = []
  PopupScript->>PopupScript: updateRepoDisplay()
  PopupScript->>PopupScript: toggle_clearAllReposBtn_visibility
  PopupScript->>PopupScript: update_repo_tags_placeholder
  PopupScript->>PopupScript: update_repo_count
  PopupScript->>ChromeStorage: saveRepoSelection()
  ChromeStorage-->>PopupScript: confirmation
  PopupScript-->>User: UI_updated_with_no_repositories_selected
Loading

Flow diagram for repository selection state and Clear All button visibility

flowchart TD
  A_start["Start in popup with repository filter"]
  B_hasRepos{Are any repositories selected?}
  C_showPlaceholder["Show repoPlaceholder text"]
  D_setCountNone["Set repoCount to repoCountNone"]
  E_hideClearAll["Add hidden class to clearAllReposBtn"]
  F_renderTags["Render selected repository tags"]
  G_setCountSome["Set repoCount to selected count message"]
  H_showClearAll["Remove hidden class from clearAllReposBtn"]
  I_userClicksClearAll["User clicks Clear All button"]
  J_clearAllRepos["Set selectedRepos to empty array"]
  K_saveSelection["saveRepoSelection to chrome.storage.local"]

  A_start --> B_hasRepos
  B_hasRepos -->|No| C_showPlaceholder
  C_showPlaceholder --> D_setCountNone
  D_setCountNone --> E_hideClearAll

  B_hasRepos -->|Yes| F_renderTags
  F_renderTags --> G_setCountSome
  G_setCountSome --> H_showClearAll

  H_showClearAll --> I_userClicksClearAll
  I_userClicksClearAll --> J_clearAllRepos
  J_clearAllRepos --> K_saveSelection
  J_clearAllRepos --> B_hasRepos
Loading

File-Level Changes

Change Details Files
Add a dedicated "Clear All" button to the repository selection UI and wire it to repo selection state management.
  • Introduce a new clear-all button element in the popup markup next to the repository status, with Tailwind styling, hidden by default, and an i18n key for its label.
  • Grab the clear-all button via DOM lookup on load and expose a new clearAllRepos function on window that empties the selectedRepos array, updates the display, and persists the cleared state.
  • Update updateRepoDisplay to toggle the visibility of the clear-all button based on whether any repositories are selected, keeping the placeholder and repo count logic intact.
  • Attach a click handler to the clear-all button that stops event propagation and invokes clearAllRepos, avoiding interference with surrounding click behavior.
src/popup.html
src/scripts/popup.js
Integrate the new "Clear All" button label into the localization system across supported languages.
  • Add a new clearAllReposButton localization key and value to the messages files for each supported locale so the new button text participates in the existing i18n pipeline.
src/_locales/de/messages.json
src/_locales/en/messages.json
src/_locales/es/messages.json
src/_locales/fr/messages.json
src/_locales/he/messages.json
src/_locales/hi/messages.json
src/_locales/id/messages.json
src/_locales/it/messages.json
src/_locales/ja/messages.json
src/_locales/ml/messages.json
src/_locales/my/messages.json
src/_locales/nb/messages.json
src/_locales/pt/messages.json
src/_locales/pt_BR/messages.json
src/_locales/ru/messages.json
src/_locales/te/messages.json
src/_locales/uk/messages.json
src/_locales/vi/messages.json
src/_locales/zh_CN/messages.json

Assessment against linked issues

Issue Objective Addressed Explanation
#411 Add a visible "Clear All" button near the selected repository tags / repository selection status area in the popup UI.
#411 Implement functionality so that clicking "Clear All" removes all selected repository tags and resets the repository selection state (including persisted selection).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added javascript Pull requests that update javascript code frontend extension labels Mar 2, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • If clearAllRepos is only used as an event handler and not referenced from inline HTML, you can keep it scoped and avoid assigning it to window to reduce global surface area.
  • When clearing all repos, consider whether any additional UI state (e.g., repoStatus text) should also be reset to avoid showing stale status messages after the list is emptied.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- If `clearAllRepos` is only used as an event handler and not referenced from inline HTML, you can keep it scoped and avoid assigning it to `window` to reduce global surface area.
- When clearing all repos, consider whether any additional UI state (e.g., `repoStatus` text) should also be reset to avoid showing stale status messages after the list is emptied.

## Individual Comments

### Comment 1
<location path="src/scripts/popup.js" line_range="1335" />
<code_context>
 		}

 		window.removeRepo = removeRepo;
+		window.clearAllRepos = clearAllRepos;
+
+		if (clearAllReposBtn) {
</code_context>
<issue_to_address>
**question:** Re-evaluate whether `clearAllRepos` needs to be exposed on `window`.

Since `clearAllRepos` is already bound to `clearAllReposBtn`, consider keeping it local unless it’s explicitly needed by inline handlers or other scripts. Avoiding a `window` attachment reduces global surface area and risk of name collisions.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@JaYRaNa213
Copy link
Author

i will resolve all conflict shorlty

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

Adds a “Clear All” control to the popup’s repository filter UI so users can remove all selected repositories with one click, and updates i18n catalogs to support the new label across locales.

Changes:

  • Add a “Clear All” button to the selected-repositories status row in popup.html.
  • Implement clear-all selection behavior and show/hide logic in src/scripts/popup.js.
  • Add clearAllReposButton i18n message across all locale catalogs updated in this PR.

Reviewed changes

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

Show a summary per file
File Description
src/scripts/popup.js Adds clearAllRepos() behavior and toggles “Clear All” button visibility based on selection state.
src/popup.html Adds the “Clear All” button near the selected repository count/status area.
src/_locales/en/messages.json Adds clearAllReposButton string.
src/_locales/de/messages.json Adds clearAllReposButton string.
src/_locales/es/messages.json Adds clearAllReposButton string.
src/_locales/fr/messages.json Adds clearAllReposButton string.
src/_locales/he/messages.json Adds clearAllReposButton string.
src/_locales/hi/messages.json Adds clearAllReposButton string.
src/_locales/id/messages.json Adds clearAllReposButton string.
src/_locales/it/messages.json Adds clearAllReposButton string.
src/_locales/ja/messages.json Adds clearAllReposButton string.
src/_locales/ml/messages.json Adds clearAllReposButton string.
src/_locales/my/messages.json Adds clearAllReposButton string.
src/_locales/nb/messages.json Adds clearAllReposButton string.
src/_locales/pt/messages.json Adds clearAllReposButton string (but also removes another key—see comments).
src/_locales/pt_BR/messages.json Adds clearAllReposButton string.
src/_locales/ru/messages.json Adds clearAllReposButton string.
src/_locales/te/messages.json Adds clearAllReposButton string.
src/_locales/uk/messages.json Adds clearAllReposButton string.
src/_locales/vi/messages.json Adds clearAllReposButton string.
src/_locales/zh_CN/messages.json Adds clearAllReposButton string.

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

@vedansh-5
Copy link
Member

Thanks @JaYRaNa213 for your contribution. Please address copilots' concerns/

@github-actions github-actions bot added dependencies Pull requests that update a dependency file core documentation config labels Mar 4, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

New security issues found

@github-actions github-actions bot removed dependencies Pull requests that update a dependency file core documentation config labels Mar 4, 2026
@JaYRaNa213
Copy link
Author

@vedansh-5 sir please review

all copilot concerns are resolved

only getting security issues ( can be ignore )

if you want sir
can i create new issue and PR to resolve all security issues , i will try to resolve all .

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

Labels

extension frontend javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add "Clear All" Button for Selected Repositories

3 participants