Skip to content

adding reusable empty-card for edge case handling.#69

Open
rahul-vyas-dev wants to merge 2 commits into
AOSSIE-Org:mainfrom
rahul-vyas-dev:feat/empty-state-card
Open

adding reusable empty-card for edge case handling.#69
rahul-vyas-dev wants to merge 2 commits into
AOSSIE-Org:mainfrom
rahul-vyas-dev:feat/empty-state-card

Conversation

@rahul-vyas-dev
Copy link
Copy Markdown
Contributor

@rahul-vyas-dev rahul-vyas-dev commented Jun 5, 2026

Screenshots/Recordings:

Before:
https://1drv.ms/v/c/2b55451e453f4443/IQA3oNN8Z6vWRr9YY2xNhDH8AYaATX0wXDy0dpE8aSrKoHI?e=hpdhhe

After:
https://1drv.ms/v/c/2b55451e453f4443/IQBxw9n0wYbJRrfuTPTgf7BKAYLWYsScZ12g8Ti3b2ExLj8?e=1M1UzM

Additional Notes:

A reusable empty-state/error handling card component designed to provide clear feedback when repository data is unavailable.
It supports customizable icons, titles, descriptions, and action buttons, making it flexible for multiple failure or no-data scenarios.

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added empty-state screens with helpful messaging and navigation buttons for pages with no data (contributors, repositories, and network views).
    • Users can now easily return to the home page when viewing empty sections instead of seeing blank screens.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Need an answer fast? Review this PR in Change Stack to ask focused questions about the PR or a changed range.

Review Change Stack

Warning

Review limit reached

@rahul-vyas-dev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 37 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1fcd3333-d5c2-4818-9ab3-52766ee9e833

📥 Commits

Reviewing files that changed from the base of the PR and between dceae24 and 50e05f6.

📒 Files selected for processing (1)
  • package.json

Walkthrough

This PR introduces a reusable EmptyStateCard component and integrates it across three pages to provide consistent empty-state UI when contributors, network repositories, or repository lists are unavailable. Each page conditionally renders the card with a database icon and a button that navigates users home.

Changes

Empty-State UI Pattern

Layer / File(s) Summary
EmptyStateCard component
src/components/EmptyStateCard.jsx
A new React component with inline styling renders a centered empty-state card accepting icon, title, description, and button-click handler props, with hover effects on the CTA button.
Empty-state integration across pages
src/pages/ContributorsPage.jsx, src/pages/NetworkPage.jsx, src/pages/RepositoriesPage.jsx
ContributorsPage, NetworkPage, and RepositoriesPage each add FiDatabase icon import, useNavigate hook, and conditional rendering to display EmptyStateCard with database icon and "Go to Home" button when data lists are empty.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Typescript Lang

Poem

🐰 A rabbit hops through empty halls,
But cards now greet them at the walls,
With icons bright and buttons true,
Home awaits, a hop or two!
No more blank screens to make us stall,
EmptyState cards handle them all. 🏠

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: adding a reusable empty-state card component for edge case handling, which aligns with the primary modification of introducing EmptyStateCard.jsx and integrating it across multiple pages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added no-issue-linked PR has no linked issue frontend Frontend changes javascript JavaScript/TypeScript changes labels Jun 5, 2026
@rahul-vyas-dev rahul-vyas-dev added gsoc GSoC students and removed no-issue-linked PR has no linked issue javascript JavaScript/TypeScript changes frontend Frontend changes labels Jun 5, 2026
@github-actions github-actions Bot added size/L 201-500 lines changed external-contributor External contributor labels Jun 5, 2026
@github-actions github-actions Bot added no-issue-linked PR has no linked issue frontend Frontend changes javascript JavaScript/TypeScript changes size/L 201-500 lines changed and removed size/L 201-500 lines changed labels Jun 5, 2026
@github-actions github-actions Bot added configuration Config file changes dependencies Dependency updates size/L 201-500 lines changed and removed size/L 201-500 lines changed labels Jun 5, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/EmptyStateCard.jsx`:
- Around line 75-99: The button in EmptyStateCard.jsx (the element using
onButtonClick and displaying {buttonText}) lacks an explicit type and
accessibility attributes; update that button to include type="button" to avoid
accidental form submission and add accessible attributes such as aria-label (or
aria-labelledby) and, if needed, aria-describedby for helper text, plus ensure
the onMouseEnter/onMouseLeave handlers do not interfere with keyboard focus by
adding a visible focus style or handling onFocus/onBlur similarly; locate the
<button> that renders {buttonText} and apply these changes.
- Around line 89-96: The inline onMouseEnter/onMouseLeave handlers in
EmptyStateCard.jsx are recreated every render; extract them or move styling to
CSS to avoid re-renders. Fix by replacing the inline handlers on the element
with either a CSS hover class (e.g., add a class like "empty-state-button" and
define :hover styles for transform/opacity) or by extracting the handlers into
memoized callbacks using React.useCallback (create handleMouseEnter and
handleMouseLeave and pass them to the element). Ensure you update the JSX to
reference the new class or the memoized functions and remove the inline arrow
functions.
- Around line 2-8: EmptyStateCard is missing prop validation for required props;
add runtime PropTypes by importing PropTypes and defining
EmptyStateCard.propTypes with SvgIcon: PropTypes.elementType.isRequired and
onButtonClick: PropTypes.func.isRequired (keep existing defaults for title,
description and buttonText or mark them optional), or convert the component to
TypeScript and add an explicit props interface with SvgIcon and onButtonClick
required; update exports accordingly so the component will error early if those
props are omitted.
- Around line 4-6: The default copy in EmptyStateCard is hardcoded English text,
so externalize the user-facing values for title, description, and buttonText
into the i18n resource files and read them through the existing translation
mechanism instead of inline defaults. Update the EmptyStateCard component
props/defaults to use translation keys, and make sure any callers or fallback
logic still resolve through the localization layer.

In `@src/pages/ContributorsPage.jsx`:
- Around line 183-188: Replace the hardcoded English strings passed to the
EmptyStateCard props (title, description, buttonText) with internationalized
lookup calls (e.g., using your i18n utility t(...) or a translations object) so
the UI text is loaded from resource files; update the JSX where EmptyStateCard
is rendered (the title, description and buttonText props in
ContributorsPage.jsx) to use the i18n keys (e.g.,
t('contributors.noResults.title'), t('contributors.noResults.description'),
t('contributors.noResults.button')) and keep the existing onButtonClick behavior
(navigate('/')) unchanged.

In `@src/pages/NetworkPage.jsx`:
- Around line 213-219: Replace the hardcoded English strings passed to
EmptyStateCard (props title, description, buttonText) with calls to the i18n
resource layer used in the project (e.g., the t(...) or i18n.t(...) helper) so
strings are externalized; update the file to import the i18n helper at the top
and use keys like "network.noRepos.title", "network.noRepos.description", and
"network.noRepos.buttonText" when rendering EmptyStateCard (keep the SvgIcon and
onButtonClick/navigate usage unchanged), and add corresponding entries to the
translation resource files.

In `@src/pages/RepositoriesPage.jsx`:
- Around line 199-205: Replace the hardcoded English strings passed to
EmptyStateCard (props title, description, buttonText) with i18n resource
lookups; import and use your app's translation helper (e.g., useTranslation/t or
a resource lookup function) at the top of RepositoriesPage.jsx, replace the
literal values with calls like t('repositories.empty.title'),
t('repositories.empty.description'), t('repositories.empty.button'), and ensure
those keys are added to the locale resource files; keep the onButtonClick={() =>
navigate('/')} as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 743fdbec-8d73-4101-8d02-e9c237d692e3

📥 Commits

Reviewing files that changed from the base of the PR and between 9299487 and dceae24.

📒 Files selected for processing (4)
  • src/components/EmptyStateCard.jsx
  • src/pages/ContributorsPage.jsx
  • src/pages/NetworkPage.jsx
  • src/pages/RepositoriesPage.jsx

Comment thread src/components/EmptyStateCard.jsx
Comment thread src/components/EmptyStateCard.jsx
Comment thread src/components/EmptyStateCard.jsx
Comment thread src/components/EmptyStateCard.jsx
Comment thread src/pages/ContributorsPage.jsx
Comment thread src/pages/NetworkPage.jsx
Comment thread src/pages/RepositoriesPage.jsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Config file changes dependencies Dependency updates external-contributor External contributor frontend Frontend changes gsoc GSoC students javascript JavaScript/TypeScript changes no-issue-linked PR has no linked issue size/L 201-500 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant