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

feat(web): Export & Import Project #1154

Merged
merged 12 commits into from
Oct 1, 2024
Merged

Conversation

m-abe-dev
Copy link
Contributor

@m-abe-dev m-abe-dev commented Sep 25, 2024

Overview

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 project import functionality, allowing users to upload projects directly through a new "Import" button.
    • Added a file input for seamless project import, enhancing user experience.
    • Implemented project export functionality, enabling users to download project data as a .zip file.
    • Updated the menu to include an "Export" option for easy access to project export.
  • Bug Fixes

    • Removed the export modal functionality to streamline the project interaction process.
  • Localization Updates

    • Expanded translation support for project import and export messages in both English and Japanese, enhancing user feedback during these operations.

These updates significantly enhance project management capabilities within the application.

Copy link

coderabbitai bot commented Sep 25, 2024

Walkthrough

The changes introduce functionalities for importing and exporting projects within the dashboard's project management system. This includes the addition of hooks for managing the import and export processes, modifications to the UI for file input, and enhancements to the API for handling project data. The updates span multiple files, improving both user interaction and the underlying logic for project management.

Changes

File Change Summary
web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts Added useImportProject and useExportProject hooks, modified useProjectsQuery to include a refetch method, and introduced handleImportProject and handleExportProject functions.
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx Implemented file input functionality for importing projects, linked to the UI, and modified action buttons to include an "Import" button.
web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx Removed export modal functionality, including related state and functions, simplifying the component structure.
web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx Commented out the export modal, maintaining project display functionality while adjusting the JSX layout for clarity.
web/src/services/api/projectApi.ts Introduced useExportProject and useImportProject hooks to manage exporting and importing projects via GraphQL mutations, including error handling and notifications.
web/src/services/i18n/translations/en.yml Added new translation keys related to project import and export functionalities to enhance localization support.
web/src/services/i18n/translations/ja.yml Added and updated translations for project import and export functionalities, improving localization for Japanese users.
web/src/beta/lib/reearth-ui/components/Icon/icons.ts Added new SVG icons for download and sign-in, removing the alphabetical sorting icon from the exported object.

Possibly related PRs

  • feat(web): update @reearth/core #1145: This PR updates the @reearth/core package, but it does not directly relate to the changes made in the main PR regarding the import/export functionality and hooks in the Projects component.

Suggested reviewers

  • mkumbobeaty
  • airslice

Poem

In the meadow where projects play,
New hooks and buttons brighten the day.
With imports and exports, we dance with glee,
Managing projects as easy as can be!
Hop to it, dear friends, let's celebrate right,
For our dashboard shines with new features so bright! 🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7a75335 and 29d73eb.

⛔ Files ignored due to path filters (4)
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/DownloadSimple.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/SignIn.svg is excluded by !**/*.svg
  • web/src/services/gql/__gen__/gql.ts is excluded by !**/__gen__/**
  • web/src/services/gql/__gen__/graphql.ts is excluded by !**/__gen__/**
📒 Files selected for processing (10)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx (3 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx (3 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/hooks.ts (5 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (4 hunks)
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts (5 hunks)
  • web/src/services/api/projectApi.ts (3 hunks)
  • web/src/services/gql/queries/project.ts (1 hunks)
  • web/src/services/i18n/translations/en.yml (3 hunks)
  • web/src/services/i18n/translations/ja.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/hooks.ts
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts
  • web/src/services/api/projectApi.ts
  • web/src/services/gql/queries/project.ts
  • web/src/services/i18n/translations/en.yml
  • web/src/services/i18n/translations/ja.yml

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

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the web label Sep 25, 2024
Copy link

netlify bot commented Sep 25, 2024

Deploy Preview for reearth-web ready!

Name Link
🔨 Latest commit 29d73eb
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/66fbb3b56bcd4200084c7aa8
😎 Deploy Preview https://deploy-preview-1154--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.

@github-actions github-actions bot requested a review from pyshx September 25, 2024 12:33
@m-abe-dev m-abe-dev changed the title [WIP]feature: Export & Import Project [WIP]feat(web): Export & Import Project Sep 25, 2024
@m-abe-dev m-abe-dev marked this pull request as draft September 25, 2024 19:46
@m-abe-dev m-abe-dev changed the title [WIP]feat(web): Export & Import Project feat(web): Export & Import Project Sep 25, 2024
@m-abe-dev m-abe-dev marked this pull request as ready for review September 26, 2024 09:28
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: 16

🧹 Outside diff range and nitpick comments (10)
web/src/services/gql/queries/project.ts (1)

219-225: LGTM: IMPORT_PROJECT mutation is well-implemented

The IMPORT_PROJECT mutation is correctly implemented. It uses the Upload scalar for file input and returns projectData, which aligns with the expected functionality for importing a project.

For consistency with the EXPORT_PROJECT mutation, consider wrapping the input in an object:

- mutation ImportProject($file: Upload!) {
-   importProject(input: { file: $file }) {
+ mutation ImportProject($input: ImportProjectInput!) {
+   importProject(input: $input) {
      projectData
    }
  }

This change would make the mutation more extensible if additional input fields are needed in the future.

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

26-26: Add the actual translation for "Import".

The new translation key "Import" has been added correctly. However, the translation string is empty. Consider adding the actual English translation, which in this case would likely be "Import" as well.

-Import: ''
+Import: 'Import'

27-27: Add the actual translation for "Export".

The new translation key "Export" has been added correctly. However, the translation string is empty. Consider adding the actual English translation, which in this case would likely be "Export" as well.

-Export: ''
+Export: 'Export'

347-347: Add the actual translation for "Failed to export project."

The new translation key "Failed to export project." has been added correctly. However, the translation string is empty. Consider adding the actual English translation.

-Failed to export project.: ''
+Failed to export project.: 'Failed to export project.'

348-348: Add the actual translation and ensure consistency in punctuation.

The new translation key "Successfully exported project!" has been added. However, consider the following points:

  1. The translation string is empty. Add the actual English translation.
  2. The use of an exclamation mark in the key is inconsistent with other similar keys in the file (e.g., "Successfully added one or more assets."). Consider removing it for consistency.
-Successfully exported project!: ''
+Successfully exported project.: 'Successfully exported project.'

349-349: Add the actual translation for "Failed to import project."

The new translation key "Failed to import project." has been added correctly. However, the translation string is empty. Consider adding the actual English translation.

-Failed to import project.: ''
+Failed to import project.: 'Failed to import project.'

350-350: Add the actual translation and ensure consistency in punctuation.

The new translation key "Successfully imported project!" has been added. However, consider the following points:

  1. The translation string is empty. Add the actual English translation.
  2. The use of an exclamation mark in the key is inconsistent with other similar keys in the file (e.g., "Successfully added one or more assets."). Consider removing it for consistency.
-Successfully imported project!: ''
+Successfully imported project.: 'Successfully imported project.'

Line range hint 26-351: Consider improving overall file structure and consistency.

While the new translation keys have been added successfully, there are a few general improvements that could enhance the maintainability and consistency of the file:

  1. Grouping: The new entries are added at the end of the file. Consider grouping related translations together for better organization and easier maintenance.

  2. Punctuation Consistency: There's inconsistent use of punctuation in the keys (e.g., some end with periods, others don't). Establish a consistent rule for punctuation in translation keys.

  3. Empty Values: All new entries have empty string values. While this is valid YAML, it's recommended to add the actual translations to avoid potential issues in the application.

  4. Duplicate Keys: Be cautious of potentially duplicate keys with slight variations (e.g., "Export" and "Export Project"). Ensure each key serves a unique purpose.

Consider implementing a more structured approach to organizing translations, such as grouping by feature or page, to improve maintainability as the project grows.

web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx (1)

47-63: Consider simplifying by removing useMemo

The actions component is relatively simple and may not require memoization with useMemo. Removing it could simplify the code without significant performance impact.

web/src/services/api/projectApi.ts (1)

451-458: Consider redirecting after successful import

After successfully importing a project, enhancing the user experience by redirecting them to the newly imported project or refreshing the project list can provide immediate feedback and access to the imported content.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d428b46 and fee1137.

⛔ Files ignored due to path filters (4)
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/DownloadSimple.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/SignIn.svg is excluded by !**/*.svg
  • web/src/services/gql/__gen__/gql.ts is excluded by !**/__gen__/**
  • web/src/services/gql/__gen__/graphql.ts is excluded by !**/__gen__/**
📒 Files selected for processing (10)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/hooks.ts (5 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (4 hunks)
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts (3 hunks)
  • web/src/services/api/projectApi.ts (3 hunks)
  • web/src/services/gql/queries/project.ts (1 hunks)
  • web/src/services/i18n/translations/en.yml (2 hunks)
  • web/src/services/i18n/translations/ja.yml (2 hunks)
🧰 Additional context used
🪛 Biome
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx

[error] 83-88: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

🔇 Additional comments (30)
web/src/services/gql/queries/project.ts (2)

211-217: LGTM: EXPORT_PROJECT mutation is well-defined

The EXPORT_PROJECT mutation is correctly implemented. It takes a projectId as input and returns projectData, which aligns with the expected functionality for exporting a project.


210-225: Summary: Export and Import mutations successfully added

The EXPORT_PROJECT and IMPORT_PROJECT mutations have been successfully added to the file. These additions:

  1. Align with the PR objectives of implementing project export and import functionality.
  2. Follow consistent naming conventions and code style with existing mutations.
  3. Are placed logically at the end of the file, maintaining good code organization.

The implementation looks solid and ready for integration with the rest of the system.

web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (3)

12-12: LGTM: Import statements and hook usage updated correctly.

The changes to the import statements and hook usage are consistent with the new import functionality. The addition of useRef and handleImportProject are appropriate for implementing the file input and handling the import process.

Also applies to: 43-43


59-60: LGTM: File input reference added correctly.

The useRef hook is appropriately used to create a reference for the hidden file input. This is a standard approach for programmatically triggering file selection dialogs in React applications.


310-312: LGTM: HiddenFileInput styled component added correctly.

The HiddenFileInput styled component is well-implemented. It effectively hides the file input visually while maintaining its functionality and accessibility. This is a good practice for creating custom-styled file inputs.

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

43-43: LGTM: DownloadSimple icon import added correctly.

The import for the DownloadSimple icon is correctly added and maintains consistency with the existing import pattern. The alphabetical order of imports is also preserved.


110-110: LGTM: SignIn icon import added correctly.

The import for the SignIn icon is correctly added and maintains consistency with the existing import pattern. The alphabetical order of imports is also preserved.

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

26-27: Translations for Import and Export look good!

The Japanese translations for "Import" (インポート) and "Export" (エクスポート) are correct and consistent with standard UI terminology in Japanese.


34-35: Updated translations for Rename and Project Setting are appropriate.

The Japanese translations for "Rename" (名称変更) and "Project Setting" (プロジェクト設定) are correct and more natural than the previous empty strings. These translations accurately convey the meaning of the original English terms.


347-348: Project export message translations are accurate.

The Japanese translations for the project export failure and success messages are correct and maintain proper Japanese grammar and punctuation. They effectively convey the intended meaning to the user.


349-350: Project import message translations are correct and consistent.

The Japanese translations for the project import failure and success messages are accurate and maintain consistency with the export messages. They use proper Japanese grammar and effectively communicate the outcome of the import process to the user.


351-351: Translation for "Export Project" is appropriate and consistent.

The Japanese translation for "Export Project" (プロジェクトのエクスポート) is correct and maintains consistency with the previously added "Export" translation. It accurately conveys the meaning of the English term in a natural Japanese phrase.


Line range hint 26-351: Overall, the Japanese translations are well-implemented and consistent.

The new and updated translations in this file accurately convey the meaning of the English terms and are consistent with Japanese UI conventions. The additions for project export and import functionalities are particularly well-implemented, maintaining grammatical correctness and natural phrasing in Japanese. These changes will effectively support the new features for Japanese-speaking users.

web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/hooks.ts (6)

3-6: Importing useProjectFetcher correctly

The import statement correctly adds useProjectFetcher from @reearth/services/api.


35-35: State variable exportModalVisible initialized

The state variable exportModalVisible is correctly initialized using useState(false).


57-63: Modal handlers are correctly implemented

The functions openExportModal and closeExportModal are properly defined using useCallback to manage the modal's visibility state.


95-100: Export option added to the popup menu

The export option is correctly added to the popup menu with the appropriate title and icon.


158-161: New properties added to the return object

The properties exportModalVisible, closeExportModal, and handleExportProject are correctly added to the return statement of the hook.


28-28: Verify the usage of useExportProject

Ensure that useExportProject is correctly initialized. It's destructured from useProjectFetcher(), and later used as an async function. Verify that useExportProject returns the necessary function for exporting the project.

To confirm its usage and definition, run the following script:

✅ Verification successful

Verified: useExportProject is correctly initialized and used as an async function.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the definition and usage of `useExportProject`.

# Test: Find the export statement of `useExportProject`.
rg --type=typescript 'export function useExportProject' src/

# Test: Find where `useExportProject` is imported and used.
rg --type=typescript 'useExportProject' src/

Length of output: 177


Script:

#!/bin/bash
# Description: Check the definition and usage of `useExportProject`.

# Test: Find the export statement of `useExportProject`.
rg --type=ts 'export function useExportProject' src/

# Test: Find where `useExportProject` is imported and used.
rg --type=ts 'useExportProject' src/

Length of output: 181


Script:

#!/bin/bash
# Description: Check the definition and usage of `useExportProject` within the correct directory.

# Test: Find the export statement of `useExportProject` in web/src/.
rg --type=ts 'export function useExportProject' web/src/

# Test: Find where `useExportProject` is imported and used in web/src/.
rg --type=ts 'useExportProject' web/src/

Length of output: 622

web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx (4)

1-7: Imports are correctly updated

The imports of Modal and ModalPanel from "@reearth/beta/lib/reearth-ui" are necessary for the new export modal functionality.


10-10: useMemo import is appropriate

Importing useMemo from "react" is appropriate as it's used for memoizing the actions component.


22-22: Translation hook useT is correctly utilized

Using the useT hook for internationalization ensures that modal texts are properly translated.


36-39: Destructured hooks are properly expanded

The additional hooks exportModalVisible, closeExportModal, and handleExportProject are appropriately destructured from useHooks.

web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx (4)

5-7: Importing necessary UI components

The addition of Typography, Modal, and ModalPanel imports is appropriate for implementing the export modal functionality.


10-10: Utilizing internationalization with useT hook

Importing useT from @reearth/services/i18n enhances internationalization support by enabling translation of text strings within the component.


24-24: Initializing the translation function

Initializing the translation function t with const t = useT(); correctly sets up internationalization for this component.


49-52: Destructuring additional handlers from useHooks

The destructuring of exportModalVisible, closeExportModal, and handleExportProject from useHooks integrates the export modal's state and handlers into the component effectively.

web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts (3)

41-42: Import new hooks correctly

The addition of useStarredProjectsQuery and useImportProject from useProjectFetcher is appropriate and aligns with their usage in the code.


60-61: Include fetchMore and refetch for data management

Adding fetchMore and refetch to the destructured return from useProjectsQuery ensures you can manage project data effectively, especially after importing a new project.


280-281: Verify integration of handleImportProject

Ensure that handleImportProject is correctly connected to the file input element and that the file input accepts the appropriate file types for project import. This verification will prevent potential issues during the import process.

web/src/services/i18n/translations/en.yml Outdated Show resolved Hide resolved
web/src/beta/lib/reearth-ui/components/Icon/icons.ts Outdated Show resolved Hide resolved
web/src/services/api/projectApi.ts Outdated Show resolved Hide resolved
web/src/services/api/projectApi.ts Outdated Show resolved Hide resolved
web/src/services/api/projectApi.ts Outdated Show resolved Hide resolved
@m-abe-dev m-abe-dev force-pushed the update/uiux_for_import_and_export branch from fee1137 to caf5c45 Compare September 26, 2024 18:48
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 (1)
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (1)

Line range hint 1-312: Overall assessment: Import functionality well-implemented with minor improvement needed.

The changes to implement the import functionality are generally well-done. The file input ref, hidden input, and new action button are correctly implemented. The only improvement needed is adding a key prop to the fragment containing the action buttons.

Consider enhancing the user experience by adding loading states and error handling for the import process in the handleImportProject function, which is likely implemented in the useHooks custom hook.

🧰 Tools
🪛 Biome

[error] 83-88: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between fee1137 and caf5c45.

⛔ Files ignored due to path filters (4)
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/DownloadSimple.svg is excluded by !**/*.svg
  • web/src/beta/lib/reearth-ui/components/Icon/Icons/SignIn.svg is excluded by !**/*.svg
  • web/src/services/gql/__gen__/gql.ts is excluded by !**/__gen__/**
  • web/src/services/gql/__gen__/graphql.ts is excluded by !**/__gen__/**
📒 Files selected for processing (10)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/hooks.ts (5 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (4 hunks)
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts (3 hunks)
  • web/src/services/api/projectApi.ts (3 hunks)
  • web/src/services/gql/queries/project.ts (1 hunks)
  • web/src/services/i18n/translations/en.yml (2 hunks)
  • web/src/services/i18n/translations/ja.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectGridViewItem.tsx
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/ProjectListViewItem.tsx
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/Project/hooks.ts
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts
  • web/src/beta/lib/reearth-ui/components/Icon/icons.ts
  • web/src/services/api/projectApi.ts
  • web/src/services/gql/queries/project.ts
  • web/src/services/i18n/translations/en.yml
  • web/src/services/i18n/translations/ja.yml
🧰 Additional context used
🪛 Biome
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx

[error] 83-88: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

🔇 Additional comments (3)
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (3)

12-12: LGTM: Import statements and hook destructuring updated correctly.

The changes to import useRef and include handleImportProject in the hook destructuring are appropriate for implementing the new import functionality.

Also applies to: 43-43


59-60: LGTM: File input ref correctly initialized.

The useRef hook is properly used to create a reference for the file input element, which will be used to trigger the file selection dialog programmatically.


309-312: LGTM: HiddenFileInput styled component correctly implemented.

The HiddenFileInput styled component is properly defined to hide the file input visually while maintaining its functionality. This is a good practice for creating custom-styled file inputs.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between caf5c45 and e0a1d00.

📒 Files selected for processing (3)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts (4 hunks)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (4 hunks)
  • web/src/services/api/projectApi.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • web/src/beta/features/Dashboard/ContentsContainer/Projects/hooks.ts
  • web/src/services/api/projectApi.ts
🧰 Additional context used
🪛 Biome
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx

[error] 83-88: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

🔇 Additional comments (4)
web/src/beta/features/Dashboard/ContentsContainer/Projects/index.tsx (4)

12-12: LGTM: Necessary imports and hook usage for project import functionality.

The addition of useRef and handleImportProject are appropriate for implementing the new project import feature.

Also applies to: 43-43


59-60: LGTM: Proper use of useRef for file input.

The useRef hook is correctly implemented to create a reference for the hidden file input, which will be used to trigger the file selection dialog.


66-89: Add key prop to the fragment containing action buttons.

The implementation of the "Import" button and hidden file input is correct. However, to improve React's rendering efficiency and address the static analysis warning, add a key prop to the fragment or its child elements.

Apply this change to add a key to the fragment:

-          <>
+          <React.Fragment key="action-buttons">
             <ManagerHeaderButton
               key={"create-project"}
               // ... other props
             />
             <ManagerHeaderButton
               key={"import-project"}
               // ... other props
             />
             <HiddenFileInput
               // ... other props
             />
-          </>
+          </React.Fragment>

This change will resolve the static analysis warning and improve React's rendering efficiency.

🧰 Tools
🪛 Biome

[error] 83-88: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)


310-312: LGTM: Proper implementation of hidden file input.

The HiddenFileInput styled component is correctly implemented to visually hide the file input while maintaining its functionality. This is a good practice for creating custom-styled file inputs.

@hexaforce hexaforce self-requested a review September 30, 2024 01:38
@m-abe-dev m-abe-dev force-pushed the update/uiux_for_import_and_export branch from b17e0fa to 90d3506 Compare September 30, 2024 08:34
@m-abe-dev m-abe-dev force-pushed the update/uiux_for_import_and_export branch from 01c1f53 to cdd0221 Compare September 30, 2024 22:24
@airslice airslice merged commit 25f35c5 into main Oct 1, 2024
13 checks passed
@airslice airslice deleted the update/uiux_for_import_and_export branch October 1, 2024 08:36
hexaforce pushed a commit that referenced this pull request Oct 2, 2024
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.

4 participants