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): clean up components in beta #1176

Merged
merged 12 commits into from
Oct 16, 2024
Merged

Conversation

mkumbobeaty
Copy link
Contributor

@mkumbobeaty mkumbobeaty commented Oct 15, 2024

Overview

  • Implement not found page and remove unused component

What I've done

What I haven't done

How I tested

Which point I want you to review particularly

Memo

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new NotFound component for displaying 404 error pages.
    • Added a new NotFoundPage component for routing purposes.
    • Enhanced user feedback in Japanese with new messages for navigation errors.
    • Added new SVG icons to improve visual elements across the application.
  • Bug Fixes

    • Simplified error handling by rendering the NotFound component without custom props.
  • Documentation

    • Added Storybook stories for the new NotFound component.
  • Chores

    • Removed several unused components and translation keys to streamline the application.
    • Updated translations to improve user guidance and navigation feedback.
    • Refactored import paths for better organization and consistency.
    • Updated styling and structure of various components for improved consistency and accessibility.

Copy link

netlify bot commented Oct 15, 2024

Deploy Preview for reearth-web ready!

Name Link
🔨 Latest commit 92216dc
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/670f9ee8b5f8860008f84e79
😎 Deploy Preview https://deploy-preview-1176--reearth-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mkumbobeaty mkumbobeaty marked this pull request as ready for review October 15, 2024 16:06
@mkumbobeaty mkumbobeaty requested a review from airslice as a code owner October 15, 2024 16:07
Copy link

coderabbitai bot commented Oct 15, 2024

Walkthrough

This pull request involves the removal of the FloatedPanel and Slide components, along with their associated Storybook stories, and the introduction of a new NotFound component with its own stories. The NotFound component is designed to display a 404 error page and is integrated into various pages, replacing previous implementations. Additionally, numerous translation keys have been removed from the English and Japanese localization files, reflecting a significant reduction in user feedback messages.

Changes

File Path Change Summary
web/src/beta/components/FloatedPanel/index.stories.tsx File deleted; contained Storybook stories for the FloatedPanel component.
web/src/beta/components/FloatedPanel/index.tsx File deleted; contained the FloatedPanel React component.
web/src/beta/components/Slide/index.tsx File deleted; contained the Slide React component.
web/src/beta/features/NotFound/index.stories.tsx New Storybook story added for the NotFound component.
web/src/beta/features/NotFound/index.tsx New NotFound component added for 404 error page.
web/src/beta/features/Published/index.tsx Modified import for NotFound component; removed useT hook and simplified rendering.
web/src/beta/pages/EditorPage/index.tsx Modified import for NotFound component from components to features.
web/src/beta/pages/NotFound/index.tsx New NotFoundPage component added; utilizes NotFound component.
web/src/beta/pages/ProjectSettingsPage/index.tsx Modified import for NotFound component from components to features.
web/src/beta/services/i18n/translations/en.yml Multiple keys removed, indicating reduced user feedback messages.
web/src/beta/services/i18n/translations/ja.yml Multiple keys removed; new entries added for improved navigation feedback.
web/src/beta/features/ProjectSettings/innerPages/GeneralSettings/index.tsx Import path updated for defaultBetaProjectImage.
web/src/beta/features/ProjectSettings/innerPages/PublicSettings/PublicSettingsDetail.tsx Import path updated for defaultBetaProjectImage.
web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Camera/Content.tsx Import path updated for Button and prop updated for StyledButton.
web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Layer/Content.tsx Import path updated for Button and prop updated for StyledButton.
web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx Import path updated for Button and prop updated for StyledButton.
web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Timeline/Editor.tsx Import path updated for Icon and several icons replaced.
web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx Updated to use Typography instead of Text and refactored styled components.
web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx Import path updated for Icon and new styled component added.
web/src/beta/lib/reearth-ui/components/Icon/index.tsx New optional property ariaLabel added to IconProps type for accessibility.

Possibly related PRs

  • feat(web): layer style node system #1143: The main PR involves the removal of the FloatedPanel component, which is related to the changes in the LayerStyleEditor and its handling of layer styles, as it may affect how styles are managed in the editor.
  • feat(web): add account page to change password #1155: The changes in the main PR regarding the removal of the FloatedPanel component may impact the account settings page, which is also being updated to allow users to change their passwords, indicating a potential overlap in user interface components.
  • refactor(web): layer style editor node support typography #1168: The modifications in the ConditionsTab and ExpressionTab components relate to the overall structure and functionality of the layer style editor, which is relevant to the main PR's focus on removing the FloatedPanel component.
  • feat(web): new layer style final step #1175: The finalization of the new layer style implementation directly relates to the main PR's changes, as it involves the overall structure and functionality of layer styles, which may be impacted by the removal of the FloatedPanel component.

Suggested reviewers

  • airslice
  • pyshx

🐰 "In the code, a change we see,
A new NotFound, as bright as can be!
With stories to tell, and paths to roam,
The rabbit hops back, to make it feel like home.
Components removed, but fear not, my friend,
For in every end, a new path we’ll send!" 🐇✨


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.

@github-actions github-actions bot requested a review from pyshx October 15, 2024 16:07
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: 3

🧹 Outside diff range and nitpick comments (17)
web/src/beta/pages/NotFound/index.tsx (2)

6-9: LGTM: Component is well-structured. Consider error handling.

The NotFoundPage component is concise and follows functional component best practices. The use of a render prop for Page allows for flexible composition.

Consider adding error boundaries or fallback UI if there's a possibility of errors when rendering the NotFound component. This would enhance the robustness of the page.


1-11: Great job! The NotFoundPage implementation is clean and effective.

The NotFoundPage component is well-implemented, following React and TypeScript best practices. It's concise, focused, and aligns well with the PR objective of implementing a "not found" page. The code is easy to understand and maintain.

As the application grows, consider implementing a centralized routing system (if not already in place) to manage all your routes, including this NotFoundPage. This would enhance the overall architecture and make it easier to manage navigation throughout the application.

web/src/beta/lib/reearth-ui/components/NotFound/index.stories.tsx (2)

6-8: Configuration looks good, but could be enhanced.

The basic configuration for the Storybook story is correct. However, consider adding more metadata to improve the story's documentation and organization in Storybook.

You might want to enhance the configuration with additional properties:

export default {
  component: NotFound,
  title: 'Components/NotFound',
  tags: ['autodocs'],
  parameters: {
    layout: 'fullscreen',
  },
} as Meta;

This will improve the story's organization and auto-generate documentation.


10-14: Default story is well-structured.

The Default story correctly wraps the NotFound component in a MemoryRouter, which is good practice for components that might use routing.

Consider enhancing the story with parameters or decorators for better visualization:

export const Default = () => (
  <MemoryRouter>
    <NotFound />
  </MemoryRouter>
);
Default.parameters = {
  backgrounds: { default: 'dark' },
};

This will allow you to control the background color in Storybook, which might be useful for visualizing the NotFound component in different contexts.

web/src/beta/lib/reearth-ui/components/index.ts (1)

29-29: LGTM! Consider maintaining alphabetical order of exports.

The addition of the NotFound component export aligns with the PR objectives and makes the new component available for use in other parts of the application. This change is straightforward and doesn't conflict with existing exports.

For better maintainability, consider keeping the exports in alphabetical order. You might want to move this new export higher up in the file to maintain alphabetical sorting.

web/src/beta/features/Published/index.tsx (1)

Line range hint 1-45: Overall, good simplification, but ensure comprehensive error handling

The changes to this file align well with the PR objective of cleaning up components. The Published component has been simplified, which improves maintainability. However, it's crucial to ensure that the new NotFound component adequately handles all necessary use cases, including proper localization.

As a follow-up action, I recommend:

  1. Reviewing the implementation of the new NotFound component to confirm it covers all required scenarios.
  2. Updating or creating tests for the Published component to verify the new error handling behavior.
  3. Checking other components that might have used the old NotFound implementation to ensure consistency across the application.
web/src/beta/lib/reearth-ui/components/NotFound/index.tsx (2)

9-38: LGTM: Well-structured component with a minor accessibility suggestion.

The NotFound component is well-implemented, using React hooks effectively and following best practices. The layout is semantically structured, and all text is properly internationalized.

Consider adding an aria-label to the Button component to improve accessibility:

 <Button
   appearance="primary"
   title={t("Go to Dashboard")}
+  aria-label={t("Navigate to dashboard")}
   onClick={handleClick}
 />

40-54: LGTM: Well-structured styled components with a suggestion for improvement.

The styled components are well-implemented, using theme properties consistently and creating a responsive layout suitable for a 404 page.

Consider extracting the styled components to a separate file (e.g., styles.ts) to improve code organization and reusability:

// styles.ts
import { styled } from "@reearth/services/theme";

export const Wrapper = styled("div")(({ theme }) => ({
  // ... existing styles
}));

export const EmptyContent = styled("div")(({ theme }) => ({
  // ... existing styles
}));

// index.tsx
import { Wrapper, EmptyContent } from "./styles";

This separation of concerns can make the main component file cleaner and more focused on logic rather than styling.

web/src/services/routing/index.tsx (2)

15-15: Approve import change with a minor suggestion.

The relocation of the NotFound component from 'components' to 'pages' and its renaming to 'NotFoundPage' improves the overall structure and clarity of the codebase. This change aligns well with the PR's objective of cleaning up components.

Consider updating the import statements for other page components to follow the same pattern for consistency. For example:

-const Dashboard = lazy(() => import("@reearth/beta/pages/Dashboard"));
+const DashboardPage = lazy(() => import("@reearth/beta/pages/Dashboard"));

Line range hint 1-70: Overall impact is minimal with room for further consistency.

The changes to the NotFoundPage import and route definition are well-implemented and improve the codebase structure. The isolated nature of these changes minimizes the risk of unintended side effects on other routes.

To further improve consistency across the codebase, consider:

  1. Renaming other page components to include the 'Page' suffix (e.g., DashboardPage, EditorPage).
  2. Updating import statements for all page components to follow the new pattern:
    const SomePage = lazy(() => import("@reearth/beta/pages/SomePage"));
  3. Ensuring that all components in the 'pages' directory are indeed page-level components.

These changes would enhance the overall consistency and readability of the routing configuration.

web/src/beta/features/Visualizer/FovSlider/index.tsx (1)

38-44: Consider refining Typography component usage

The replacement of Text with Typography and the use of theme-based props is a good improvement. However, the use of otherProperties for applying additional styles might not be the most type-safe or idiomatic approach.

Consider defining these additional properties directly in the Typography component or using a styled wrapper. For example:

<Typography
  size="footnote"
  color={theme.content.withBackground}
  style={{ marginRight: "16px" }}
>
  {t("Angle")}
</Typography>

Or:

const StyledTypography = styled(Typography)({
  marginRight: "16px"
});

<StyledTypography
  size="footnote"
  color={theme.content.withBackground}
>
  {t("Angle")}
</StyledTypography>
web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (4)

Line range hint 152-163: LGTM: Improved typography implementation with a minor suggestion

The replacement of the Text component with Typography is consistent with the new import and improves the overall design system integration. The use of standardized size and color props enhances consistency and maintainability.

Consider extracting the marginLeft logic into a separate variable or utility function to improve readability:

const iconMargin = b?.buttonIcon && b?.buttonStyle === "texticon" ? "5px" : undefined;

<Typography
  size="body"
  color={b?.buttonColor}
  otherProperties={{
    marginLeft: iconMargin
  }}
>
  {b?.buttonTitle}
</Typography>

202-212: LGTM: Improved styled component with a suggestion

The update to the Wrapper styled component uses a more modern function-based syntax, which is good for type inference. The added styles enhance the layout and spacing, and the use of theme variables promotes consistency.

Consider using object shorthand notation for the backgroundColor property:

"&, > div": {
  backgroundColor: button?.buttonBgcolor ?? publishedTheme?.background
}

This change makes the code more concise and uses the nullish coalescing operator for better readability.


214-233: LGTM: Enhanced Button styling with a suggestion

The Button styled component has been updated with a more modern syntax and additional styles, providing better control over its appearance. The use of theme variables and conditional styling based on props is a good practice for maintaining consistency and flexibility.

Consider using template literals for the padding value to improve readability:

padding: `0 ${theme.spacing.small + 2}px`,

Also, you might want to consider using a theme variable for the 35px height and line-height if it's a common value in your design system.


259-284: LGTM: Improved MenuItem styling with a suggestion

The MenuItem styled component has been updated with a function-based syntax, consistent with other components. The new styles provide more precise control over the menu item's appearance, and the conditional styling based on the item type adds flexibility. The use of theme variables and props for styling is well-maintained.

Consider simplifying the conditional expressions for better readability. For example:

padding: item?.menuType === "border"
  ? `0 ${theme.spacing.small + 2}px`
  : `${theme.spacing.micro}px ${theme.spacing.small + 2}px`,

background: item?.menuType === "border"
  ? mask(button?.buttonBgcolor) || publishedTheme?.mask
  : undefined,

"&:hover": {
  background: item?.menuType === "border"
    ? undefined
    : mask(button?.buttonBgcolor) || publishedTheme?.mask
}

This change reduces nesting and makes the conditions easier to read at a glance.

web/src/services/i18n/translations/en.yml (1)

Line range hint 1-299: Consider improving translations file structure and completeness

While reviewing the overall state of the translations file, I noticed a few areas for potential improvement:

  1. Empty translations: Many entries have empty string values (e.g., "Account: ''"). These should be filled with appropriate English text to ensure all UI elements display correctly.

  2. File structure: The current flat structure may become difficult to maintain as the application grows. Consider organizing translations into logical groups using YAML's nested structure for better maintainability.

  3. Completeness: It's challenging to assess the completeness of the translations without full context of the application. Ensure that all user-facing text in the application has a corresponding entry in this file.

Here's an example of how you might structure the translations hierarchically:

account:
  name: "Name"
  email: "Email address"
  password: "Password"

errors:
  no_whitespace: "No whitespace is allowed."
  too_short: "Too short."
  too_long: "That is terribly long."

# ... other sections ...

not_found:
  message: "Oops, Page Not Found!"
  action: "Go to Dashboard"

This structure can make it easier to locate and manage related translations as the application evolves.

web/src/services/i18n/translations/ja.yml (1)

Line range hint 1-299: Improve overall consistency and completeness of translations

There are several inconsistencies and potential issues in the translation file:

  1. Inconsistent use of quotation marks: Some values use single quotes, some use double quotes, and others have no quotes. Standardize the use of quotation marks throughout the file.

  2. Empty translations: Many entries have empty values (''). These should be filled with appropriate Japanese translations to ensure a complete localization.

  3. Missing translations: Some entries have English text for both key and value. These should be translated to Japanese where appropriate.

  4. Inconsistent capitalization: Some English keys start with capital letters while others don't. Consider standardizing the capitalization for better maintainability.

To improve the overall quality and consistency of the translations:

  1. Review all entries with empty values and provide Japanese translations.
  2. Standardize the use of quotation marks (preferably single quotes) for all values.
  3. Ensure all user-facing text has a Japanese translation.
  4. Standardize the capitalization of English keys.

Example of standardized format:

'Page not found': 'ページが見つかりません'
'Go to dashboard': 'ダッシュボードへ移動'
'Search': '検索'
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b1c2db4 and f2a17f2.

📒 Files selected for processing (25)
  • web/src/beta/components/NotFound/index.stories.tsx (0 hunks)
  • web/src/beta/components/NotFound/index.tsx (0 hunks)
  • web/src/beta/components/Popover/context.ts (0 hunks)
  • web/src/beta/components/Popover/hooks.ts (0 hunks)
  • web/src/beta/components/Popover/index.stories.tsx (0 hunks)
  • web/src/beta/components/Popover/index.tsx (0 hunks)
  • web/src/beta/components/Popover/types.ts (0 hunks)
  • web/src/beta/components/fields/common/NumberInput/index.stories.tsx (0 hunks)
  • web/src/beta/components/fields/common/NumberInput/index.tsx (0 hunks)
  • web/src/beta/components/fields/common/TextInput/index.stories.tsx (0 hunks)
  • web/src/beta/components/fields/common/TextInput/index.tsx (0 hunks)
  • web/src/beta/components/fields/index.tsx (0 hunks)
  • web/src/beta/features/Editor/Map/LayerStylePanel/LayerStyleCard.tsx (0 hunks)
  • web/src/beta/features/Published/index.tsx (2 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (5 hunks)
  • web/src/beta/features/Visualizer/FovSlider/index.tsx (4 hunks)
  • web/src/beta/lib/reearth-ui/components/NotFound/index.stories.tsx (1 hunks)
  • web/src/beta/lib/reearth-ui/components/NotFound/index.tsx (1 hunks)
  • web/src/beta/lib/reearth-ui/components/index.ts (1 hunks)
  • web/src/beta/pages/EditorPage/index.tsx (1 hunks)
  • web/src/beta/pages/NotFound/index.tsx (1 hunks)
  • web/src/beta/pages/ProjectSettingsPage/index.tsx (1 hunks)
  • web/src/services/i18n/translations/en.yml (1 hunks)
  • web/src/services/i18n/translations/ja.yml (1 hunks)
  • web/src/services/routing/index.tsx (2 hunks)
💤 Files with no reviewable changes (13)
  • web/src/beta/components/NotFound/index.stories.tsx
  • web/src/beta/components/NotFound/index.tsx
  • web/src/beta/components/Popover/context.ts
  • web/src/beta/components/Popover/hooks.ts
  • web/src/beta/components/Popover/index.stories.tsx
  • web/src/beta/components/Popover/index.tsx
  • web/src/beta/components/Popover/types.ts
  • web/src/beta/components/fields/common/NumberInput/index.stories.tsx
  • web/src/beta/components/fields/common/NumberInput/index.tsx
  • web/src/beta/components/fields/common/TextInput/index.stories.tsx
  • web/src/beta/components/fields/common/TextInput/index.tsx
  • web/src/beta/components/fields/index.tsx
  • web/src/beta/features/Editor/Map/LayerStylePanel/LayerStyleCard.tsx
🧰 Additional context used
🔇 Additional comments (23)
web/src/beta/pages/NotFound/index.tsx (2)

1-4: LGTM: Imports are appropriate and well-structured.

The import statements are concise and import only the necessary components and types. The use of named imports is a good practice for maintainability.


11-11: LGTM: Export statement is correct.

The default export of NotFoundPage is appropriate for a single component file and follows common React component export patterns.

web/src/beta/lib/reearth-ui/components/NotFound/index.stories.tsx (2)

1-4: LGTM: Imports are correct and appropriate.

The necessary dependencies for Storybook and routing are imported, along with the NotFound component. This setup is correct for creating a Storybook story with routing context.


1-14: Overall, the Storybook story for NotFound is well-implemented.

The story is correctly structured and follows Storybook best practices. The use of MemoryRouter demonstrates good attention to potential routing dependencies. While the current implementation is sufficient, the suggested enhancements to the configuration and story parameters could further improve the documentation and visualization in Storybook.

web/src/beta/pages/EditorPage/index.tsx (1)

3-3: LGTM! Verify consistent usage of the new NotFound import.

The change aligns with the PR objectives of cleaning up components. The NotFound component has been moved to a shared UI library, which is a good practice for maintaining consistency and reusability.

To ensure this change doesn't introduce any issues, please run the following script to verify the consistent usage of the new NotFound import across the codebase:

This script will help identify any inconsistencies in the NotFound component usage across the project.

✅ Verification successful

Action Required: Please run the corrected shell script to verify the consistent usage of the new NotFound import.


Action Required: Please run the corrected shell script to verify the consistent usage of the new NotFound import.


Action Required: Please run the corrected shell script to verify the consistent usage of the new NotFound import.


Action Required: Please run the corrected shell script to verify the consistent usage of the new NotFound import.


Verified: Consistent usage of the new NotFound import confirmed across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old imports of NotFound and verify the new import usage

# Test 1: Check for any remaining old imports
echo "Checking for old NotFound imports:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/components/NotFound[\'"]'

# Test 2: Verify the new import usage
echo "Verifying new NotFound import usage:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/lib/reearth-ui[\'"]'

# Test 3: Check NotFound component usage to ensure API compatibility
echo "Checking NotFound component usage:"
rg --type typescript --type tsx '<NotFound'

Length of output: 173


Script:

#!/bin/bash
# Description: Check for any remaining old imports of NotFound and verify the new import usage

# Test 1: Check for any remaining old imports
echo "Checking for old NotFound imports:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/components/NotFound[\'"]'

# Test 2: Verify the new import usage
echo "Verifying new NotFound import usage:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/lib/reearth-ui[\'"]'

# Test 3: Check NotFound component usage to ensure API compatibility
echo "Checking NotFound component usage:"
rg --type typescript --type tsx '<NotFound'

Length of output: 173


Script:

#!/bin/bash
# Description: Check for any remaining old imports of NotFound and verify the new import usage

# Test 1: Check for any remaining old imports
echo "Checking for old NotFound imports:"
rg --type typescript --type tsx "from\\s+[\"']@reearth/beta/components/NotFound[\"']"

# Test 2: Verify the new import usage
echo "Verifying new NotFound import usage:"
rg --type typescript --type tsx "from\\s+[\"']@reearth/beta/lib/reearth-ui[\"']"

# Test 3: Check NotFound component usage to ensure API compatibility
echo "Checking NotFound component usage:"
rg --type typescript --type tsx "<NotFound"

Length of output: 568


Script:

#!/bin/bash
# Description: Check for any remaining old imports of NotFound and verify the new import usage

# Test 1: Check for any remaining old imports
echo "Checking for old NotFound imports:"
rg --type ts --type tsx "from\s+['\"]@reearth/beta/components/NotFound['\"]"

# Test 2: Verify the new import usage
echo "Verifying new NotFound import usage:"
rg --type ts --type tsx "from\s+['\"]@reearth/beta/lib/reearth-ui['\"]"

# Test 3: Check NotFound component usage to ensure API compatibility
echo "Checking NotFound component usage:"
rg --type ts --type tsx "<NotFound"

Length of output: 523


Script:

#!/bin/bash
# Description: Check for any remaining old imports of NotFound and verify the new import usage

# Test 1: Check for any remaining old imports
echo "Checking for old NotFound imports:"
rg -g "*.ts" -g "*.tsx" "from\s+['\"]@reearth/beta/components/NotFound['\"]"

# Test 2: Verify the new import usage
echo "Verifying new NotFound import usage:"
rg -g "*.ts" -g "*.tsx" "from\s+['\"]@reearth/beta/lib/reearth-ui['\"]"

# Test 3: Check NotFound component usage to ensure API compatibility
echo "Checking NotFound component usage:"
rg -g "*.ts" -g "*.tsx" "<NotFound"

Length of output: 17888

web/src/beta/pages/ProjectSettingsPage/index.tsx (1)

4-4: Verify the new import path and ensure consistency across the project.

The change in the import statement for the NotFound component looks good. It reflects a shift towards a more centralized UI component structure.

However, to ensure the change doesn't introduce any issues:

  1. Please verify that the new import path @reearth/beta/lib/reearth-ui is correct and the NotFound component is indeed exported from this module.
  2. Check if similar changes have been made consistently across other files in the project that use the NotFound component.

To verify the consistency of this change across the project, you can run the following script:

This script will help identify if there are any remaining imports from the old path and confirm the usage of the new import path across the project.

✅ Verification successful

All imports of NotFound have been successfully updated to the new path and are consistent across the project.

No issues found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining imports of NotFound from the old path
# and new imports from the new path

echo "Checking for old imports of NotFound:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/components/NotFound[\'"]'

echo "Checking for new imports of NotFound:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/lib/reearth-ui[\'"]'

Length of output: 178


Script:

#!/bin/bash
# Description: Check for any remaining imports of NotFound from the old path
# and verify new imports from the new path

echo "Checking for old imports of NotFound:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/components/NotFound[\'"]'

echo "Checking for new imports of NotFound:"
rg --type typescript --type tsx 'from\s+[\'"]@reearth/beta/lib/reearth-ui[\'"]'

Length of output: 178


Script:

#!/bin/bash
# Description: Check for any remaining imports of NotFound from the old path
# and verify new imports from the new path

echo "Checking for old imports of NotFound:"
rg --type typescript --type tsx "from\s+['\"]@reearth/beta/components/NotFound['\"]"

echo "Checking for new imports of NotFound:"
rg --type typescript --type tsx "from\s+['\"]@reearth/beta/lib/reearth-ui['\"]"

Length of output: 416


Script:

#!/bin/bash
# Description: Check for any remaining imports of NotFound from the old path
# and verify new imports from the new path

echo "Checking for old imports of NotFound:"
rg --type ts --type tsx "from\s+['\"]@reearth/beta/components/NotFound['\"]"

echo "Checking for new imports of NotFound:"
rg --type ts --type tsx "from\s+['\"]@reearth/beta/lib/reearth-ui['\"]"

Length of output: 386


Script:

#!/bin/bash
# Description: Check for any remaining imports of NotFound from the old path
# and verify new imports from the new path using file extensions

echo "Checking for old imports of NotFound:"
rg "from\s+['\"]@reearth/beta/components/NotFound['\"]" --glob "*.ts" --glob "*.tsx"

echo "Checking for new imports of NotFound:"
rg "from\s+['\"]@reearth/beta/lib/reearth-ui['\"]" --glob "*.ts" --glob "*.tsx"

Length of output: 17373

web/src/beta/features/Published/index.tsx (2)

2-2: LGTM: Import statement update improves code organization

The change from a component import to a named import from a centralized UI library (@reearth/beta/lib/reearth-ui) is a good practice. It suggests better code organization and can make it easier to maintain and update UI components across the project.


28-28: Simplified error handling looks good, but verify new behavior

The simplified rendering of the NotFound component without custom props reduces complexity in this component, which is good for maintainability. However, ensure that this change doesn't lose any necessary customization for error messages in this context.

To verify that the new NotFound component meets all requirements, please run the following script:

web/src/beta/lib/reearth-ui/components/NotFound/index.tsx (2)

1-7: LGTM: Imports are well-organized and necessary.

The imports are logically ordered and include all the necessary dependencies for the component's functionality.


1-54: Overall assessment: Well-implemented NotFound component.

This new NotFound component is well-structured, follows React best practices, and aligns with the PR objectives. It effectively implements a 404 error page with proper internationalization and theming.

Key strengths:

  1. Effective use of React hooks and memoization.
  2. Consistent use of theme properties in styled components.
  3. Proper internationalization of all text content.

Minor suggestions for improvement have been provided in previous comments, including:

  1. Adding an aria-label to the Button component for better accessibility.
  2. Considering the extraction of styled components to a separate file for improved code organization.

These suggestions are optional and do not detract from the overall quality of the implementation.

web/src/services/routing/index.tsx (1)

61-61: Route definition correctly updated.

The catch-all route has been properly updated to use the new NotFoundPage component. This change maintains the correct routing structure and ensures that the "not found" page will be displayed for any unmatched routes.

web/src/beta/features/Visualizer/FovSlider/index.tsx (7)

3-3: LGTM: Importing Typography component

The change to import the Typography component from the reearth-ui library is a good practice. It promotes consistency in the UI and leverages the standardized components provided by the library.


56-57: LGTM: Consistent Typography usage

The replacement of Text with Typography for the "Narrow" and "Wide" labels is consistent with the earlier changes and maintains a uniform approach to text rendering throughout the component.


66-69: LGTM: Improved styled-components usage

The update to use a callback syntax in the styled function is a good improvement. This approach allows for better type checking and is more aligned with modern styled-components best practices. The styling logic remains unchanged, maintaining the component's visual consistency.


71-79: Excellent use of themed styling

The changes to the Wrapper styled component are well-implemented:

  1. The callback syntax with theme parameter allows for better theme integration.
  2. Using theme values for background, borderRadius, and padding improves consistency and maintainability.
  3. The object syntax for styles enhances type checking capabilities.

These changes will make the component more robust and easier to maintain in the future.


81-95: LGTM: Consistent styled-component improvements

The updates to FovField, FieldForm, and FieldSlider styled components are well-implemented and consistent with the earlier changes:

  1. All components now use the callback syntax, improving type safety.
  2. FieldSlider now properly utilizes the theme for spacing, enhancing design consistency.

These changes contribute to a more maintainable and consistent codebase.


97-100: LGTM: Consistent styled-component update

The change to FieldDescriptions styled component aligns with the updates made to other styled components in this file. The use of callback syntax improves type safety while maintaining the original styling logic.


Line range hint 1-100: Overall assessment: Improved component structure and styling

The changes made to this file represent a significant improvement in terms of code quality and maintainability:

  1. Consistent use of the Typography component from the reearth-ui library enhances UI consistency.
  2. Updates to styled-components syntax improve type safety and theme integration.
  3. The use of theme values for styling properties enhances design consistency and ease of maintenance.

These changes contribute to a more robust and maintainable codebase without altering the core functionality of the FovSlider component. Great job on these improvements!

web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (4)

3-3: LGTM: Improved typography consistency

The addition of the Typography component from the reearth-ui library is a good practice. It promotes consistency in text styling across the application and makes it easier to maintain a unified design system.


184-192: LGTM: Consistent typography implementation

The replacement of the Text component with Typography in the MenuItem is consistent with the previous changes. This maintains a uniform approach to text rendering throughout the component, which is a good practice for consistency and maintainability.


236-242: LGTM: Improved MenuWrapper styling

The MenuWrapper styled component has been updated with a function-based syntax, consistent with other components. The new styles enhance the menu's appearance and behavior, particularly for handling long lists. The use of theme variables for zIndex and borderRadius maintains consistency with the design system.

The addition of maxHeight and overflow properties is a good practice for handling varying amounts of content in the menu.


244-252: LGTM: Enhanced MenuInnerWrapper styling

The MenuInnerWrapper styled component has been updated with a function-based syntax, maintaining consistency with other components. The added and modified styles provide better control over the menu's inner wrapper appearance. The use of props for conditional styling is preserved, allowing for flexible customization based on the component's state and theme.

The addition of width: "100%" ensures that the inner wrapper takes up the full width of its container, which is good for consistency in layout.

web/src/services/i18n/translations/en.yml (1)

Line range hint 1-297: Verify intentional removal of translation entries

A significant number of translation entries have been removed from this file. While this aligns with the PR objective of removing unused components, it's crucial to ensure that these removals are intentional and won't result in missing translations in the application.

Please confirm that:

  1. All removed entries correspond to removed or refactored functionality in the application.
  2. There are no remaining references to these removed translations in the codebase.

To help verify this, you can run the following script to search for any remaining references to the removed translations:

This script will help identify any lingering references to the removed translations, which should be addressed if found.

web/src/services/i18n/translations/en.yml Outdated Show resolved Hide resolved
web/src/services/i18n/translations/ja.yml Outdated Show resolved Hide resolved
web/src/services/i18n/translations/ja.yml Outdated Show resolved Hide resolved
@airslice airslice changed the title chore(web): clean components in beta refactor(web): clean up components in beta Oct 16, 2024
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

🧹 Outside diff range and nitpick comments (12)
web/src/beta/features/NotFound/index.stories.tsx (2)

6-8: LGTM: Storybook configuration is correct.

The default export correctly configures the NotFound component for Storybook. The use of 'as Meta' ensures type safety.

Consider adding more configuration options such as a title or decorators to enhance the story's organization and presentation in Storybook. For example:

export default {
  component: NotFound,
  title: 'Features/NotFound',
  decorators: [(Story) => <div style={{ padding: '1rem' }}><Story /></div>]
} as Meta;

10-14: LGTM: Default story is correctly implemented.

The Default story appropriately renders the NotFound component within a MemoryRouter, providing the necessary routing context.

Consider adding more stories to showcase different states or variations of the NotFound component, if applicable. For example:

export const CustomMessage = () => (
  <MemoryRouter>
    <NotFound message="Custom 404 message" />
  </MemoryRouter>
);

export const WithRetryButton = () => (
  <MemoryRouter>
    <NotFound showRetry={true} />
  </MemoryRouter>
);

This assumes the NotFound component accepts such props. If it doesn't, you might want to consider adding these capabilities to make the component more flexible.

web/src/beta/lib/reearth-ui/components/Slider/index.stories.tsx (1)

Line range hint 1-58: Overall, the changes look good and the file structure is well-maintained

The modifications to this file are minimal and focused, which is excellent for maintainability. The changes correctly update the types used for the Slider component, improving type consistency throughout the file. The story still provides good coverage of different Slider configurations, including default, extended range, and disabled states.

One minor point to consider:

  • The use of the spread operator (...args) in the Slider components could potentially hide prop changes if not carefully managed. However, this is a common pattern in Storybook stories and doesn't pose an immediate issue.

Consider adding a comment above each Slider instance in the story to explain the specific configuration being demonstrated. This would enhance the readability and maintainability of the story.

web/src/beta/features/RootPage/PageWrapper.tsx (1)

29-39: LGTM: Styled component updated correctly

The Wrapper styled component has been updated to align with the earlier changes. The new style properties effectively replace the functionality of the removed Flex component. This is a good refactoring that simplifies the component structure.

However, I have a small suggestion for improvement:

Consider extracting the background gradient to a separate constant or theme variable. This would improve readability and make it easier to maintain or update the gradient in the future. For example:

const defaultBackground = `linear-gradient(70deg, ${brandBlue} 10%, ${brandRed} 60%, ${brandBlue} 90%)`;

const Wrapper = styled.div<{ bg?: string }>(({ bg }) => ({
  // ... other styles
  background: bg || defaultBackground,
}));
web/src/beta/lib/reearth-ui/components/Slide/index.tsx (3)

10-22: LGTM: Well-implemented Slide component with a minor suggestion.

The Slide component is well-structured and follows React best practices. The use of React.Children.map ensures only valid React elements are rendered, and the key prop is correctly handled.

Consider adding a type assertion for better type safety:

- <Page key={child.key ?? undefined}>{child}</Page>
+ <Page key={child.key ?? undefined}>{child as React.ReactElement}</Page>

This change ensures that only React elements are passed as children to the Page component.


30-46: LGTM: Inner and Page styled components are well-implemented with a suggestion for optimization.

The Inner and Page components are well-styled to create the sliding effect and maintain proper layout. The use of flexbox and the transition effect on the Inner component are particularly noteworthy.

Consider using CSS will-change property for potential performance optimization:

const Inner = styled.div<{ pos?: number }>(({ pos }) => ({
  position: "relative",
  transform: `translateX(-${(pos ?? 0) * 100}%)`,
  transition: "transform 0.1s ease",
  display: "flex",
  flexWrap: "nowrap",
  alignItems: "stretch",
  width: "100%",
  height: "100%",
+ willChange: "transform"
}));

This hints to the browser that the transform property will change, potentially improving animation performance.


1-46: Overall, the Slide component is well-implemented with room for minor improvements.

The component is logically structured, follows React best practices, and uses styled-components effectively. The suggestions provided (type assertion for children and use of will-change for performance) are minor optimizations that could further enhance the component's robustness and performance.

Consider adding unit tests for this component to ensure its behavior remains consistent as the codebase evolves. Tests should cover different scenarios such as:

  1. Rendering with different numbers of children
  2. Proper sliding behavior when the pos prop changes
  3. Correct handling of non-React children (they should be filtered out)

This will help maintain the component's reliability and make future refactoring easier.

web/src/beta/features/NotFound/index.tsx (2)

8-14: LGTM: Hooks are used correctly. Consider memoizing the translation.

The hooks are used appropriately, and the handleClick function is correctly memoized with useCallback.

Consider memoizing the translated string for "Go to Dashboard" to optimize performance:

 const t = useT();
+const goToDashboardText = useMemo(() => t("Go to Dashboard"), [t]);

This way, the translation is only computed when the language changes, not on every render.


16-36: LGTM: Well-structured render logic. Consider adding an aria-label to the button.

The component's render logic is well-organized, using appropriate Typography components and translations. The button correctly uses the memoized handleClick function.

Consider adding an aria-label to the button to improve accessibility:

 <Button
   appearance="primary"
   title={t("Go to Dashboard")}
+  aria-label={t("Navigate to dashboard")}
   onClick={handleClick}
 />

This provides more context for screen reader users.

web/src/beta/lib/reearth-ui/components/Slider/index.tsx (1)

9-12: LGTM! Consider adding JSDoc comments for better documentation.

The renaming of 'Props' to 'SliderProps' and the addition of optional 'min' and 'max' properties improve the component's flexibility and clarity. These changes are backwards compatible and align well with the component's functionality.

Consider adding JSDoc comments to describe the purpose of the 'SliderProps' type and its properties. This would enhance the code's self-documentation. For example:

/**
 * Props for the Slider component.
 * @property {number} [min] - The minimum value of the slider.
 * @property {number} [max] - The maximum value of the slider.
 */
export type SliderProps = {
  min?: number;
  max?: number;
} & ComponentProps<typeof SliderWithTooltip>;
web/src/beta/lib/reearth-ui/components/Markdown/index.tsx (1)

19-19: LGTM: Updated component signature

The component signature has been correctly updated to use the new MarkdownProps type, maintaining consistency with the type renaming. This change ensures proper type checking and improves code readability.

For complete consistency, consider updating the JSDoc comment (if present) above the component definition to reflect the new prop type name.

web/src/beta/lib/reearth-ui/components/Icon/icons.ts (1)

Line range hint 1-291: Consider future refactoring for improved maintainability.

While the current structure works well, as the number of icons continues to grow, it might become challenging to maintain this single file. In the future, consider splitting the icons into categories or using a dynamic import system to automatically import all icons from a directory. This could improve maintainability and make it easier to add or remove icons.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f2a17f2 and e9cc5e4.

⛔ Files ignored due to path filters (114)
  • web/src/beta/README.md is excluded by !**/*.md
  • web/src/beta/components/README.md is excluded by !**/*.md
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/ReearthLogo.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/ReearthLogoColorful.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/Clock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/actionButton.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/addLayer.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/addLayerStyleButton.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/alert.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowDown.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowLeft.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowLongLeft.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowLongRight.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowRight.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowToggle.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/arrowUpDown.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/bin.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/book.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/box.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/cameraButtonStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/cancel.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/checkCircle.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/checkMark.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/circleOutline.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/compass.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/compassFocus.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/copy.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/crosshair.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/cylinder.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/dashboard.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/defaultBetaProjectImage.png is excluded by !**/*.png
  • web/src/beta/ui/widgetui/Icon/Icons/desktop.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/dndHandle.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/editIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/ellipse.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/exit.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/fileIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/folderPlus.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/gearSix.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/help.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/house.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/imageInfoboxBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/imageStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/infoboxHTMLIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/infoboxIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/infoboxLocationIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/infoboxTableIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/infoboxTextIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/infoboxVideoIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/install.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/layer.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/layerInspector.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/layerStyle.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/linkStoryBlockButton.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/logout.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/marker.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/marketplace.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/mdTextStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/minus.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/mobile.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/navigatorAngle.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/nextPageStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/padding.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/pause.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/pencilSimple.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/play-left.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/play-right.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/plugin.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/plus.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/plusSquare.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/pointer.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/polygon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/polygonExtruded.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/polyline.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/primPhotoIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/propertyInfoboxBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/publicGitHubRepo.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/reearthLogo.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/reearthLogoColorful.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/scene.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/search.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/set.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/settings.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/showLayersStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/sketch.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/slider.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/square.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/squareOutline.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/storyBlockEdit.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/storyPage.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/storytellingMenu.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/swiper.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/textBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/timeline-play-left.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/timeline-play-right.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/timeline.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/timelineStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/timelineStoryBlockSolid.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/titleStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/trash.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/uploadSimple.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/uploadZipPlugin.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/video.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/videoStoryBlock.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetButton.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetMenu.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetNavigator.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetSplashscreen.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetStorytelling.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetSystem.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/widgetsIcon.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/workspaceAdd.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/workspaces.svg is excluded by !**/*.svg
  • web/src/beta/ui/widgetui/Icon/Icons/zoomToLayer.svg is excluded by !**/*.svg
📒 Files selected for processing (32)
  • web/src/beta/components/FloatedPanel/index.stories.tsx (0 hunks)
  • web/src/beta/components/FloatedPanel/index.tsx (0 hunks)
  • web/src/beta/components/Slide/index.tsx (0 hunks)
  • web/src/beta/features/NotFound/index.stories.tsx (1 hunks)
  • web/src/beta/features/NotFound/index.tsx (1 hunks)
  • web/src/beta/features/Published/index.tsx (2 hunks)
  • web/src/beta/features/RootPage/PageWrapper.tsx (2 hunks)
  • web/src/beta/features/RootPage/index.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Camera/Content.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Layer/Content.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Timeline/Editor.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (5 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Timeline/UI/index.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/WidgetAlignSystem/MobileZone.tsx (1 hunks)
  • web/src/beta/features/Visualizer/FovSlider/hooks.ts (0 hunks)
  • web/src/beta/features/Visualizer/FovSlider/index.tsx (0 hunks)
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts (2 hunks)
  • web/src/beta/lib/reearth-ui/components/Markdown/index.stories.tsx (2 hunks)
  • web/src/beta/lib/reearth-ui/components/Markdown/index.tsx (2 hunks)
  • web/src/beta/lib/reearth-ui/components/Slide/index.stories.tsx (1 hunks)
  • web/src/beta/lib/reearth-ui/components/Slide/index.tsx (1 hunks)
  • web/src/beta/lib/reearth-ui/components/Slider/index.stories.tsx (2 hunks)
  • web/src/beta/lib/reearth-ui/components/Slider/index.tsx (1 hunks)
  • web/src/beta/lib/reearth-ui/components/index.ts (1 hunks)
  • web/src/beta/pages/EditorPage/index.tsx (1 hunks)
  • web/src/beta/pages/NotFound/index.tsx (1 hunks)
  • web/src/beta/pages/ProjectSettingsPage/index.tsx (1 hunks)
  • web/src/beta/ui/widgetui/Button/index.tsx (1 hunks)
  • web/src/services/i18n/translations/en.yml (1 hunks)
  • web/src/services/i18n/translations/ja.yml (1 hunks)
💤 Files with no reviewable changes (5)
  • web/src/beta/components/FloatedPanel/index.stories.tsx
  • web/src/beta/components/FloatedPanel/index.tsx
  • web/src/beta/components/Slide/index.tsx
  • web/src/beta/features/Visualizer/FovSlider/hooks.ts
  • web/src/beta/features/Visualizer/FovSlider/index.tsx
✅ Files skipped from review due to trivial changes (3)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Camera/Content.tsx
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Timeline/Editor.tsx
  • web/src/beta/ui/widgetui/Button/index.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
  • web/src/beta/features/Published/index.tsx
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx
  • web/src/beta/lib/reearth-ui/components/index.ts
  • web/src/beta/pages/EditorPage/index.tsx
  • web/src/beta/pages/NotFound/index.tsx
  • web/src/beta/pages/ProjectSettingsPage/index.tsx
  • web/src/services/i18n/translations/ja.yml
🧰 Additional context used
🔇 Additional comments (30)
web/src/beta/features/NotFound/index.stories.tsx (1)

1-4: LGTM: Imports are correct and necessary.

The imports are appropriate for creating a Storybook story with routing capabilities. The NotFound component is correctly imported from the current directory.

web/src/beta/features/RootPage/index.tsx (1)

5-5: LGTM! Verify the new location of PageWrapper.

The change from an external module import to a local relative import for PageWrapper is a good refactoring step. It aligns with the PR objectives of cleaning up components and potentially improves code organization.

To ensure the new file location is correct, please run the following script:

✅ Verification successful

Verification Successful: PageWrapper.tsx is correctly located.

The import statement in index.tsx correctly references the local PageWrapper.tsx without any issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of PageWrapper.tsx in the correct location

# Test: Check if PageWrapper.tsx exists in the same directory
if [ -f "$(dirname "$0")/PageWrapper.tsx" ]; then
    echo "PageWrapper.tsx found in the correct location."
else
    echo "Warning: PageWrapper.tsx not found in the expected location."
    echo "Searching for PageWrapper.tsx in nearby directories:"
    fd --max-depth 2 --type f "PageWrapper.tsx" "$(dirname "$0")/.."
fi

Length of output: 425


Script:

#!/bin/bash
# Description: Perform an exhaustive search for PageWrapper.tsx across the entire repository

# Search for PageWrapper.tsx with no depth limit
fd --type f "PageWrapper.tsx"

# If not found, search for the definition of the PageWrapper component
if [ $? -ne 0 ]; then
    echo "PageWrapper.tsx not found. Searching for the PageWrapper component definition."
    ast-grep --lang typescript --pattern $'function PageWrapper($_) { $$$ }'
fi

Length of output: 94

web/src/beta/lib/reearth-ui/components/Slide/index.stories.tsx (2)

Line range hint 1-44: LGTM! File is consistent with the import change.

The rest of the file, including the usage of the Slide component in the Default story, is consistent with the new import style. No other changes were necessary, and the overall structure and functionality of the Storybook story remain intact.


5-5: LGTM! Verify the export in the Slide component file.

The change from default import to named import is correct and consistent with the usage in the rest of the file. This suggests a refactoring of the Slide component's export style.

To ensure consistency, please verify that the Slide component is exported as a named export in its file:

web/src/beta/lib/reearth-ui/components/Markdown/index.stories.tsx (2)

33-33: LGTM: Type annotation updated consistently.

The type annotation for the args parameter in the Default story has been correctly updated from Props to MarkdownProps. This change is consistent with the import statement modification and ensures type safety throughout the component's usage in the story.


4-4: LGTM: Import statement updated correctly.

The import statement has been updated to use MarkdownProps instead of Props. This change reflects a refactoring of the component's prop types, which is a good practice for maintaining clear and specific type definitions.

Let's verify if this change is consistent across the codebase:

web/src/beta/lib/reearth-ui/components/Slider/index.stories.tsx (2)

6-6: LGTM: Import statement updated correctly

The import statement has been updated to use SliderProps instead of Props. This change improves type consistency and clarity for the Slider component.


16-16: LGTM: Type annotation updated consistently

The type annotation for the args parameter in the Default story function has been correctly updated to use SliderProps. This change is consistent with the import statement modification and ensures that the story uses the correct type for the Slider component props.

web/src/beta/features/RootPage/PageWrapper.tsx (3)

1-1: LGTM: Import path simplified

The change to a more general import path for the Icon component is a good practice. It can make the codebase more maintainable by centralizing component imports.


18-18: Verify layout after Wrapper component change

The Wrapper component has been simplified from a Flex component to a div. This change looks good as it reduces complexity. However, please ensure that the layout and positioning of child elements are still correct after this change.

To verify the layout, please check the following:

  1. The logo is centered on the page.
  2. The loading indicator is properly positioned relative to the logo.
  3. The overall layout matches the design specifications.

22-22: Verify new icon display

The icon name has been updated from "logo" to "reearthLogo". This change is likely an improvement in specificity. However, please ensure that:

  1. The "reearthLogo" icon exists in the icon library.
  2. The new icon is displayed correctly and matches the design requirements.
web/src/beta/lib/reearth-ui/components/Slide/index.tsx (2)

1-8: LGTM: Imports and type definition are well-structured.

The imports are appropriate for a React component, and the SlideProps type is well-defined with clear, optional properties. This provides a good foundation for the component.


24-28: LGTM: Wrapper styled component is appropriately defined.

The Wrapper component is well-styled to occupy the full width and height of its container while hiding any overflow. This is suitable for a container component in a sliding interface.

web/src/beta/features/NotFound/index.tsx (3)

1-7: LGTM: Imports and component declaration are well-structured.

The imports are concise and relevant to the component's functionality. The use of named imports helps with code readability. The component declaration as a functional component follows React best practices.


40-54: LGTM: Styled components are well-defined and use theme properties consistently.

The Wrapper and EmptyContent styled components are appropriately structured for a 404 page layout. They make good use of theme properties, ensuring consistency with the overall design system.


1-54: Overall assessment: Well-implemented NotFound component.

This new NotFound component is well-structured, follows React best practices, and aligns with the PR objectives. It effectively implements a 404 error page with appropriate styling and functionality. The use of hooks, styled components, and translations is commendable.

A few minor suggestions have been made for optimization and accessibility improvements, but these are not critical issues. The component is ready for integration into the project.

web/src/beta/lib/reearth-ui/components/Slider/index.tsx (1)

14-14: LGTM! Verify import statements in other files.

The update to use 'SliderProps' and the change to a named export improve consistency and align with modern JavaScript/TypeScript best practices.

Please ensure that all files importing this component have been updated to use the new named import syntax. Run the following script to check for any remaining default imports of the Slider component:

If the script returns any results, those files will need to be updated to use the new named import syntax:

import { Slider } from '@reearth/beta/lib/reearth-ui/components/Slider';
✅ Verification successful

Verified! No default imports of the Slider component are present in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for default imports of the Slider component

# Test: Search for default imports of Slider. Expect: No results.
rg --type typescript --type typescriptreact 'import Slider from .*components/Slider'

Length of output: 121


Script:

#!/bin/bash
# Description: Check for default imports of the Slider component

# Test: Search for default imports of Slider. Expect: No results.
rg --glob '*.ts' --glob '*.tsx' 'import Slider from .*components/Slider'

Length of output: 74

web/src/beta/lib/reearth-ui/components/Markdown/index.tsx (2)

8-8: LGTM: Improved type naming

The renaming of Props to MarkdownProps enhances the clarity and specificity of the component's prop types. This change aligns with React best practices for naming conventions.


Line range hint 1-124: Summary: Improved type naming and component signature

The changes in this file are minimal yet effective:

  1. Renaming Props to MarkdownProps for better type clarity.
  2. Updating the component signature to use the new MarkdownProps type.

These changes enhance code readability and maintain type safety without altering the component's functionality. The rest of the implementation, including the use of ReactMarkdown, styling, and helper functions, remains unchanged and appears to follow React best practices.

To ensure these changes don't introduce any regressions, please run the following verification script:

This script will help verify that:

  1. The Markdown component is still being imported and used correctly in other parts of the codebase.
  2. There are no remaining references to the old Props type in the Markdown component directory.
web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx (1)

1-1: Verify Button component API and styling after import change.

The import path for the Button component has been updated from @reearth/beta/components/Button to @reearth/beta/ui/widgetui/Button. This change looks good, but it's important to ensure that:

  1. The new Button component maintains the same API as the previous one.
  2. The styling of the Button component is consistent with its usage in the StyledButton styled component.

To verify the impact of this change across the codebase, you can run the following script:

This script will help identify any other files that might need updating and verify that the new Button component's API matches its usage in this file.

✅ Verification successful

Button component import successfully updated.

No remaining imports from @reearth/beta/components/Button found.
The new Button component import from @reearth/beta/ui/widgetui/Button is consistent with its usage in Content.tsx.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any other usages of the old Button import and verify the new Button component's API

# Test 1: Search for any remaining old Button imports
echo "Searching for old Button imports:"
rg --type typescript --type tsx "from ['\"]@reearth/beta/components/Button['\"]"

# Test 2: Compare the new Button component's props with its usage in this file
echo "Checking Button component props:"
ast-grep --lang typescript --pattern 'interface $interface_name { $$$props }' --file $(fd -e ts -e tsx -p '**/widgetui/Button.{ts,tsx}')

echo "Button usage in current file:"
ast-grep --lang typescript --pattern 'StyledButton $$$props' web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx

Length of output: 1126


Script:

#!/bin/bash
# Description: Corrected script to check for any other usages of the old Button import and verify the new Button component's API

# Test 1: Search for any remaining old Button imports
echo "Searching for old Button imports:"
rg "from ['\"]@reearth/beta/components/Button['\"]" --type-add 'typescript:*.ts' --type-add 'tsx:*.tsx' -t ts -t tsx

# Test 2: Compare the new Button component's props with its usage in this file
echo "Checking Button component props:"
# Find the Button component files
button_files=$(fd --type f --extension ts --extension tsx 'widgetui/Button\.(ts|tsx)$')

# Extract interface definitions from Button component
for file in $button_files; do
  ast-grep --lang typescript --pattern 'interface $_ { $$$ }' "$file"
done

echo "Button usage in current file:"
ast-grep --lang typescript --pattern 'StyledButton($_)' web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx

Length of output: 573

web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Layer/Content.tsx (1)

1-1: Approve import change with verification suggestion.

The import statement for the Button component has been updated to reflect a new directory structure. This change appears to be part of a larger refactoring effort to improve the project's organization.

To ensure this change doesn't introduce any issues, please verify:

  1. The new Button component from @reearth/beta/ui/widgetui/Button has the same API and behavior as the old one.
  2. This change is consistent across the entire project.

You can use the following script to check for any remaining old imports:

If the script returns any results, those files may need to be updated as well.

web/src/beta/features/Visualizer/Crust/Widgets/WidgetAlignSystem/MobileZone.tsx (1)

1-2: Verify the correctness of the updated import paths

The import paths for Slide and Icon components have been modified. While this change likely reflects a project restructuring or component source update, it's crucial to ensure:

  1. The new paths are correct and the components are available at these locations.
  2. The imported components still provide the same functionality as before.
  3. Other files in the project that may be importing these components have been updated accordingly.

To confirm the correctness of these changes, please run the following script:

This script will help identify if the new import paths exist in other files and if there are any remaining instances of the old import paths that need to be updated.

✅ Verification successful

Import paths have been successfully updated across the codebase.

All instances of the old import paths @reearth/beta/components/Slide and @reearth/beta/components/Icon have been removed and replaced with the new paths @reearth/beta/lib/reearth-ui and @reearth/beta/ui/widgetui/Icon respectively.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the existence of the new import paths and check for any remaining old import paths

# Check for the new import paths
echo "Checking for new import paths:"
rg --type typescript 'from "@reearth/beta/lib/reearth-ui"'
rg --type typescript 'from "@reearth/beta/ui/widgetui/Icon"'

echo "\nChecking for any remaining old import paths:"
rg --type typescript 'from "@reearth/beta/components/Slide"'
rg --type typescript 'from "@reearth/beta/components/Icon"'

Length of output: 562


Script:

#!/bin/bash
# Verify the existence of the new import paths and check for any remaining old import paths

# Check for the new import paths
echo "Checking for new import paths in .ts and .tsx files:"
rg --type ts 'from "@reearth/beta/lib/reearth-ui"'
rg --type ts 'from "@reearth/beta/ui/widgetui/Icon"'
rg --type tsx 'from "@reearth/beta/lib/reearth-ui"'
rg --type tsx 'from "@reearth/beta/ui/widgetui/Icon"'

echo "\nChecking for any remaining old import paths in .ts and .tsx files:"
rg --type ts 'from "@reearth/beta/components/Slide"'
rg --type ts 'from "@reearth/beta/components/Icon"'
rg --type tsx 'from "@reearth/beta/components/Slide"'
rg --type tsx 'from "@reearth/beta/components/Icon"'

Length of output: 18336


Script:

#!/bin/bash
# Verify the existence of the new import paths and check for any remaining old import paths

# Check for the new import paths in .ts and .tsx files
echo "Checking for new import paths in .ts and .tsx files:"
rg --glob '*.ts' 'from "@reearth/beta/lib/reearth-ui"'
rg --glob '*.ts' 'from "@reearth/beta/ui/widgetui/Icon"'
rg --glob '*.tsx' 'from "@reearth/beta/lib/reearth-ui"'
rg --glob '*.tsx' 'from "@reearth/beta/ui/widgetui/Icon"'

echo "\nChecking for any remaining old import paths in .ts and .tsx files:"
rg --glob '*.ts' 'from "@reearth/beta/components/Slide"'
rg --glob '*.ts' 'from "@reearth/beta/components/Icon"'
rg --glob '*.tsx' 'from "@reearth/beta/components/Slide"'
rg --glob '*.tsx' 'from "@reearth/beta/components/Icon"'

Length of output: 18256

web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx (2)

Line range hint 1-236: Confirm no impact on existing code.

I've reviewed the entire file, and it appears that the change in the Icon import statement does not affect the rest of the code. The Icon component is used consistently throughout the file with the same props and behavior as before. This suggests that only the location of the Icon component has changed, not its interface or functionality.


1-1: LGTM! Verify the new import path across the project.

The import statement for the Icon component has been updated to reflect a change in the project structure. This change looks good and aligns with what seems to be a reorganization of UI components.

To ensure consistency across the project, please run the following script to verify that all imports of the Icon component have been updated correctly:

If the first command returns any results, those files may need to be updated. The second command should show the updated imports, including this file.

✅ Verification successful

Import statement updated correctly across all files.

All import statements for the Icon component have been successfully updated to the new path without any remnants of the old imports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all imports of the Icon component

# Test: Search for old import statements
echo "Checking for old import statements:"
rg --type typescript --type typescriptreact 'from\s+["\']@reearth/beta/components/Icon["\']'

# Test: Verify new import statements
echo "Verifying new import statements:"
rg --type typescript --type typescriptreact 'from\s+["\']@reearth/beta/ui/widgetui/Icon["\']'

Length of output: 175


Script:

#!/bin/bash
# Description: Verify all imports of the Icon component

# Test: Search for old import statements
echo "Checking for old import statements:"
rg --type typescript --type typescriptreact 'from\s+["'"'"']@reearth/beta/components/Icon["'"'"']'

# Test: Verify new import statements
echo "Verifying new import statements:"
rg --type typescript --type typescriptreact 'from\s+["'"'"']@reearth/beta/ui/widgetui/Icon["'"'"']'

Length of output: 424


Script:

#!/bin/bash
# Description: Verify all imports of the Icon component

# Test: Search for old import statements
echo "Checking for old import statements:"
rg -g "*.ts" -g "*.tsx" 'from\s+["'"'"']@reearth/beta/components/Icon["'"'"']'

# Test: Verify new import statements
echo "Verifying new import statements:"
rg -g "*.ts" -g "*.tsx" 'from\s+["'"'"']@reearth/beta/ui/widgetui/Icon["'"'"']'

Length of output: 1079

web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Timeline/UI/index.tsx (3)

Line range hint 71-71: Usage of imported components is consistent with new paths.

I've verified that the usage of Icon and Text components throughout the file remains unchanged and is consistent with the new import paths. The components are used correctly in the following lines:

  • Icon: 71, 80, 85, 184
  • Text: 224, 270

This confirms that the import path changes have not affected the functionality of the Timeline component.

Also applies to: 80-80, 85-85, 184-184, 224-224, 270-270


Line range hint 1-279: Summary: Import path updates with no functional changes.

This review has covered the changes made to the Timeline component file. The main modifications are:

  1. Updated import paths for Icon and Text components.
  2. No changes to the actual implementation of the Timeline component.

These changes appear to be part of a larger refactoring effort to better organize UI components. The new import paths are consistently used throughout the file, and there are no apparent functional changes or regressions introduced by these updates.

To ensure project-wide consistency, it's recommended to verify that all other files using these components have been updated similarly.


1-2: LGTM! Verify new import paths across the project.

The import statements for Icon and Text components have been updated to use the new @reearth/beta/ui/widgetui path. This change appears to be part of a larger refactoring effort to better organize UI components.

To ensure consistency across the project, please run the following script to check if there are any remaining imports using the old paths:

If the script returns any results, consider updating those imports as well for consistency.

✅ Verification successful

Verified! No remaining old import paths found.

All instances of the old import paths for Icon and Text components have been successfully updated to @reearth/beta/ui/widgetui. The codebase is consistent with the new import structure.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old import paths for Icon and Text components

# Search for old Icon import
echo "Checking for old Icon imports:"
rg --type typescript --type typescriptreact 'from\s+["'\'']@reearth/beta/components/Icon["'\'']'

# Search for old Text import
echo "Checking for old Text imports:"
rg --type typescript --type typescriptreact 'from\s+["'\'']@reearth/beta/components/Text["'\'']'

Length of output: 409


Script:

#!/bin/bash
# Description: Check for any remaining old import paths for Icon and Text components by searching .ts and .tsx files

# Search for old Icon import
echo "Checking for old Icon imports:"
fd --extension ts,tsx --type file --exec rg 'from\s+["'"'"']@reearth/beta/components/Icon["'"'"']' {} +

# Search for old Text import
echo "Checking for old Text imports:"
fd --extension ts,tsx --type file --exec rg 'from\s+["'"'"']@reearth/beta/components/Text["'"'"']' {} +

Length of output: 353


Script:

#!/bin/bash
# Description: Use ast-grep to check for any remaining old import paths for Icon and Text components

# Search for old Icon import
echo "Checking for old Icon imports:"
ast-grep --lang typescript --pattern 'import Icon from "@reearth/beta/components/Icon";'

# Search for old Text import
echo "Checking for old Text imports:"
ast-grep --lang typescript --pattern 'import Text from "@reearth/beta/components/Text";'

Length of output: 323

web/src/services/i18n/translations/en.yml (1)

Line range hint 1-205: Verify if any translations should be removed

The PR objectives mention removing unused components. While this translation file shows new additions for the "Not Found" page, it doesn't reflect any removals. It might be worth verifying if there are any translations associated with the removed components that should also be deleted to keep the translation file clean and up-to-date.

To help with this verification, you can run the following script to search for potentially unused translations:

This script will help identify translation keys that are not referenced in the TypeScript, JavaScript, or JSX files of your project. Please review the results and remove any confirmed unused translations.

web/src/beta/lib/reearth-ui/components/Icon/icons.ts (2)

105-106: LGTM: New icon imports added correctly.

The new imports for ReearthLogo and ReearthLogoColorful are consistent with the existing import pattern and naming conventions.


250-251: LGTM: New icon exports added correctly.

The new exports for reearthLogo and reearthLogoColorful are consistent with the existing export pattern and naming conventions.

web/src/services/i18n/translations/en.yml Show resolved Hide resolved
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 (2)
web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (2)

Line range hint 151-162: LGTM: Typography component usage

The replacement of the Text component with Typography is a good improvement, likely providing more consistent text rendering across the application. The properties passed to Typography maintain the previous styling intentions.

Consider using theme-based values for the size prop (e.g., theme.typography.sizes.body instead of "body") if available, to ensure consistency with the overall design system.

Also applies to: 183-191


201-281: LGTM: Styled components refactoring

The refactoring of styled components from template literals to a functional approach is a significant improvement. This change enhances type safety and allows for more flexible, prop-based styling. The styling logic has been preserved while making some minor adjustments to improve consistency.

Consider extracting common style values (like border radius and padding) into theme variables if they're not already, to ensure consistency across components and ease future maintenance.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e9cc5e4 and ee2aae1.

⛔ Files ignored due to path filters (17)
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/ArrowLongLeft.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/ArrowLongRight.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/Compass.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/CompassFocus.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/DownloadSimple.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/Ellipse.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/Home.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/NavigatorAngle.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/Pallete.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/Pause.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/PlayLeft.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/PlayLeftFilled.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/PlayRight.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/PlayRightFilled.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/SignIn.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/Timeline.svg is excluded by !**/*.svg
  • web/src/beta/ui/assets/defaultBetaProjectImage.png is excluded by !**/*.png
📒 Files selected for processing (12)
  • web/src/beta/features/ProjectSettings/innerPages/GeneralSettings/index.tsx (1 hunks)
  • web/src/beta/features/ProjectSettings/innerPages/PublicSettings/PublicSettingsDetail.tsx (1 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Camera/Content.tsx (2 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Layer/Content.tsx (2 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx (2 hunks)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Timeline/Editor.tsx (7 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (6 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx (3 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Timeline/UI/index.tsx (4 hunks)
  • web/src/beta/features/Visualizer/Crust/Widgets/WidgetAlignSystem/MobileZone.tsx (1 hunks)
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts (14 hunks)
  • web/src/beta/ui/widgetui/Button/index.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Camera/Content.tsx
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Layer/Content.tsx
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Link/Content.tsx
  • web/src/beta/features/Visualizer/Crust/StoryPanel/Block/builtin/Timeline/Editor.tsx
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Timeline/UI/index.tsx
  • web/src/beta/features/Visualizer/Crust/Widgets/WidgetAlignSystem/MobileZone.tsx
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts
  • web/src/beta/ui/widgetui/Button/index.tsx
🧰 Additional context used
🔇 Additional comments (6)
web/src/beta/features/ProjectSettings/innerPages/GeneralSettings/index.tsx (1)

10-10: LGTM: Asset import path updated.

The import path for defaultBetaProjectImage has been updated, which appears to be part of a project-wide asset reorganization.

To ensure the new asset path is correct and consistent across the project, please run the following script:

✅ Verification successful

Please run the updated verification script to ensure the asset path changes are correct and no old paths remain:


Verified: Asset import path correctly updated.

The new asset path @reearth/beta/ui/assets/defaultBetaProjectImage.png exists and is consistently used in the relevant files.

  • web/src/beta/features/ProjectSettings/innerPages/PublicSettings/PublicSettingsDetail.tsx
  • web/src/beta/features/ProjectSettings/innerPages/GeneralSettings/index.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new asset path and check for any remaining old paths

# Test 1: Check if the new asset exists
fd --type file --full-path "beta/ui/assets/defaultBetaProjectImage.png"

# Test 2: Check for any remaining old asset paths
rg --type typescript --type javascript "beta/components/Icon/Icons/defaultBetaProjectImage.png"

# Test 3: Check for other usages of the new asset path
rg --type typescript --type javascript "beta/ui/assets/defaultBetaProjectImage.png"

Length of output: 372


Script:

#!/bin/bash
# Description: Verify the new asset path and check for any remaining old paths

# Test 1: Check if the new asset exists
fd --type file --full-path "beta/ui/assets/defaultBetaProjectImage.png"

# Test 2: Check for any remaining old asset paths
rg --type ts --type js "beta/components/Icon/Icons/defaultBetaProjectImage.png"

# Test 3: Check for other usages of the new asset path
rg --type ts --type js "beta/ui/assets/defaultBetaProjectImage.png"

Length of output: 616

web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Button/MenuButton.tsx (3)

1-1: LGTM: Import and type definition updates

The changes to the import statement and the MenuItem type definition are appropriate. Using IconName for menuIcon improves type safety and consistency with the icon system.

Also applies to: 26-26


Line range hint 42-200: LGTM: Preserved component logic

It's commendable that the core functionality of the MenuButton component, including click handling and menu visibility management, has been preserved during this refactoring. This approach ensures that the component's behavior remains consistent while improving its structure and styling.


Line range hint 1-281: Overall LGTM: Successful refactoring of MenuButton component

This refactoring of the MenuButton component is well-executed. The changes focus on improving the component's structure and styling while maintaining its core functionality. Key improvements include:

  1. Standardizing text rendering with the Typography component.
  2. Refactoring styled components for better type safety and flexibility.
  3. Preserving the component's logic and behavior.

These changes should result in a more maintainable and consistent component that aligns better with the application's overall design system. Great job on this refactoring effort!

web/src/beta/features/ProjectSettings/innerPages/PublicSettings/PublicSettingsDetail.tsx (2)

Line range hint 1-285: Overall impact of the change is minimal.

The only change in this file is the updated import path for defaultBetaProjectImage. This modification doesn't affect the component's functionality or behavior, as the image is still used in the same way within the component. The rest of the PublicSettingsDetail component, including its state management, form fields, and submission handlers, remains unchanged.

To ensure the component continues to function as expected:

  1. Verify that the image loads correctly when localPublicInfo.publicImage is not set.
  2. Test the component to confirm that all settings (Public Info, Basic Authorization, Site Setting, Google Analytics, and Custom Domain) still work as intended.

3-3: Verify the new asset path for defaultBetaProjectImage.

The import path for defaultBetaProjectImage has been updated, which appears to be part of a reorganization of asset files. This change doesn't affect the component's functionality, but it's crucial to ensure that the new path is correct and the image file exists in the new location.

Please run the following script to verify the existence of the image file:

If the script doesn't find the file, please ensure it has been moved to the correct location.

✅ Verification successful

The new asset path for defaultBetaProjectImage has been verified and the file exists in the specified location.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of defaultBetaProjectImage.png in the new location

# Test: Check if the file exists in the new location
fd -t f "defaultBetaProjectImage.png" web/src/beta/ui/assets

Length of output: 111

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 (2)
web/src/beta/lib/reearth-ui/components/Icon/index.tsx (2)

13-13: Excellent addition for accessibility, consider adding JSDoc comment.

The addition of the ariaLabel prop is a great improvement for accessibility. It allows screen readers to provide more context for the icon.

Consider adding a JSDoc comment to explain the purpose of this prop:

/** Accessible label for the icon, used by screen readers */
ariaLabel?: string;

41-46: Correct implementation, consider consistent prop ordering.

The aria-label attribute is correctly added to the SvgIcon component, improving accessibility as intended.

For consistency, consider ordering the props alphabetically:

<SvgIcon
  aria-label={ariaLabel}
  className={className}
  color={color}
  size={size}
/>

This makes it easier to scan and maintain the component props in the future.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ee2aae1 and b14b6ae.

📒 Files selected for processing (2)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx (4 hunks)
  • web/src/beta/lib/reearth-ui/components/Icon/index.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/beta/features/Visualizer/Crust/Widgets/Widget/builtin/Navigator/UI/index.tsx
🧰 Additional context used
🔇 Additional comments (2)
web/src/beta/lib/reearth-ui/components/Icon/index.tsx (2)

20-21: LGTM: Correct implementation of the new prop.

The ariaLabel prop is correctly added to the component's destructured parameters. This change is consistent with the type definition update and maintains the existing prop order.


Line range hint 1-46: Overall: Excellent accessibility improvement

The changes in this file consistently implement the new ariaLabel prop, significantly improving the Icon component's accessibility. The implementation is correct and maintains backward compatibility.

Great job on prioritizing accessibility in your components!

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 (1)
web/src/beta/lib/reearth-ui/components/Icon/icons.ts (1)

165-166: LGTM: New icon exports added consistently

The new icon exports have been added to the default export object, maintaining the existing structure and naming convention. All newly imported icons are properly exported.

Consider using object property value shorthand for a more concise syntax:

export default {
-  arrowLongLeft: ArrowLongLeft,
-  arrowLongRight: ArrowLongRight,
+  arrowLongLeft,
+  arrowLongRight,
  // Apply this change to all new exports
};

This change would make the code slightly more maintainable and consistent with modern JavaScript practices.

Also applies to: 195-196, 211-211, 229-229, 250-250, 257-257, 262-265, 277-278, 306-306

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b14b6ae and 92216dc.

📒 Files selected for processing (1)
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts (14 hunks)
🧰 Additional context used
🔇 Additional comments (3)
web/src/beta/lib/reearth-ui/components/Icon/icons.ts (3)

1-1: LGTM: Proper type reference added for vite-plugin-svgr

The addition of the reference type for "vite-plugin-svgr/client" is correct and necessary for TypeScript to properly recognize the imported SVG files as React components.


6-7: LGTM: New icon imports added consistently

The new SVG icon imports have been added following the existing pattern in the file. These additions appear to be related to navigation, playback controls, and branding, which aligns with the PR objectives of cleaning up components.

Also applies to: 36-37, 52-52, 70-70, 92-92, 99-99, 104-107, 119-120, 147-147


Line range hint 1-320: Summary: New icons added to support UI improvements

The changes in this file involve adding several new SVG icons, which are likely to support new features or improvements in the user interface. The additions are consistent with the existing structure and naming conventions of the file.

These changes align well with the PR objectives of cleaning up components in the beta version. The new icons (such as navigation arrows, playback controls, and branding elements) suggest enhancements to the user experience and functionality of the application.

To ensure these new icons are being utilized in the updated components, you may want to run the following command:

This will help verify that the newly added icons are indeed being used in the refactored components.

@mkumbobeaty mkumbobeaty merged commit dab3db8 into main Oct 16, 2024
15 checks passed
@mkumbobeaty mkumbobeaty deleted the chore/clean-component branch October 16, 2024 11:17
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