Skip to content

Comments

feature: add function for create request card#999

Merged
iamitprakash merged 8 commits intodevelopfrom
feature/create-request-card
May 17, 2025
Merged

feature: add function for create request card#999
iamitprakash merged 8 commits intodevelopfrom
feature/create-request-card

Conversation

@AnujChhikara
Copy link
Contributor

@AnujChhikara AnujChhikara commented May 11, 2025

Date: 11 May 2025

Developer Name: @AnujChhikara


Issue Ticket Number

Description

  • This PR introduces the initial part of the createRequestCardComponent refactoring, focusing on the creation of core UI elements.
    Note for reviewer: No design changes are being made to the extension card, so most of the implementation is reused from the existing code.
  • Test PR has been merged already 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 11, 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 a dynamic request card component that displays detailed request information, including deadlines, requested days, user details, and task status.
    • Added interactive elements such as tooltips, accordions for logs, and hover effects for committed hours.
    • Enhanced support for both extension and standard request types with conditional rendering and real-time data updates.

Walkthrough

A new asynchronous function, createRequestCardComponent, has been added to dynamically generate a request card UI component. The function processes request data, manages state, calculates date-related metrics, constructs DOM elements, and handles user interactions for both extension and standard request types.

Changes

File(s) Change Summary
components/request-card/script.js Added createRequestCardComponent, an async function to build an interactive request card UI with dynamic data, date calculations, conditional rendering, and event handlers.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant RequestCardComponent
    participant Helpers
    participant DOM
    participant DataSource

    Caller->>RequestCardComponent: createRequestCardComponent({data, ...})
    RequestCardComponent->>Helpers: Normalize and calculate dates
    RequestCardComponent->>Helpers: Calculate metrics (deadlines, days, etc.)
    RequestCardComponent->>DOM: Create and configure DOM elements
    alt isExtensionRequest
        RequestCardComponent->>DataSource: Fetch task details asynchronously
    end
    RequestCardComponent->>DOM: Attach event listeners
    RequestCardComponent->>Helpers: Build summary, date, and text containers
    Note over RequestCardComponent: Elements prepared for further use
Loading

Suggested reviewers

  • iamitprakash
  • devprakash0

Poem

In the garden of code, a new card does sprout,
With dates and with logs, it sorts all about.
Extension or not, it knows what to do,
With helpers and listeners, it builds something new.
A hop and a skip, the UI’s complete—
For every request, a card that’s neat! 🐇✨


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.

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6c68aa9 and b50020f.

📒 Files selected for processing (1)
  • components/request-card/script.js (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
components/request-card/script.js (1)
extension-requests/script.js (3)
  • renderLogRecord (17-17)
  • reasonInput (1180-1189)
  • reasonInputError (1190-1197)
🪛 Biome (1.9.4)
components/request-card/script.js

[error] 77-77: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 33-33: This let declares a variable that is only assigned once.

'assigneeNameElement' is only assigned here.

(lint/style/useConst)


[error] 34-34: This let declares a variable that is only assigned once.

'assigneeImage' is only assigned here.

(lint/style/useConst)


[error] 35-35: This let declares a variable that is only assigned once.

'taskStatusValue' is only assigned here.

(lint/style/useConst)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
components/request-card/script.js (3)

4-7: Unused parameters

currentUser, requestUser, and userStatusMap are accepted but never referenced. Either use them or drop them from the signature to avoid misleading future readers.


250-266: Constant reference ICON_ARROW_DOWN must be imported or globally defined

If the constant is declared in another module, ensure it’s imported; otherwise this will throw a ReferenceError in strict mode.


164-167: 🧹 Nitpick (assertive)

Use template literals instead of string concatenation

Biome flagged this; switching to a template literal improves readability and prevents inadvertent whitespace bugs.

-innerText: ` ${requestedDaysAgo}`,
+innerText: ` ${requestedDaysAgo}`,

(You can also drop the leading space and use CSS for spacing.)

Likely an incorrect or invalid review comment.

@AnujChhikara AnujChhikara force-pushed the feature/create-request-card branch from b50020f to cf18699 Compare May 11, 2025 05:10
@cloudflare-workers-and-pages
Copy link

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

Deploying dashboard-rds with  Cloudflare Pages  Cloudflare Pages

Latest commit: 610ca18
Status: ✅  Deploy successful!
Preview URL: https://081ab674.dashboard-rds.pages.dev
Branch Preview URL: https://feature-create-request-card.dashboard-rds.pages.dev

View logs

@MayankBansal12
Copy link
Member

Hello @AnujChhikara, please link the test PR in the description


const taskDataPromise = isExtensionRequest
? getTaskDetails(data.taskId)
: Promise.resolve({ taskData: null });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Task details are only needed for extension requests.
For other request types, return a resolved promise with null taskData to avoid unnecessary API calls.

MayankBansal12
MayankBansal12 previously approved these changes May 15, 2025
AnujChhikara and others added 2 commits May 15, 2025 21:09
Co-authored-by: Pankaj <pankajshadev@gmail.com>
pankajjs
pankajjs previously approved these changes May 15, 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.

All my comments and suggestions have been addressed. Therefore approving it.

MayankBansal12
MayankBansal12 previously approved these changes May 15, 2025
@AnujChhikara AnujChhikara requested a review from pankajjs May 17, 2025 15:47
@iamitprakash iamitprakash merged commit 2bd0d44 into develop May 17, 2025
6 of 7 checks passed
@iamitprakash iamitprakash deleted the feature/create-request-card branch May 17, 2025 18:58
@AnujChhikara AnujChhikara mentioned this pull request May 22, 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.

Create Reusable Components for Request Cards

6 participants