OpenCut icon indicating copy to clipboard operation
OpenCut copied to clipboard

Refactor/refactor icons

Open usamanasar38 opened this issue 1 year ago β€’ 5 comments

Description

  1. Replace img with nextjs Image component for images
  2. Add lucid react type to allow import of suffixed icons from lucid react only.
  3. Remove react-icons and use icon from svgl for consistency

Type of change

Please delete options that are not relevant.

  • [x] Code refactoring

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] My changes generate no new warnings
  • [x] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Refactor

    • Standardized all icon imports to use explicit *Icon naming for improved clarity and consistency.
    • Updated all icon usages across the app to match the new naming convention.
    • Replaced native <img> elements with Next.js <Image> component in multiple components for optimized image handling.
    • Refactored and enhanced custom social icon components for Google, GitHub, and Twitter (X), including improved accessibility and SVG updates.
    • Removed unused "react-icons" dependency.
  • Chores

    • Added a TypeScript declaration to provide typed support for suffixed exports from the icon library.

usamanasar38 avatar Jul 02 '25 19:07 usamanasar38

Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
Latest commit 127e400ba98614da0236c6c9d43cc61acd2fcc99

netlify avatar Jul 02 '25 19:07 netlify

@usamanasar38 is attempting to deploy a commit to the Maze Winther's projects Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jul 02 '25 19:07 vercel[bot]

Walkthrough

This update standardizes icon usage across the codebase by renaming all "lucide-react" icon imports and usages to include an "Icon" suffix (e.g., ArrowLeft β†’ ArrowLeftIcon). It also replaces native <img> elements with Next.js's <Image> component in several places and introduces a custom icon system for social icons. The "react-icons" dependency is removed.

Changes

Files/Groups Change Summary
apps/web/lucide-react.d.ts Adds a TypeScript declaration file re-exporting suffixed lucide-react icons.
apps/web/package.json Removes the "react-icons" dependency.
apps/web/src/app/(auth)/login/page.tsx, apps/web/src/app/(auth)/signup/page.tsx Renames lucide-react icon imports/usages to suffixed names (e.g., ArrowLeftIcon).
apps/web/src/app/contributors/page.tsx Refactors icon imports, updates button structure, and applies formatting improvements.
apps/web/src/app/projects/page.tsx Renames all lucide-react icon imports/usages to suffixed names; makes type-only import changes.
apps/web/src/components/editor-header.tsx, editor-provider.tsx, editor/timeline-toolbar.tsx Renames lucide-react icon imports/usages to suffixed names.
apps/web/src/components/editor/preview-panel.tsx, editor/timeline-clip.tsx, editor/media-panel/views/media.tsx, ui/image-timeline-treatment.tsx Replaces <img> tags with Next.js <Image> component; updates icon usage.
apps/web/src/components/editor/timeline-track.tsx, editor/timeline.tsx Renames all lucide-react icon imports/usages to suffixed names.
apps/web/src/components/footer.tsx Switches from react-icons to custom icon components for GitHub and Twitter.
apps/web/src/components/header.tsx, landing/hero.tsx Renames arrow icon import/usages to suffixed names.
apps/web/src/components/icons.tsx Refactors Google/GitHub icon components, adds XformerlyTwitterIcon, updates SVG data and props.
apps/web/src/components/ui/* (accordion, breadcrumb, calendar, carousel, checkbox, command, context-menu, dialog, drag-overlay, dropdown-menu, input-otp, input, menubar, navigation-menu, pagination, phone-input, radio-group, resizable, select, sheet, sidebar, toast) Renames lucide-react icon imports/usages to suffixed names throughout all UI primitives.

Sequence Diagram(s)

sequenceDiagram
  participant UI_Component
  participant LucideReact
  Note over UI_Component: Import Icon (e.g., ArrowLeftIcon) from lucide-react
  UI_Component->>LucideReact: Request Icon Component (e.g., ArrowLeftIcon)
  LucideReact-->>UI_Component: Return Icon Component
  UI_Component->>UI_Component: Render Icon in UI
sequenceDiagram
  participant AppComponent
  participant NextImage
  Note over AppComponent: Import Image from next/image
  AppComponent->>NextImage: Render image with props (src, alt, etc.)
  NextImage-->>AppComponent: Optimized image output

Poem

The icons have donned their "Icon" capes,
With suffixes clear, no room for escapes!
Images now optimized, with Next.js in tow,
Socials shine bright, in custom icon glow.
The code hops along, so tidy and neatβ€”
A rabbit’s delight, this refactor treat!
πŸ‡βœ¨


πŸ“œ Recent review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between b90ac1d2c42bfd7993433d1a64fe1b895c992957 and 127e400ba98614da0236c6c9d43cc61acd2fcc99.

β›” Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
πŸ“’ Files selected for processing (41)
  • apps/web/lucide-react.d.ts (1 hunks)
  • apps/web/package.json (0 hunks)
  • apps/web/src/app/(auth)/login/page.tsx (5 hunks)
  • apps/web/src/app/(auth)/signup/page.tsx (5 hunks)
  • apps/web/src/app/contributors/page.tsx (1 hunks)
  • apps/web/src/app/projects/page.tsx (8 hunks)
  • apps/web/src/components/editor-header.tsx (3 hunks)
  • apps/web/src/components/editor-provider.tsx (2 hunks)
  • apps/web/src/components/editor/media-panel/views/media.tsx (1 hunks)
  • apps/web/src/components/editor/preview-panel.tsx (3 hunks)
  • apps/web/src/components/editor/timeline-clip.tsx (7 hunks)
  • apps/web/src/components/editor/timeline-toolbar.tsx (9 hunks)
  • apps/web/src/components/editor/timeline-track.tsx (3 hunks)
  • apps/web/src/components/editor/timeline.tsx (12 hunks)
  • apps/web/src/components/footer.tsx (2 hunks)
  • apps/web/src/components/header.tsx (2 hunks)
  • apps/web/src/components/icons.tsx (1 hunks)
  • apps/web/src/components/landing/hero.tsx (2 hunks)
  • apps/web/src/components/ui/accordion.tsx (2 hunks)
  • apps/web/src/components/ui/breadcrumb.tsx (3 hunks)
  • apps/web/src/components/ui/calendar.tsx (2 hunks)
  • apps/web/src/components/ui/carousel.tsx (3 hunks)
  • apps/web/src/components/ui/checkbox.tsx (2 hunks)
  • apps/web/src/components/ui/command.tsx (2 hunks)
  • apps/web/src/components/ui/context-menu.tsx (4 hunks)
  • apps/web/src/components/ui/dialog.tsx (2 hunks)
  • apps/web/src/components/ui/drag-overlay.tsx (2 hunks)
  • apps/web/src/components/ui/dropdown-menu.tsx (4 hunks)
  • apps/web/src/components/ui/image-timeline-treatment.tsx (4 hunks)
  • apps/web/src/components/ui/input-otp.tsx (2 hunks)
  • apps/web/src/components/ui/input.tsx (2 hunks)
  • apps/web/src/components/ui/menubar.tsx (4 hunks)
  • apps/web/src/components/ui/navigation-menu.tsx (2 hunks)
  • apps/web/src/components/ui/pagination.tsx (4 hunks)
  • apps/web/src/components/ui/phone-input.tsx (2 hunks)
  • apps/web/src/components/ui/radio-group.tsx (2 hunks)
  • apps/web/src/components/ui/resizable.tsx (2 hunks)
  • apps/web/src/components/ui/select.tsx (5 hunks)
  • apps/web/src/components/ui/sheet.tsx (2 hunks)
  • apps/web/src/components/ui/sidebar.tsx (2 hunks)
  • apps/web/src/components/ui/toast.tsx (2 hunks)
πŸ’€ Files with no reviewable changes (1)
  • apps/web/package.json
βœ… Files skipped from review due to trivial changes (6)
  • apps/web/src/components/editor-provider.tsx
  • apps/web/src/components/ui/menubar.tsx
  • apps/web/lucide-react.d.ts
  • apps/web/src/components/editor/timeline.tsx
  • apps/web/src/app/projects/page.tsx
  • apps/web/src/components/editor/media-panel/views/media.tsx
🚧 Files skipped from review as they are similar to previous changes (34)
  • apps/web/src/components/ui/drag-overlay.tsx
  • apps/web/src/components/ui/checkbox.tsx
  • apps/web/src/components/ui/navigation-menu.tsx
  • apps/web/src/components/header.tsx
  • apps/web/src/components/ui/accordion.tsx
  • apps/web/src/components/ui/input-otp.tsx
  • apps/web/src/components/landing/hero.tsx
  • apps/web/src/components/ui/sidebar.tsx
  • apps/web/src/components/ui/dialog.tsx
  • apps/web/src/components/ui/radio-group.tsx
  • apps/web/src/components/ui/breadcrumb.tsx
  • apps/web/src/components/ui/toast.tsx
  • apps/web/src/app/(auth)/login/page.tsx
  • apps/web/src/components/ui/resizable.tsx
  • apps/web/src/components/ui/phone-input.tsx
  • apps/web/src/components/editor/timeline-track.tsx
  • apps/web/src/components/editor-header.tsx
  • apps/web/src/components/ui/sheet.tsx
  • apps/web/src/components/ui/command.tsx
  • apps/web/src/components/editor/timeline-toolbar.tsx
  • apps/web/src/components/ui/input.tsx
  • apps/web/src/components/ui/context-menu.tsx
  • apps/web/src/components/editor/preview-panel.tsx
  • apps/web/src/components/footer.tsx
  • apps/web/src/components/ui/carousel.tsx
  • apps/web/src/components/ui/image-timeline-treatment.tsx
  • apps/web/src/components/ui/pagination.tsx
  • apps/web/src/components/ui/select.tsx
  • apps/web/src/app/(auth)/signup/page.tsx
  • apps/web/src/components/ui/dropdown-menu.tsx
  • apps/web/src/components/ui/calendar.tsx
  • apps/web/src/components/editor/timeline-clip.tsx
  • apps/web/src/app/contributors/page.tsx
  • apps/web/src/components/icons.tsx
✨ Finishing Touches
  • [ ] πŸ“ Generate Docstrings

πŸͺ§ 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.

coderabbitai[bot] avatar Jul 02 '25 19:07 coderabbitai[bot]

@mazeincoding Please review and merge

usamanasar38 avatar Jul 04 '25 06:07 usamanasar38

what happened to the formatting

mazeincoding avatar Jul 12 '25 15:07 mazeincoding