Skip to content

feat: Add Policies dropdown to navbar with General Policy and Good Practices documents #125

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

ManiBAJPAI22
Copy link

@ManiBAJPAI22 ManiBAJPAI22 commented Aug 16, 2025

🎯 Overview

Implements the Policies dropdown menu in the navbar as requested in #113, providing users with easy access to important policy documents.

✨ Features

  • Policies Dropdown: New dropdown menu accessible from both desktop and mobile navbars
  • Document Links: Direct access to General Policy and Good Practices documents
  • Responsive Design: Works seamlessly on both desktop and mobile layouts
  • Interactive UI: Hover effects with blue overlay and animated left border
  • External Links: Opens policy documents in new tabs via IPFS links

Technical Details

  • Component: New Policies.tsx component integrated into navbar
  • Styling: Styled-components with theme integration and responsive breakpoints
  • State Management: Local state for dropdown open/close functionality
  • Accessibility: Proper ARIA attributes and keyboard navigation support
  • Click Outside: Dropdown closes when clicking outside the component

UI/UX Improvements

  • Visual Design: Matches Figma specifications with exact dimensions (247×45px)
  • Hover Effects: Smooth blue background overlay and left border animation
  • Icon Design: Custom SVG-like icons for General Policy (checkmark) and Good Practices (document)
  • Positioning: Properly aligned dropdown with responsive positioning

🔗 Document Links

  • General Policy: https://cdn.kleros.link/ipfs/QmU2GuwcSs8tFp8gWf5hcXVbcJKRqwoecNnERz9XjKr18d
  • Good Practices: https://cdn.kleros.link/ipfs/QmcCyR68RmwWfdVKinY8Fmiy73a6xEzGqYDcvAh9EFUnLF

🧪 Testing

  • ✅ TypeScript compilation passes
  • ✅ Responsive design works on all screen sizes
  • ✅ Dropdown opens/closes correctly
  • ✅ External links open in new tabs
  • ✅ Click-outside functionality works

📸 Screenshots

image image

🔄 Files Changed

  • web/src/layout/Header/navbar/Policies.tsx - New Policies component
  • web/src/layout/Header/navbar/Explore.tsx - Integrated Policies into navbar

PR-Codex overview

This PR introduces a new component, Policies, to the Explore section of the application. It enhances the user interface by providing a dropdown menu for policy options, improving navigation and accessibility.

Detailed summary

  • Added Policies component to web/src/layout/Header/navbar/Policies.tsx.
  • Integrated Policies into Explore component in web/src/layout/Header/navbar/Explore.tsx.
  • Implemented styled components for layout and UI elements in Policies.
  • Added state management for dropdown visibility.
  • Created a list of policies with links and icons.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added a Policies menu under Explore in the header. Displays a titled dropdown with General Policy and Good Practices, supports desktop and mobile nav behavior, closes on outside click, includes basic accessibility attributes, and opens policy links in new tabs.
  • Chores

    • Removed the web package manifest, eliminating the web package’s tooling, scripts, build/configuration and dependency declarations.

Copy link

netlify bot commented Aug 16, 2025

👷 Deploy request for kleros-escrow-v2 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9bb1a8f

Copy link
Contributor

coderabbitai bot commented Aug 16, 2025

Walkthrough

Removes the entire web/package.json manifest and adds a new Policies React dropdown component rendered in the Explore navbar; the component manages open/close, outside-click closing, mobile context coordination, and renders two policy links.

Changes

Cohort / File(s) Summary
Package manifest removed
web/package.json
Deleted full package manifest (metadata, scripts, dependencies, devDependencies, aliases, Volta config, Prettier, browserslist, etc.).
Header navbar — Policies component & integration
web/src/layout/Header/navbar/Policies.tsx, web/src/layout/Header/navbar/Explore.tsx
Added Policies default-export React component implementing a styled dropdown (isOpen state, outside-click mousedown listener, ARIA attributes, landscape-aware styling) and integrated it into Explore.tsx with isMobileNavbar prop passed.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Explore as Explore Navbar
  participant Policies as Policies Component
  participant MobileCtx as MobileHeaderContext
  participant Browser as Window/Browser

  User->>Policies: Click "Policies" button
  Policies->>Policies: Toggle isOpen
  alt isOpen
    Policies-->>User: Show dropdown
  else
    Policies-->>User: Hide dropdown
  end

  User->>Policies: Click a policy item
  Policies->>Browser: window.open(policy.url, "_blank")
  Policies->>Policies: Close dropdown
  opt isMobileNavbar
    Policies->>MobileCtx: toggleIsOpen()
  end

  User->>Browser: Click outside
  Browser->>Policies: mousedown event
  Policies->>Policies: Detect outside click → Close dropdown
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels

Type: Feature🗿, Package: Web

Suggested reviewers

  • jaybuidl

Poem

A rabbit hopped into the code,
and stitched a menu soft and stowed. 🐇
Two policies line up to show,
click to open, then to go.
In mobile burrows, chevrons glow.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8cac6c0 and 9bb1a8f.

📒 Files selected for processing (1)
  • web/src/layout/Header/navbar/Policies.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/layout/Header/navbar/Policies.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ManiBAJPAI22 ManiBAJPAI22 marked this pull request as ready for review August 16, 2025 21:32
@ManiBAJPAI22 ManiBAJPAI22 requested a review from a team as a code owner August 16, 2025 21:32
@ManiBAJPAI22
Copy link
Author

@jaybuidl @clesaege

Quick Overview: Added a Policies dropdown to the navbar that provides easy access to General Policy and Good Practices documents.

Please review the styling, accessibility, and overall UX.

Thanks!

Copy link
Contributor

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

🧹 Nitpick comments (3)
web/src/layout/Header/navbar/Policies.tsx (3)

55-64: Make chevron reflect open/closed state

You pass isOpen to ChevronIcon but don’t use it. Rotate the caret when open for clearer UI feedback.

-  transform: rotate(45deg);
+  transform: ${({ isOpen }) => (isOpen ? "rotate(-135deg)" : "rotate(45deg)")};
   transition: transform 0.2s ease;

81-87: Preserve slide animation in landscape

The landscapeStyle block overwrites transform, eliminating the slide-in/out animation. Compose translateX with the isOpen-based translateY to keep the animation consistent.

   ${landscapeStyle(
     () => css`
       top: calc(100% + 8px);
       left: 50%;
-      transform: translateX(-50%) translateY(0);
+      transform: ${({ isOpen }) => `translateX(-50%) translateY(${isOpen ? "0" : "-10px"})`};
     `
   )};

204-216: Improve close behavior: support pointer events and Escape key

  • Add pointerdown to reliably detect outside clicks on touch devices.
  • Close on Escape for keyboard users.
   useEffect(() => {
-    const handleClickOutside = (event: MouseEvent) => {
+    const handleClickOutside = (event: Event) => {
       if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
         setIsOpen(false);
       }
     };
+    const handleKeyDown = (e: KeyboardEvent) => {
+      if (e.key === "Escape") setIsOpen(false);
+    };
 
-    document.addEventListener("mousedown", handleClickOutside);
+    document.addEventListener("pointerdown", handleClickOutside);
+    document.addEventListener("mousedown", handleClickOutside);
+    document.addEventListener("keydown", handleKeyDown);
     return () => {
-      document.removeEventListener("mousedown", handleClickOutside);
+      document.removeEventListener("pointerdown", handleClickOutside);
+      document.removeEventListener("mousedown", handleClickOutside);
+      document.removeEventListener("keydown", handleKeyDown);
     };
   }, []);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7dd88a4 and 55943be.

📒 Files selected for processing (3)
  • web/package.json (1 hunks)
  • web/src/layout/Header/navbar/Explore.tsx (2 hunks)
  • web/src/layout/Header/navbar/Policies.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/src/layout/Header/navbar/Policies.tsx (2)
web/src/styles/landscapeStyle.ts (1)
  • landscapeStyle (7-11)
web/src/layout/Header/MobileHeader.tsx (1)
  • useOpenContext (44-46)
🔇 Additional comments (2)
web/src/layout/Header/navbar/Policies.tsx (1)

30-53: Overall: Solid component structure and styling

Nice job on the structured styled-components, theme usage, outside-click handling, and mobile coordination via context. Dimensions and hover treatments look aligned with the spec.

Also applies to: 66-116, 118-176, 189-202, 229-266

web/src/layout/Header/navbar/Explore.tsx (1)

8-8: Integration looks clean

Importing and rendering Policies with isMobileNavbar keeps the Explore layout consistent and leverages the existing mobile header context.

Also applies to: 80-80

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 17, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 18, 2025
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.

1 participant