Skip to content

Conversation

@RishabhS7
Copy link
Contributor

@RishabhS7 RishabhS7 commented Dec 22, 2025

Summary

Add banner notice

Jira Ticket

Summary by CodeRabbit

  • New Features
    • Introduced a dismissible disclaimer banner at the top of the app that displays important information and can be closed by the user.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 22, 2025

Walkthrough

A new presentational React component, Disclaimer, was added at src/components/Disclaimer/index.tsx and rendered at the top of the app by importing and inserting <Disclaimer /> into src/App.tsx. The component manages local mounted/visible state and provides a dismiss (close) control.

Changes

Cohort / File(s) Summary
App — integration
src/App.tsx
Added Disclaimer import and rendered <Disclaimer /> in the App component's JSX. No other logic or signatures changed.
New component — Disclaimer
src/components/Disclaimer/index.tsx
Added Disclaimer React functional component using useState/useEffect, renders a dismissible styled banner with a close icon and data-testid="old-verifier-banner". Exports the component.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes a Summary section with background context and a Jira ticket link, but is missing the Changes and Issues sections from the required template. Add a 'Changes' section listing the specific modifications (new Disclaimer component, banner UI, dismiss functionality) and clarify the 'Issues' section to explicitly reference the Jira ticket.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add disclaimer' directly and concisely describes the main change—adding a new Disclaimer component. It is clear, specific, and aligns with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-banner

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.

Copy link

@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: 1

🧹 Nitpick comments (1)
src/components/Disclaimer/index.tsx (1)

6-14: Consider simplifying the nested structure.

The current nesting with multiple wrapper divs and justify-between (which has no effect with a single child) is overly complex for a simple centered message. The structure could be simplified for better maintainability.

🔎 Proposed refactor
-      <div className="container">
-        <div className="flex flex-wrap">
-          <div className="col-auto flex items-center justify-between w-full">
-            <p className="mb-0">
-              <strong>Disclaimer:</strong> The Creator tool and Config file are for testing and demonstration purposes
-              only. They are not recommended for production or live issuance of documents. Use the TrustVC library for
-              production use.
-            </p>
-          </div>
-        </div>
-      </div>
+      <div className="container">
+        <p className="mb-0">
+          <strong>Disclaimer:</strong> The Creator tool and Config file are for testing and demonstration purposes
+          only. They are not recommended for production or live issuance of documents. Use the TrustVC library for
+          production use.
+        </p>
+      </div>
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fee615f and 5357f6f.

📒 Files selected for processing (2)
  • src/App.tsx
  • src/components/Disclaimer/index.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/App.tsx (1)
src/components/Disclaimer/index.tsx (1)
  • Disclaimer (3-19)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - tradetrust-creator
  • GitHub Check: Header rules - tradetrust-creator
  • GitHub Check: Pages changed - tradetrust-creator
  • GitHub Check: Lint & Test
🔇 Additional comments (1)
src/App.tsx (1)

9-9: LGTM! Clean integration of the Disclaimer component.

The import and placement of the Disclaimer component at the top of the App layout is appropriate for a banner notice.

Also applies to: 30-30


export const Disclaimer: React.FunctionComponent = () => {
return (
<div className="bg-cerulean-800 text-white py-2 px-0" data-testid="old-verifier-banner">
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect data-testid attribute.

The data-testid="old-verifier-banner" appears to be copied from another component and doesn't match the purpose of this disclaimer banner. This could cause confusion in tests and maintenance.

🔎 Proposed fix
-    <div className="bg-cerulean-800 text-white py-2 px-0" data-testid="old-verifier-banner">
+    <div className="bg-cerulean-800 text-white py-2 px-0" data-testid="disclaimer-banner">
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="bg-cerulean-800 text-white py-2 px-0" data-testid="old-verifier-banner">
<div className="bg-cerulean-800 text-white py-2 px-0" data-testid="disclaimer-banner">
🤖 Prompt for AI Agents
In src/components/Disclaimer/index.tsx around line 5, the div uses
data-testid="old-verifier-banner" which is incorrect for this disclaimer
component; update the data-testid to a meaningful, component-specific value
(e.g., "disclaimer-banner" or "disclaimer") to reflect its purpose, and
run/update tests that reference the old value to use the new test id.

Copy link

@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: 1

♻️ Duplicate comments (1)
src/components/Disclaimer/index.tsx (1)

14-14: Incorrect data-testid attribute.

The data-testid="old-verifier-banner" doesn't match the purpose of this disclaimer component and appears to be copied from another component. This should be updated to reflect the disclaimer's purpose (e.g., "disclaimer-banner").

🧹 Nitpick comments (3)
src/components/Disclaimer/index.tsx (3)

5-9: Consider simplifying the initial state.

The pattern of useState(false) followed by useEffect(() => setShow(true), []) causes an extra render cycle where the component initially returns null and then re-renders to show the banner. Unless this is intentional for SSR hydration or to prevent a flash of content, consider initializing with useState(true) directly.

🔎 Proposed simplification
-  const [show, setShow] = useState(false);
-
-  useEffect(() => {
-    setShow(true);
-  }, []);
+  const [show, setShow] = useState(true);

4-31: Consider persisting the dismissal state.

The banner currently reappears on every page reload after being dismissed. For better UX, consider persisting the dismissal state in localStorage so users don't have to repeatedly close the banner.

🔎 Example implementation with localStorage
 export const Disclaimer: React.FunctionComponent = () => {
-  const [show, setShow] = useState(false);
+  const [show, setShow] = useState(() => {
+    const dismissed = localStorage.getItem('disclaimer-dismissed');
+    return dismissed !== 'true';
+  });

-  useEffect(() => {
-    setShow(true);
-  }, []);
+  const handleClose = () => {
+    setShow(false);
+    localStorage.setItem('disclaimer-dismissed', 'true');
+  };

   if (!show) return null;

   return (
     <div className="bg-cerulean-800 text-white py-2 px-0 mb-2" data-testid="old-verifier-banner">
       <div className="container">
         <div className="flex items-start justify-between">
           <div className="flex-1 flex justify-center">
             <p className="mb-0 text-center">
               <strong>Disclaimer:</strong> The Creator tool and Config file are for testing and demonstration purposes
               only. They are not recommended for production or live issuance of documents. Use the TrustVC library for
               production use.
             </p>
           </div>
           <div className="cursor-pointer hover:text-gray-500">
-            <X data-testid="disclaimer-close" onClick={() => setShow(false)} />
+            <X data-testid="disclaimer-close" onClick={handleClose} />
           </div>
         </div>
       </div>
     </div>
   );
 };

4-31: Add tests for the new component.

This is a new component without accompanying tests. Tests should cover:

  • Initial render behavior
  • Dismissal functionality
  • Accessibility attributes

Would you like me to generate a test file for this component?

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5357f6f and ea327b9.

📒 Files selected for processing (1)
  • src/components/Disclaimer/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Redirect rules - tradetrust-creator
  • GitHub Check: Header rules - tradetrust-creator
  • GitHub Check: Pages changed - tradetrust-creator
  • GitHub Check: Lint & Test

Comment on lines +24 to +26
<div className="cursor-pointer hover:text-gray-500">
<X data-testid="disclaimer-close" onClick={() => setShow(false)} />
</div>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Fix accessibility violations in the close button.

The close control has several accessibility issues:

  • It's a div instead of a semantic button element, preventing keyboard navigation
  • Missing aria-label for screen readers to announce its purpose
  • No keyboard event handlers (Enter/Space keys) for keyboard-only users

These issues prevent keyboard users and screen reader users from dismissing the banner.

🔎 Proposed fix for accessibility
-          <div className="cursor-pointer hover:text-gray-500">
-            <X data-testid="disclaimer-close" onClick={() => setShow(false)} />
-          </div>
+          <button
+            className="bg-transparent border-0 cursor-pointer hover:text-gray-500 p-0 flex items-center"
+            onClick={() => setShow(false)}
+            aria-label="Close disclaimer"
+            data-testid="disclaimer-close"
+          >
+            <X />
+          </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div className="cursor-pointer hover:text-gray-500">
<X data-testid="disclaimer-close" onClick={() => setShow(false)} />
</div>
<button
className="bg-transparent border-0 cursor-pointer hover:text-gray-500 p-0 flex items-center"
onClick={() => setShow(false)}
aria-label="Close disclaimer"
data-testid="disclaimer-close"
>
<X />
</button>
🤖 Prompt for AI Agents
In src/components/Disclaimer/index.tsx around lines 24-26, the close control is
a non-semantic div without keyboard support or an accessible name; replace the
div with a semantic <button type="button">, move the onClick handler to that
button, add an aria-label (e.g., "Close disclaimer") and keep the X icon inside
(preserve data-testid on the icon or button), ensure the button retains the same
className styling and includes visible focus styles so keyboard users can tab to
and activate it with Enter/Space.

@rongquan1 rongquan1 merged commit ce23fb7 into master Dec 30, 2025
9 of 10 checks passed
@rongquan1 rongquan1 deleted the feat/add-banner branch December 30, 2025 07:12
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.

3 participants