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(core): split right sidebar #5971

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Conversation

EYHN
Copy link
Member

@EYHN EYHN commented Feb 29, 2024

CleanShot.2024-03-01.at.11.44.25.mp4

Now each view has a general container, the yellow area is the general container part, and the green part is the routing specific part.

CleanShot 2024-03-01 at 11.47.35@2x.png

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 23.80952% with 112 lines in your changes are missing coverage. Please review.

Project coverage is 62.41%. Comparing base (e2a31ea) to head (c599715).

Files Patch % Lines
packages/frontend/core/src/utils/island.tsx 4.54% 21 Missing ⚠️
.../core/src/modules/right-sidebar/view/container.tsx 16.66% 15 Missing ⚠️
...rc/modules/right-sidebar/entities/right-sidebar.ts 0.00% 12 Missing ⚠️
...ore/src/modules/workbench/view/route-container.tsx 14.28% 12 Missing ⚠️
...e/src/modules/workbench/view/use-view-position.tsx 7.69% 12 Missing ⚠️
...ore/src/modules/right-sidebar/view/view-island.tsx 10.00% 9 Missing ⚠️
...core/src/modules/workbench/view/workbench-root.tsx 0.00% 9 Missing ⚠️
.../src/modules/workbench/view/use-is-active-view.tsx 0.00% 4 Missing ⚠️
...ntend/core/src/modules/workbench/view/use-view.tsx 33.33% 4 Missing ⚠️
...core/src/modules/workbench/view/workbench-link.tsx 0.00% 4 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##           canary    #5971      +/-   ##
==========================================
- Coverage   63.80%   62.41%   -1.39%     
==========================================
  Files         364      438      +74     
  Lines       20044    20908     +864     
  Branches     1700     1832     +132     
==========================================
+ Hits        12789    13050     +261     
- Misses       7038     7636     +598     
- Partials      217      222       +5     
Flag Coverage Δ
server-test 71.04% <ø> (ø)
unittest 41.99% <23.80%> (-1.91%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

nx-cloud bot commented Feb 29, 2024

Copy link
Member Author

EYHN commented Feb 29, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @EYHN and the rest of your teammates on Graphite Graphite

@EYHN EYHN marked this pull request as ready for review March 1, 2024 02:30
@EYHN EYHN force-pushed the eyhn/feat/rightsidebar branch 2 times, most recently from 334c348 to 1c2a887 Compare March 1, 2024 03:23
@EYHN EYHN requested review from CatsJuice and pengx17 March 1, 2024 03:27
@EYHN
Copy link
Member Author

EYHN commented Mar 1, 2024

/review

Copy link

PR Review

⏱️ Estimated effort to review [1-5]

5, because the PR involves significant changes across multiple files, including the introduction of new components, modifications to existing components, and the restructuring of the workbench and sidebar functionalities. The changes impact the core functionality and UI layout, requiring a thorough review to ensure compatibility and functionality.

🧪 Relevant tests

No

🔍 Possible issues

The removal of certain components and hooks might lead to missing functionalities or broken features if they are still being used elsewhere in the codebase.

Significant changes to the layout and structure of the workbench and sidebars could introduce UI/UX inconsistencies or regressions.

The introduction of new components and functionalities (e.g., RightSidebar, ViewBodyIsland, ViewHeaderIsland) requires careful testing to ensure they integrate well with the existing system and do not introduce new bugs.

🔒 Security concerns

No

Code feedback:
relevant filepackages/frontend/core/src/modules/workbench/view/use-view.tsx
suggestion      

Consider adding error handling for the case where ViewContext is not provided. While the current implementation throws an error, it might be beneficial to provide a more descriptive error message or handle this case more gracefully. [medium]

relevant linethrow new Error(

relevant filepackages/frontend/core/src/modules/workbench/view/desktop-adapter.ts
suggestion      

Ensure that the useEffect hook properly cleans up by returning a function that undoes the effect if necessary. This is crucial when binding and unbinding event listeners to avoid memory leaks. [medium]

relevant lineuseLocation()

relevant filepackages/frontend/core/src/modules/multi-tab-sidebar/view/body.tsx
suggestion      

For better error handling and user experience, consider rendering a fallback UI or a loading state when the Component is not available or while it's being loaded. [medium]

relevant line{Component ? : null}

relevant filepackages/frontend/core/src/modules/right-sidebar/view/container.tsx
suggestion      

When appending or removing views from the RightSidebar, consider implementing animations or transitions for a smoother user experience. This could enhance the visual feedback when the sidebar opens or closes. [medium]

relevant linerightSidebar._append(view);


✨ Review tool usage guide:

Overview:
The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

/review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...

With a configuration file, use the following template:

[pr_reviewer]
some_config1=...
some_config2=...
Utilizing extra instructions

The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

Examples for extra instructions:

[pr_reviewer] # /review #
extra_instructions="""
In the 'possible issues' section, emphasize the following:
- Does the code logic cover relevant edge cases?
- Is the code logic clear and easy to understand?
- Is the code logic efficient?
...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

How to enable\disable automation
  • When you first install PR-Agent app, the default mode for the review tool is:
pr_commands = ["/review", ...]

meaning the review tool will run automatically on every PR, with the default configuration.
Edit this field to enable/disable the tool, or to change the used configurations

Auto-labels

The review tool can auto-generate two specific types of labels for a PR:

  • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
  • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
Extra sub-tools

The review tool provides a collection of possible feedbacks about a PR.
It is recommended to review the possible options, and choose the ones relevant for your use case.
Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
require_score_review, require_soc2_ticket, and more.

Auto-approve PRs

By invoking:

/review auto_approve

The tool will automatically approve the PR, and add a comment with the approval.

To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

[pr_reviewer]
enable_auto_approval = true

(this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

[pr_reviewer]
maximal_review_effort = 5
More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the review usage page for a comprehensive guide on using this tool.

Copy link
Collaborator

@pengx17 pengx17 left a comment

Choose a reason for hiding this comment

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

LGTM overall. It seems some UI details may need to be fixed later.
Also, perhaps adding a couple of more tests?

@github-actions github-actions bot added the app:electron Related to electron app label Mar 2, 2024
@EYHN EYHN force-pushed the eyhn/feat/rightsidebar branch 2 times, most recently from 710ed0e to 54f7247 Compare March 2, 2024 15:19
@EYHN EYHN requested a review from pengx17 March 4, 2024 06:03
Copy link

graphite-app bot commented Mar 4, 2024

Merge activity

EYHN added a commit that referenced this pull request Mar 4, 2024
Windows control adaptation has not yet been completed

https://github.com/toeverything/AFFiNE/assets/13579374/c846c069-aa32-445d-b59b-b773a9b05ced

Now each view has a general container, the yellow area is the general container part, and the green part is the routing specific part.

![CleanShot 2024-03-01 at 11.47.35@2x.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/g3jz87HxbjOJpXV3FPT7/9a9f6ad6-2207-42e5-ae66-f7426bc9f3fc.png)
https://github.com/toeverything/AFFiNE/assets/13579374/c846c069-aa32-445d-b59b-b773a9b05ced

Now each view has a general container, the yellow area is the general container part, and the green part is the routing specific part.

![CleanShot 2024-03-01 at 11.47.35@2x.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/g3jz87HxbjOJpXV3FPT7/9a9f6ad6-2207-42e5-ae66-f7426bc9f3fc.png)
@graphite-app graphite-app bot merged commit c599715 into canary Mar 4, 2024
39 of 42 checks passed
@graphite-app graphite-app bot deleted the eyhn/feat/rightsidebar branch March 4, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants