Skip to content

Conversation

@AnujChhikara
Copy link
Contributor

@AnujChhikara AnujChhikara commented May 22, 2025

Date: 22 May 2025

Developer Name: @AnujChhikara


Issue Ticket Number

Description

  • This PR introduces a new function createActionContainer responsible for dynamically generating action elements (buttons, status indicators, input fields) for request cards based on the request type and status.

  • Test PR test: add test for request card component #994

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
  • Note: these are final Changes after all the PRs of this request card merged
  • Extension Request
brave_Wvd4QGQdA8.mp4
brave_5ZdF3b4Crh.mp4
brave_6dHlJo2kGe.mp4
  • OOO and Onboarding Requests
brave_cMuGGLoJBQ.mp4
brave_UHzBMcVK3p.mp4

Test Coverage

Screenshot 1

image
image

Additional Notes

Test PR: #994

@coderabbitai
Copy link

coderabbitai bot commented May 22, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Summary by CodeRabbit

  • New Features
    • Introduced new visual enhancements and interactive behaviors for request cards, including improved animations, status indicators, and deadline warnings.
    • Added support for displaying different request types and statuses with corresponding icons and colors.
    • Enhanced user feedback with visual highlights for success and error states, as well as loading spinners during updates.
    • Improved date and deadline formatting for clearer information display.
  • Bug Fixes
    • Improved error messaging for failed request updates.
  • Chores
    • Centralized constants and utility functions for better consistency and maintainability in request card components.

Walkthrough

This update introduces two new modules for the request-card component: a constants file defining fixed values, icon paths, and enumerations, and a utilities file providing helper functions for time handling, date formatting, UI manipulation, API interaction, and dynamic DOM construction for request and extension request cards.

Changes

File(s) Change Summary
components/request-card/constant.js New module defining constants for animation timing, icon paths, default images, deadline thresholds, hover delay, error messages, and enumerations for request status and type.
components/request-card/utils.js New module introducing utility functions for time/date conversion, deadline color calculation, date formatting, UI state toggling, loading spinners, accordion handling, card removal with animation, API request status updates, and creation of structured DOM elements for request card summaries, text blocks, and date containers.

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant Utils as request-card/utils.js
    participant API as Backend API

    UI->>Utils: updateRequestStatus({ id, body, isExtensionRequest })
    Utils->>API: PATCH /requests or /extension-requests
    API-->>Utils: Response (JSON)
    Utils-->>UI: Updated status or error message

    UI->>Utils: removeCard(element, class, container)
    Utils->>UI: Animate removal, update DOM
Loading

Possibly related PRs

  • #994: Adds test cases for request card component UI and interactions, complementing the utility and constant additions in this PR.
  • #999: Introduces createRequestCardComponent which uses the constants and utilities defined here for building the request card UI.
  • #1001: Enhances createRequestCardComponent with extended use of createSummarySection and createDateContainer utilities introduced in this PR.

Suggested reviewers

  • Suvidh-kaushik
  • iamitprakash

Poem

In the garden of code where requests abound,
Constants and helpers now gather around.
With icons and dates, and colors that warn,
Cards animate softly, no need to mourn.
The bunny hops by, with DOM freshly spun—
Request cards are ready, the work’s just begun!
🐇✨


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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

@AnujChhikara
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented May 22, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 8

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37988bb and 96b7d1b.

📒 Files selected for processing (2)
  • components/request-card/constant.js (1 hunks)
  • components/request-card/utils.js (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
components/request-card/utils.js (3)
components/request-card/constant.js (5)
  • DEADLINE_WARNING_THRESHOLD_DAYS (4-4)
  • ErrorMessage (27-29)
  • CARD_REMOVAL_INITIAL_DELAY_MS (1-1)
  • CARD_REMOVAL_ANIMATION_DURATION_MS (2-2)
  • CARD_REMOVAL_ANIMATION_EASING (3-3)
components/request-card/script.js (3)
  • createSummarySection (80-88)
  • oldEndsOn (379-379)
  • createDateContainer (89-102)
extension-requests/script.js (2)
  • isStatusPending (522-522)
  • isNewDeadLineCrossed (520-521)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
components/request-card/utils.js (1)

135-168: ⚠️ Potential issue

DOM IDs reused for every card will break accessibility & CSS selectors

Functions createSummarySection and createDateContainer inject elements with hard-coded id values (deadline-container, new-deadline-container, newEndsOn, etc.). When multiple cards are rendered, the page contains duplicate IDs – invalid HTML that can cause:

document.getElementById to return the first match only
• CSS rules to apply unpredictably
• Screen-readers to misbehave

Convert these to classes or data-attributes, e.g.

-attributes: { id: 'deadline-container' },
+attributes: { class: 'deadline-container' },

and update any selector logic accordingly.

Likely an incorrect or invalid review comment.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 22, 2025

Deploying dashboard-rds with  Cloudflare Pages  Cloudflare Pages

Latest commit: 602b090
Status: ✅  Deploy successful!
Preview URL: https://75c69ae9.dashboard-rds.pages.dev
Branch Preview URL: https://request-card-util-functions.dashboard-rds.pages.dev

View logs

@AnujChhikara AnujChhikara force-pushed the request-card-util-functions branch from 8e002cc to c3af82b Compare May 23, 2025 04:15
@AnujChhikara AnujChhikara force-pushed the request-card-util-functions branch from ad098d7 to 92e3a95 Compare May 24, 2025 04:25
@AnujChhikara AnujChhikara force-pushed the request-card-util-functions branch from 099f132 to 7f0bc9a Compare May 24, 2025 16:12
@AnujChhikara AnujChhikara force-pushed the request-card-util-functions branch from 7f0bc9a to 00ca389 Compare May 24, 2025 19:21
@AnujChhikara AnujChhikara requested a review from pankajjs May 24, 2025 19:35
pankajjs
pankajjs approved these changes May 25, 2025
pankajjs
pankajjs previously approved these changes May 25, 2025
Copy link
Contributor

@pankajjs pankajjs left a comment

Choose a reason for hiding this comment

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

My comments have been addressed. Therefore approving it.

* feature: Implementation of the request card component

* fix: add error handling for getSelfUser and fix css
@iamitprakash iamitprakash merged commit 0490ef9 into develop May 25, 2025
4 of 5 checks passed
@iamitprakash iamitprakash deleted the request-card-util-functions branch May 25, 2025 18:57
@AnujChhikara AnujChhikara mentioned this pull request May 25, 2025
10 tasks
@coderabbitai coderabbitai bot mentioned this pull request Oct 11, 2025
10 tasks
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.

6 participants