Skip to content
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

[WEB-1882] chore: optimised issue activity and updated the popover component in issue detail and peek overview #5208

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

gurusainath
Copy link
Collaborator

@gurusainath gurusainath commented Jul 23, 2024

summary:

In this PR we have optimised the issue activity in issue detail and peek overview. And also updated the popover UI component

Changes:

  1. Activity filter component
  2. ce issue constants

Plane Issue:

[WEB-1882]

Summary by CodeRabbit

  • New Features

    • Introduced a new component for managing activity filters, enhancing user interactivity with filter options.
    • Added a streamlined filtering mechanism to improve usability in the issue activity display.
  • Refactor

    • Simplified the ActivityFilter component by integrating it with a new PopoverMenu, improving maintainability.
  • Documentation

    • Updated documentation for the time conversion utility to reflect changes in functionality and provide clearer examples.
  • Chores

    • Enhanced module exports for better organization and accessibility of components related to activity filtering.

Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

The recent changes introduce a new ActivityFilterRoot component for managing activity filters within the application, enhancing the user interface and modularity. Additionally, re-exports for the filtering components streamline imports across the codebase. The utility for time conversion has also been simplified to focus solely on hours and minutes, improving usability. Overall, these updates aim to improve functionality and maintainability throughout the application's components.

Changes

Files Change Summary
web/ce/components/issues/worklog/activity/filter-root.tsx Introduced ActivityFilterRoot component to manage activity filters, utilizing TypeScript for type safety and interactive filter selection.
web/ce/components/issues/worklog/activity/index.ts Added export for the new filter-root module, enhancing accessibility of filtering capabilities.
web/ce/constants/issues.ts Introduced TActivityFilterOption type definition to standardize the structure of activity filter options, enhancing type safety.
web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx Refactored ActivityFilter to PopoverMenu with a focus on filter options; simplified props and rendering logic for better clarity and maintainability.
web/core/components/issues/issue-detail/issue-activity/root.tsx Replaced ActivityFilter with ActivityFilterRoot, indicating an update in filtering functionality.
web/ee/components/issues/worklog/activity/filter-root.tsx Created a re-export for filter-root, improving code organization and accessibility.
web/ee/components/issues/worklog/activity/index.ts Added export for filter-root to enhance the module's interface and increase reusability.
web/helpers/date-time.helper.ts Updated time conversion utility, replacing convertMinutesToDaysHoursMinutes with a simpler convertMinutesToHoursMinutesString for improved clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ActivityFilterRoot
    participant ActivityFilter
    User->>ActivityFilterRoot: Toggle filter
    ActivityFilterRoot->>ActivityFilter: Update selected filters
    ActivityFilter-->>User: Display updated filters
Loading

🐇 In the meadow where bunnies hop,
New filters bloom, they never stop!
With types and options, clear and bright,
Our code now dances with pure delight!
So let’s rejoice and give a cheer,
For changes made bring joy and cheer! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 31fe9a1 and 15a6ef2.

Files selected for processing (8)
  • web/ce/components/issues/worklog/activity/filter-root.tsx (1 hunks)
  • web/ce/components/issues/worklog/activity/index.ts (1 hunks)
  • web/ce/constants/issues.ts (1 hunks)
  • web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx (1 hunks)
  • web/core/components/issues/issue-detail/issue-activity/root.tsx (2 hunks)
  • web/ee/components/issues/worklog/activity/filter-root.tsx (1 hunks)
  • web/ee/components/issues/worklog/activity/index.ts (1 hunks)
  • web/helpers/date-time.helper.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • web/ce/components/issues/worklog/activity/index.ts
  • web/ee/components/issues/worklog/activity/filter-root.tsx
Additional comments not posted (8)
web/ee/components/issues/worklog/activity/index.ts (1)

3-4: LGTM!

The new export statement enhances modularity and reusability by re-exporting all exports from filter-root.

web/ce/constants/issues.ts (1)

21-26: LGTM!

The new type definition TActivityFilterOption adds clarity and type safety for activity filter options.

web/ce/components/issues/worklog/activity/filter-root.tsx (1)

1-28: LGTM!

The new ActivityFilterRoot component is well-structured and effectively uses the newly defined type TActivityFilterOption. The mapping of filter options and rendering of the ActivityFilter component are clear and concise.

web/core/components/issues/issue-detail/issue-activity/activity-filter.tsx (2)

1-8: LGTM!

The import statements have been updated correctly to align with the refactored component structure.


10-12: LGTM!

The type definition for TActivityFilter is correct and aligns with the new props structure.

web/core/components/issues/issue-detail/issue-activity/root.tsx (2)

10-15: LGTM!

The import statements have been updated correctly to replace ActivityFilter with ActivityFilterRoot.


123-123: LGTM!

The ActivityFilter component has been replaced with ActivityFilterRoot, aligning with the new filtering mechanism and improving functionality.

web/helpers/date-time.helper.ts (1)

326-334: LGTM!

The convertMinutesToHoursMinutesString function simplifies the output to focus solely on hours and minutes, reducing complexity and improving usability.

Comment on lines +15 to +57
export const ActivityFilter: FC<TActivityFilter> = observer((props) => {
const { selectedFilters = [], filterOptions } = props;

<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
return (
<PopoverMenu
buttonClassName="outline-none"
button={
<Button
variant="neutral-primary"
size="sm"
prependIcon={<ListFilter className="h-3 w-3" />}
className="relative"
>
<span className="text-custom-text-200">Filters</span>
</Button>
}
panelClassName="p-2 rounded-md border border-custom-border-200 bg-custom-background-100"
data={filterOptions}
keyExtractor={(item) => item.key}
render={(item) => (
<div
key={item.key}
className="flex items-center gap-2 text-sm cursor-pointer px-2 p-1 transition-all hover:bg-custom-background-80 rounded-sm"
onClick={item.onClick}
>
<div
className={cn(
"flex-shrink-0 w-3 h-3 flex justify-center items-center rounded-sm transition-all bg-custom-background-90",
{
"bg-custom-primary text-white": item.isSelected,
"bg-custom-background-80 text-custom-text-400": item.isSelected && selectedFilters.length === 1,
"bg-custom-background-90": !item.isSelected,
}
)}
>
<Popover.Panel className="absolute mt-2 right-0 z-10 min-w-40">
<div className="p-2 rounded-md border border-custom-border-200 bg-custom-background-100">
{Object.keys(ACTIVITY_FILTER_TYPE_OPTIONS).map((key) => {
const filterKey = key as TActivityFilters;
const filter = ACTIVITY_FILTER_TYPE_OPTIONS[filterKey];
const isSelected = selectedFilters.includes(filterKey);
return (
<div
key={filterKey}
className="flex items-center gap-2 text-sm cursor-pointer px-2 p-1 transition-all hover:bg-custom-background-80 rounded-sm"
onClick={() => toggleFilter(filterKey)}
>
<div
className={cn(
"flex-shrink-0 w-3 h-3 flex justify-center items-center rounded-sm transition-all bg-custom-background-90",
{
"bg-custom-primary text-white": isSelected,
"bg-custom-background-80 text-custom-text-400": isSelected && selectedFilters.length === 1,
"bg-custom-background-90": !isSelected,
}
)}
>
{isSelected && <Check className="h-2.5 w-2.5" />}
</div>
<div
className={cn(
"whitespace-nowrap",
isSelected ? "text-custom-text-100" : "text-custom-text-200"
)}
>
{filter.label}
</div>
</div>
);
})}
</div>
</Popover.Panel>
</Transition>
</>
{item.isSelected && <Check className="h-2.5 w-2.5" />}
</div>
<div className={cn("whitespace-nowrap", item.isSelected ? "text-custom-text-100" : "text-custom-text-200")}>
{item.label}
</div>
</div>
)}
</Popover>
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM! Consider adding tests for the new component structure.

The ActivityFilter component has been refactored to use PopoverMenu, improving modularity and maintainability. The rendering logic is now more streamlined.

Do you want me to generate the unit testing code or open a GitHub issue to track this task?

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.

2 participants