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

refactor(web): remove unsupported plugin API and options #1187

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

mkumbobeaty
Copy link
Contributor

@mkumbobeaty mkumbobeaty commented Oct 22, 2024

Overview

  • remove plugin API layersInViewport
  • remove option for marker imageCrop rounded
  • remove option for typography underline

What I've done

What I haven't done

How I tested

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • New Features

    • Removed the underline option from typography settings, simplifying text styling.
    • Updated image cropping options for markers, removing the "rounded" choice.
    • Introduced a new method for deleting layers from the layers collection.
  • Bug Fixes

    • Eliminated the layersInViewport functionality across various components, streamlining layer management.
  • Documentation

    • Updated translation files for English and Japanese, enhancing localization with new keys and translations for various UI elements and messages.

@mkumbobeaty mkumbobeaty marked this pull request as ready for review October 22, 2024 10:31
@github-actions github-actions bot added the web label Oct 22, 2024
Copy link

coderabbitai bot commented Oct 22, 2024

Walkthrough

The pull request introduces several modifications across various files, primarily focusing on the removal of the underline property from the TypographyInput component and adjustments to layer management functionalities. The marker.ts file sees a reduction in image crop options, while multiple files related to hooks and API types remove the layersInViewport functionality. These changes streamline the components and types involved, ensuring that the remaining properties and methods continue to function as intended without introducing new complexities.

Changes

File Change Summary
web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/TypographyInput.tsx Removed the underline property and its associated UI elements from the TypographyInput component.
web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/types.ts Removed underline property from the Typography type definition.
web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/appearanceNodes/marker.ts Altered imageCrop options from ["none", "rounded", "circle"] to ["none", "circle"], removing the "rounded" option.
web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts Removed layersInViewport from the return value of useLayers hook and simplified the dependency array in useMemo.
web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts Removed layersInViewport function from the useLayers hook.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts Removed layersInViewport property and added delete property to the layers object in the commonReearth function.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts Removed layersInViewport property from the Reearth type definition.
web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/layers.ts Removed layersInViewport and getLayersInViewport methods from the Layers type.
web/src/beta/features/Visualizer/Crust/Plugins/storybook.tsx Removed getLayersInViewport method from the layers property of the context object.
web/src/services/i18n/translations/en.yml Added numerous new translation keys for various UI elements and messages, enhancing localization for English-speaking users.
web/src/services/i18n/translations/ja.yml Added Japanese translations for various UI elements and messages, enhancing localization for Japanese-speaking users.

Possibly related PRs

Suggested reviewers

  • mkumbobeaty
  • m-abe-dev

Poem

In the meadow where fonts play,
The underline has hopped away.
Layers slimmed, no more to see,
Just circles now, as light as can be.
With every change, we dance and cheer,
For simpler styles, we hold dear! 🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4f81f56 and 57c9cfb.

📒 Files selected for processing (3)
  • web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts (0 hunks)
  • web/src/services/i18n/translations/en.yml (0 hunks)
  • web/src/services/i18n/translations/ja.yml (0 hunks)
💤 Files with no reviewable changes (3)
  • web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts
  • web/src/services/i18n/translations/en.yml
  • web/src/services/i18n/translations/ja.yml

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.

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

netlify bot commented Oct 22, 2024

Deploy Preview for reearth-web failed.

Name Link
🔨 Latest commit 3514244
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/6718b78133099800082bf82e

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

🧹 Outside diff range and nitpick comments (3)
web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts (3)

258-258: Approve simplification of useMemo dependency array with a minor suggestion.

The simplification of the useMemo dependency array improves code readability. However, for even better readability, consider breaking the long line into multiple lines, grouping related dependencies together.

Here's a suggested format:

[
  engineName, getViewerProperty, overrideViewerPropertyCommon, getViewport, captureScreen, 
  getInteractionMode, getInEditor, getIsBuilt, getLocationFromScreenCoordinate, 
  getScreenCoordinateFromPosition, getTerrainHeightAsync, getGlobeHeight, getGlobeHeightByCamera, 
  cartographicToCartesian, cartesianToCartographic, transformByOffsetOnScreen, 
  isPositionVisibleOnGlobe, viewerEventsOn, viewerEventsOff,
  // ... (group other dependencies similarly)
]

This format maintains the simplification while improving readability for developers working with this code in the future.


Line range hint 1-274: Overall assessment of changes.

The modifications in this file, particularly the removal of layersInViewport and the simplification of the useMemo dependency array, appear to be part of a broader refactoring effort. These changes contribute to code simplification and potentially improved performance.

However, given the scope of these changes:

  1. Ensure thorough testing of all features related to layer management and visibility.
  2. Update documentation to reflect the removal of layersInViewport.
  3. Communicate this change to the team to ensure everyone is aware of the new approach to handling layer visibility.

Consider creating a follow-up task to review the overall architecture of layer management in the application, ensuring that the new approach is consistently implemented and well-documented across the codebase.


Issues Found: Remaining References to layersInViewport

The removal of layersInViewport from the useLayers hook and the value object has left several references in the codebase. This may lead to potential regressions or unexpected behaviors.

Affected Files:

  • web/src/beta/features/Visualizer/Crust/index.tsx
  • web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts
  • web/src/beta/features/Editor/hooks/useLayers.ts
  • web/src/beta/features/Editor/hooks/index.ts
  • web/src/beta/features/Editor/Map/context.tsx
  • web/src/beta/features/Editor/Map/LayersPanel/LayerItem.tsx

Please address these references to ensure the removal does not introduce any issues.

🔗 Analysis chain

Line range hint 1-274: Verify the impact of removing layersInViewport.

The removal of layersInViewport from both the useLayers hook and the value object appears to be part of a larger refactoring effort. While this simplification is generally positive, it's crucial to ensure that this change doesn't negatively impact other parts of the application that may have relied on this property.

To confirm that this change doesn't introduce any regressions, please run the following verification script:

This script will help identify any areas of the codebase that might need attention due to the removal of layersInViewport. Please review the results and update any affected code as necessary.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to `layersInViewport` in the codebase

echo "Searching for remaining references to 'layersInViewport'..."
rg -i 'layersInViewport' --type ts --type tsx

echo "Checking for any 'TODO' or 'FIXME' comments related to layer visibility..."
rg -i '(TODO|FIXME).*layer.*visibility' --type ts --type tsx

echo "Searching for potential places where layer visibility logic might need updating..."
rg -i '(layer|layers).*visibility' --type ts --type tsx

Length of output: 731


Script:

#!/bin/bash
# Description: Check for any remaining references to 'layersInViewport' in the codebase

echo "Searching for remaining references to 'layersInViewport'..."
rg -i 'layersInViewport' --glob '*.ts' --glob '*.tsx'

echo "Checking for any 'TODO' or 'FIXME' comments related to layer visibility..."
rg -i '(TODO|FIXME).*layer.*visibility' --glob '*.ts' --glob '*.tsx'

echo "Searching for potential places where layer visibility logic might need updating..."
rg -i '(layer|layers).*visibility' --glob '*.ts' --glob '*.tsx'

Length of output: 3624

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bf5e7f8 and 4f81f56.

📒 Files selected for processing (9)
  • web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/TypographyInput.tsx (0 hunks)
  • web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/appearanceNodes/marker.ts (1 hunks)
  • web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/types.ts (0 hunks)
  • web/src/beta/features/Visualizer/Crust/Plugins/hooks/index.ts (1 hunks)
  • web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts (0 hunks)
  • web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts (0 hunks)
  • web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts (0 hunks)
  • web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/layers.ts (0 hunks)
  • web/src/beta/features/Visualizer/Crust/Plugins/storybook.tsx (0 hunks)
💤 Files with no reviewable changes (7)
  • web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/TypographyInput.tsx
  • web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/types.ts
  • web/src/beta/features/Visualizer/Crust/Plugins/hooks/useLayers.ts
  • web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/commonReearth.ts
  • web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/pluginAPIv1Types.ts
  • web/src/beta/features/Visualizer/Crust/Plugins/pluginAPI/types/layers.ts
  • web/src/beta/features/Visualizer/Crust/Plugins/storybook.tsx
🧰 Additional context used
🔇 Additional comments (1)
web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/appearanceNodes/marker.ts (1)

100-100: Removal of "rounded" option from imageCrop valueOptions

The removal of the "rounded" option from imageCrop aligns with the PR objective of removing rounded elements. However, consider the following points:

  1. Ensure that any existing markers using the "rounded" option are handled gracefully. You may need to implement a migration strategy or fallback option.
  2. Update any related UI components that display these options to reflect this change.
  3. Verify that removing this option doesn't break any dependent code or features.

To ensure this change doesn't affect other parts of the codebase, please run the following script:

✅ Verification successful

Removal of "rounded" option from imageCrop valueOptions Verified

No references to the removed "rounded" option were found in the codebase. The removal does not affect other parts of the project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any references to the removed "rounded" option in imageCrop context
rg -i 'imageCrop.*rounded' --type ts --type tsx

Length of output: 77


Script:

#!/bin/bash
# Search for any references to the removed "rounded" option in imageCrop context
rg -i 'imageCrop.*rounded' -g "*.ts" -g "*.tsx"

Length of output: 49

@airslice airslice changed the title chore(web): bug fix refactor(web): remove unsupported plugin API Oct 23, 2024
@airslice airslice changed the title refactor(web): remove unsupported plugin API refactor(web): remove unsupported plugin API and options Oct 23, 2024
@airslice airslice merged commit 5679fa8 into main Oct 23, 2024
9 of 13 checks passed
@airslice airslice deleted the chore/remove-layersInViewport branch October 23, 2024 09:27
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