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

refac: dirs #634

Merged
merged 2 commits into from
Nov 22, 2024
Merged

refac: dirs #634

merged 2 commits into from
Nov 22, 2024

Conversation

deewakar-k
Copy link
Contributor

What did you ship?

Fixes:

  • #XXX (GitHub issue number)
  • MAR-XXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

Checklist:

  • I have self-reviewed the code (A decent size PR without self-review might be rejected)
  • I pinky swear that my codes gonna work as I have testing every possible scenario.
  • I ignored Coderabbit suggestion because it does not make any sense.
  • I took Coderabbit suggestion under consideration as some of it makes sense.
  • I have commented my code, particularly in hard-to-understand areas.

OR:

  • shut up and let me cook.

Copy link

coderabbitai bot commented Nov 20, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request involves the removal of several React components, specifically a custom select dropdown and an inbox text area, from the frontend application. Additionally, multiple components have updated import paths for a utility function, changing from a relative path to an absolute path. The functionality of the remaining components is preserved despite these changes.

Changes

File Path Change Summary
apps/frontend/components/ui/select.tsx Component removed: Select, SelectGroup, SelectValue, SelectTrigger, SelectScrollUpButton, SelectScrollDownButton, SelectContent, SelectLabel, SelectItem, SelectSeparator.
apps/frontend/src/components/Dropdown/Dropdown.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/Icon.tsx Import path updated for cn from ../../lib/utils to @/src/utils/utils.
apps/frontend/src/components/Inbox/RescheduleCalendar/Calendar.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils. Component exported: Calendar.
apps/frontend/src/components/InboxTextArea.tsx Component removed: InboxTextArea.
apps/frontend/src/components/Skeleton.tsx Import path updated for cn from @/lib/utils to ../utils/utils.
apps/frontend/src/components/Surface.tsx Import path updated for cn from ../../lib/utils to @/src/utils/utils.
apps/frontend/src/components/TodayMeetings.tsx Component removed: TodayMeetings.
apps/frontend/src/components/atoms/Select.tsx Import path updated for Select and related components from "./ui/select" to "../ui/select".
apps/frontend/src/components/atoms/Switch.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/atoms/Tooltip.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/button.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/calendar.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils. Component exported: Calendar.
apps/frontend/src/components/ui/card.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/context-menu.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/dialog.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/dropdown.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/input.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/popover.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/select.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/textarea.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/components/ui/toast.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.
apps/frontend/src/extensions/SlashCommand/MenuList.tsx Import path updated for cn from @/lib/utils to @/src/utils/utils.

Possibly related PRs

  • feat: getThisWeekItemsByDateRange #397: The main PR involves the deletion of a custom select dropdown component, while this PR introduces a new controller function for fetching items based on date ranges, which may relate to how items are displayed or selected in the UI.
  • texteditor on expanded view #424: The main PR's changes to the UI components may relate to this PR's introduction of a text editor for expanded item views, as both involve user interaction with item details.
  • feat: reschedule calendar modal on inbox #518: The main PR's focus on item management aligns with this PR's enhancements to the InboxItems component, particularly regarding item rescheduling and state management.
  • This week imp #519: The main PR's changes to item display and management are relevant to this PR's modifications to the item fetching logic based on date ranges.
  • refac: item expand modal component for inbox, today and this week #581: The main PR's updates to the item expand modal component are directly related to this PR's focus on enhancing the modal functionality for inbox and other views.
  • refac: reading list #594: The main PR's changes to the reading list interface may connect with this PR's updates to the AddItemForm and ItemsList components, both of which involve user input and item management.
  • fix: github login #598: The main PR's modifications to the GitHub login functionality may relate to this PR's updates in the GithubLogin component, focusing on improving the login process.
  • Revert "Revert "refac: reading list"" #614: The main PR's restoration of previous changes may connect with this PR's focus on reverting a prior revert, indicating ongoing adjustments to the reading list feature.
  • refac: MAR-289 onboarding #574: The main PR's refactoring of onboarding components may relate to this PR's updates to the onboarding process, enhancing user experience and component organization.

🐰 In the meadow, changes bloom,
With dropdowns gone, there's more room.
Paths now clear, imports anew,
Components dance, in fresh view.
Hops of joy, as we refine,
Code so neat, it’s simply divine! 🌼


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>, please review it.
    • 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 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 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 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 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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f5e5427 and f4459af.

📒 Files selected for processing (23)
  • apps/frontend/components/ui/select.tsx (0 hunks)
  • apps/frontend/src/components/Dropdown/Dropdown.tsx (1 hunks)
  • apps/frontend/src/components/Icon.tsx (1 hunks)
  • apps/frontend/src/components/Inbox/RescheduleCalendar/Calendar.tsx (1 hunks)
  • apps/frontend/src/components/InboxTextArea.tsx (0 hunks)
  • apps/frontend/src/components/Skeleton.tsx (1 hunks)
  • apps/frontend/src/components/Surface.tsx (1 hunks)
  • apps/frontend/src/components/TodayMeetings.tsx (0 hunks)
  • apps/frontend/src/components/atoms/Select.tsx (1 hunks)
  • apps/frontend/src/components/atoms/Switch.tsx (1 hunks)
  • apps/frontend/src/components/atoms/Tooltip.tsx (1 hunks)
  • apps/frontend/src/components/ui/button.tsx (1 hunks)
  • apps/frontend/src/components/ui/calendar.tsx (1 hunks)
  • apps/frontend/src/components/ui/card.tsx (1 hunks)
  • apps/frontend/src/components/ui/context-menu.tsx (1 hunks)
  • apps/frontend/src/components/ui/dialog.tsx (1 hunks)
  • apps/frontend/src/components/ui/dropdown.tsx (1 hunks)
  • apps/frontend/src/components/ui/input.tsx (1 hunks)
  • apps/frontend/src/components/ui/popover.tsx (1 hunks)
  • apps/frontend/src/components/ui/select.tsx (1 hunks)
  • apps/frontend/src/components/ui/textarea.tsx (1 hunks)
  • apps/frontend/src/components/ui/toast.tsx (1 hunks)
  • apps/frontend/src/extensions/SlashCommand/MenuList.tsx (1 hunks)
💤 Files with no reviewable changes (3)
  • apps/frontend/components/ui/select.tsx
  • apps/frontend/src/components/InboxTextArea.tsx
  • apps/frontend/src/components/TodayMeetings.tsx
✅ Files skipped from review due to trivial changes (17)
  • apps/frontend/src/components/Dropdown/Dropdown.tsx
  • apps/frontend/src/components/Icon.tsx
  • apps/frontend/src/components/Skeleton.tsx
  • apps/frontend/src/components/Surface.tsx
  • apps/frontend/src/components/atoms/Select.tsx
  • apps/frontend/src/components/atoms/Switch.tsx
  • apps/frontend/src/components/ui/button.tsx
  • apps/frontend/src/components/ui/card.tsx
  • apps/frontend/src/components/ui/context-menu.tsx
  • apps/frontend/src/components/ui/dialog.tsx
  • apps/frontend/src/components/ui/dropdown.tsx
  • apps/frontend/src/components/ui/input.tsx
  • apps/frontend/src/components/ui/popover.tsx
  • apps/frontend/src/components/ui/select.tsx
  • apps/frontend/src/components/ui/textarea.tsx
  • apps/frontend/src/components/ui/toast.tsx
  • apps/frontend/src/extensions/SlashCommand/MenuList.tsx
🔇 Additional comments (5)
apps/frontend/src/components/atoms/Tooltip.tsx (1)

7-7: Verify consistency of the new import path across the codebase.

The import path change from @/lib/utils to @/src/utils/utils appears to be part of a broader refactoring effort. Let's ensure this new path is being used consistently.

✅ Verification successful

Import path change is consistent across the codebase

The verification shows that:

  • No instances of the old import path @/lib/utils were found
  • The new import path @/src/utils/utils is consistently used across 18 files
  • The utils file exists at the correct location: apps/frontend/src/utils/utils.ts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of import paths for the cn utility

# Check for any remaining old import paths
echo "Checking for old import paths..."
rg "from ['\"]\@/lib/utils['\"]"

# Check usage of new import path
echo "Checking usage of new import path..."
rg "from ['\"]\@/src/utils/utils['\"]"

# Verify the existence of the utils file in the new location
echo "Verifying existence of utils file..."
fd "utils\.ts$" "src/utils"

Length of output: 657


Script:

#!/bin/bash
# Let's fix the regex patterns and search paths

# Check for any remaining old import paths
echo "Checking for old import paths..."
rg "from ['\"]@/lib/utils['\"]"

# Check usage of new import path
echo "Checking usage of new import path..."
rg "from ['\"]@/src/utils/utils['\"]"

# Find utils file in the repository
echo "Finding utils files..."
fd "utils.ts"

Length of output: 1870

apps/frontend/src/components/Inbox/RescheduleCalendar/Calendar.tsx (3)

Line range hint 11-89: Implementation looks good!

The Calendar component is well-structured with:

  • Proper type definitions and props handling
  • Comprehensive styling for various states
  • Accessible navigation controls
  • Proper component composition

8-8: Verify consistent usage of the new utils import path

The import path change from @/lib/utils to @/src/utils/utils appears to be part of a broader refactoring. Let's ensure this change is consistent across the codebase.

✅ Verification successful

Import path migration is complete and consistent

The verification shows that:

  • No instances of the old import path @/lib/utils remain in the codebase
  • The new import path @/src/utils/utils is consistently used across multiple components
  • The change in Calendar.tsx aligns with the project-wide migration pattern
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and verify new import path usage

# Check for any remaining old imports
echo "Checking for remaining old import paths..."
rg "from ['\"]@/lib/utils['\"]"

# Verify new import path usage
echo "Verifying new import path usage..."
rg "from ['\"]@/src/utils/utils['\"]"

Length of output: 1784


Line range hint 41-42: Verify custom utility classes

The component uses custom utility classes that should be verified:

  • hover-text and hover-bg in the nav buttons and day elements
  • size-4 in the navigation icons

Please ensure these custom classes are properly defined in your CSS/Tailwind configuration.

Also applies to: 71-72

✅ Verification successful

Let me verify if size-4 is a built-in Tailwind utility class by checking the Tailwind CSS documentation.


Custom utility classes are properly defined

The verification shows that:

  • hover-text and hover-bg classes are defined in apps/frontend/src/styles/main.css
  • size-4 is a built-in Tailwind utility class for setting both width and height (equivalent to w-4 h-4)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for custom utility class definitions

# Search for custom utility class definitions in CSS files
echo "Checking for custom utility class definitions..."
fd -e css -e scss -e postcss | xargs rg "hover-text|hover-bg|size-4"

# Check Tailwind config
echo "Checking Tailwind configuration..."
fd "tailwind.config" | xargs cat

Length of output: 6908


Script:

#!/bin/bash
# Let's check the actual usage of size-4 in the component
rg "size-4" -A 2 -B 2 apps/frontend/src/components/Inbox/RescheduleCalendar/Calendar.tsx

Length of output: 297

apps/frontend/src/components/ui/calendar.tsx (1)

Line range hint 1-70: LGTM! Component functionality is preserved

The Calendar component maintains its functionality while adapting to the new import path. The component:

  • Properly types its props using CalendarProps
  • Maintains comprehensive styling configuration
  • Correctly implements the DayPicker interface

import { buttonVariants } from "@/src/components/ui/button"
import { cn } from "@/src/utils/utils"
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Update component configuration files to match new utils path

The verification revealed inconsistencies between the actual codebase and configuration:

  • The utils file exists at apps/frontend/src/utils/utils.ts
  • All components correctly import from @/src/utils/utils
  • However, both component.json and components.json still reference the old path @/lib/utils in their aliases

This configuration mismatch should be addressed:

  • Update component.json aliases.utils to @/src/utils/utils
  • Update components.json aliases.utils to @/src/utils/utils
🔗 Analysis chain

Verify the new import path across the codebase

The import path change from @/lib/utils to @/src/utils/utils appears to be part of a broader directory restructuring effort.

Let's verify the consistency of this change across the codebase:


Let me gather more information to verify the utils file location and configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths and verify new import path exists

# Check if any files still use the old import path
echo "Checking for old import paths..."
rg "@/lib/utils"

# Verify the new utils file exists
echo "Verifying new utils file exists..."
fd "utils.ts" "src/utils"

# Check for consistent usage of new import path
echo "Checking usage of new import path..."
rg "@/src/utils/utils"

Length of output: 2041


Script:

#!/bin/bash
# Check the actual location of utils.ts file
echo "Finding utils.ts in the repository..."
fd utils.ts apps/frontend

# Check component configuration files
echo "\nChecking component configuration..."
cat apps/frontend/component.json
echo "\nChecking components.json..."
cat apps/frontend/components.json

Length of output: 1227

@sajdakabir sajdakabir merged commit a237626 into preview Nov 22, 2024
5 checks passed
@sajdakabir sajdakabir deleted the refac/fe branch November 22, 2024 17:06
@coderabbitai coderabbitai bot mentioned this pull request Dec 4, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants