Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Hide repositories with zero issues #88

Open
guibranco opened this issue Aug 4, 2023 · 1 comment
Open

[FEATURE] Hide repositories with zero issues #88

guibranco opened this issue Aug 4, 2023 · 1 comment
Labels
enhancement New feature or request gitauto good first issue Good for newcomers help wanted Extra attention is needed javascript Pull requests that update Javascript code options repositories

Comments

@guibranco
Copy link
Member

guibranco commented Aug 4, 2023

Is your feature request related to a problem? Please describe.
Currently, the Repositories page displays all repositories, including those with zero issues (vacancies). This can clutter the view, making it difficult to focus on repositories that have active vacancies.

Describe the solution you'd like
I propose adding a switch button (on/off or enable/disable style) that allows users to hide or show repositories with no vacancies.

Technical Notes:

  • By default, the switch should hide repositories with zero issues (disabled/off).
  • The selected value should be stored in localStorage for a stateful experience, so the preference persists across page reloads.
  • The behavior should also be enabled via a query string parameter.
  • Use the React Switch component for the implementation.

API Integration:
The API already includes the ability to filter out empty repositories. By adding a query string value of hide-empty=true to the URL, we can hide repositories/organizations with no issues/vacancies.

  • Hide: https://apibr.com/vagas/api/v1/repositories?per_page=10&page=1&hide-empty=true
  • Show: https://apibr.com/vagas/api/v1/repositories?per_page=10&page=1&hide-empty=false

Remarks:
For the first step, we can implement this feature solely on the front-end (UI) side in this repository. Later, we can extend the functionality to the back-end (API) side to enable filtering by query string as well.

Sample Code Snippet (ReactJS):

Here’s a basic implementation of the switch functionality using a React Switch component:

import React, { useEffect, useState } from 'react';
import Switch from 'react-switch'; // Make sure to install this package

const RepositoriesFilter = () => {
  const [hideEmpty, setHideEmpty] = useState(() => {
    // Get initial value from localStorage
    const savedValue = localStorage.getItem('hideEmpty');
    return savedValue === 'true' || false; // Default to false if not found
  });

  useEffect(() => {
    localStorage.setItem('hideEmpty', hideEmpty);
    // Optionally, you could also update the API call here
    const url = `https://apibr.com/vagas/api/v1/repositories?per_page=10&page=1&hide-empty=${hideEmpty}`;
    // Fetch data from the API
  }, [hideEmpty]);

  const handleToggle = () => {
    setHideEmpty(!hideEmpty);
  };

  return (
    <div>
      <label>
        Hide repositories with no vacancies:
        <Switch
          onChange={handleToggle}
          checked={hideEmpty}
          offColor="#888"
          onColor="#0f0"
        />
      </label>
    </div>
  );
};

export default RepositoriesFilter;

Acceptance Criteria:

  • Users can toggle the switch to hide/show repositories with zero issues.
  • The selected preference is stored in localStorage.
  • The feature is implemented on the front-end, and the functionality for API integration is set up for future development.
@guibranco guibranco added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed javascript Pull requests that update Javascript code options repositories labels Aug 4, 2023
@guibranco guibranco changed the title Hide repositories with zero issues [FEATURE] Hide repositories with zero issues May 15, 2024
@gitauto-ai gitauto-ai bot added the gitauto label Jul 10, 2024
Copy link
Contributor

gitauto-ai bot commented Jul 10, 2024

@guibranco Pull request completed! Check it out here #235 🚀

Note: I automatically create a pull request for an unassigned and open issue in order from oldest to newest once a day at 00:00 UTC, as long as you have remaining automation usage. Should you have any questions or wish to change settings or limits, please feel free to contact [email protected] or invite us to Slack Connect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gitauto good first issue Good for newcomers help wanted Extra attention is needed javascript Pull requests that update Javascript code options repositories
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant