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

New sidemenu for notes editor #6527

Merged
merged 4 commits into from
Aug 7, 2024
Merged

Conversation

ehconitin
Copy link
Contributor

@Bonapara @lucasbordeau

This PR addresses issue #6489:

  • Created an entire sidemenu for the block editor.

Review Request

Please review the implementation of the custom sidemenu.

Outstanding Issues

  1. Sidemenu Positioning:

    • The current placement is determined by the BlockNote package.
    • I need assistance in positioning it according to the Figma designs.
    • Attempted adding margin to the sidemenu, but this solution doesn't scale well across different screen sizes.
  2. Props Spreading in CustomSidemenu.tsx:

    • Unable to avoid props spreading due to the third-party BlockNote components.
    • Added eslint-disable comments as a temporary solution.

Your insights on these challenges would be greatly appreciated, especially regarding the sidemenu positioning and any potential alternatives to props spreading.

2024-08-04.14-32-37.mp4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces a custom side menu for the block editor, enhancing the user experience with new components and styles.

  • New Custom Side Menu: Added CustomSideMenu.tsx to provide block editing options.
  • Block Addition Component: Introduced CustomAddBlockItem.tsx for adding new blocks.
  • Side Menu Options: Added CustomSideMenuOptions.tsx for menu item styling.
  • Editor Styling: Updated BlockEditor.tsx with new styles for better UI consistency.
  • Layout Adjustment: Modified ShowPageActivityContainer.tsx to increase top margin for improved layout.

6 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings

};
return (
<button
className="mantine-focus-auto m_99ac2aa1 mantine-Menu-item bn-menu-item m_87cf2631 mantine-UnstyledButton-root"
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using a more descriptive class name instead of mantine-focus-auto.

Copy link
Member

Choose a reason for hiding this comment

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

Seems strange to have m_99ac2aa1 or m_87cf2631, are you sure we need those?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will get back to you about this with some more clarity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @FelixMalfait,

I checked the classes m_99ac2aa1 and m_87cf2631 in the code. They’re handling specific styles like padding, cursor behavior, and other appearance settings using Mantine’s spacing and color variables.

If we want to avoid using these Mantine utility classes, I can replicate the styles manually. The only thing to consider would be how to handle Mantine’s spacing variables like --mantine-spacing-xs and --mantine-spacing-sm ourselves.

Let me know if you prefer that approach, or if you’re okay with keeping these classes for now.

image

Comment on lines +27 to +28
// eslint-disable-next-line react/jsx-props-no-spreading
<SideMenu {...props}>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider removing the eslint-disable comment by refactoring to avoid prop spreading.

Comment on lines +30 to +31
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Avoid prop spreading to improve maintainability and readability.

Comment on lines +33 to +34
// eslint-disable-next-line react/jsx-props-no-spreading
<DragHandleMenu {...props}>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Refactor to avoid prop spreading for better code quality.

Comment on lines +42 to +43
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<BlockColorsItem {...props}>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Prop spreading should be avoided to prevent potential bugs.

Comment on lines +50 to +51
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<RemoveBlockItem {...props}>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Avoid using prop spreading to enhance code clarity.

className="mantine-focus-auto m_99ac2aa1 mantine-Menu-item bn-menu-item m_87cf2631 mantine-UnstyledButton-root"
onClick={handleClick}
>
<Components.Generic.Menu.Item onClick={handleClick}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes so much more sense. haha mb

Copy link
Member

@FelixMalfait FelixMalfait left a comment

Choose a reason for hiding this comment

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

Great work!!! thank you

@FelixMalfait FelixMalfait merged commit 0c99bfb into twentyhq:main Aug 7, 2024
5 of 10 checks passed
Copy link

github-actions bot commented Aug 7, 2024

Fails
🚫

node failed.

Log

�[31mError: �[39m RequestError [HttpError]: You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID DC47:1A5A82:1269F430:223801BB:66B31306.
    at /home/runner/work/twenty/twenty/node_modules/�[4m@octokit�[24m/request/dist-node/index.js:86:21
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)�[39m {
  status: �[33m403�[39m,
  response: {
    url: �[32m'https://api.github.com/search/issues?q=is%3Apr%20author%3Aehconitin%20is%3Aclosed%20repo%3Atwentyhq%2Ftwenty&per_page=2&page=1'�[39m,
    status: �[33m403�[39m,
    headers: {
      �[32m'access-control-allow-origin'�[39m: �[32m'*'�[39m,
      �[32m'access-control-expose-headers'�[39m: �[32m'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset'�[39m,
      connection: �[32m'close'�[39m,
      �[32m'content-encoding'�[39m: �[32m'gzip'�[39m,
      �[32m'content-security-policy'�[39m: �[32m"default-src 'none'"�[39m,
      �[32m'content-type'�[39m: �[32m'application/json; charset=utf-8'�[39m,
      date: �[32m'Wed, 07 Aug 2024 06:24:06 GMT'�[39m,
      �[32m'referrer-policy'�[39m: �[32m'origin-when-cross-origin, strict-origin-when-cross-origin'�[39m,
      server: �[32m'github.com'�[39m,
      �[32m'strict-transport-security'�[39m: �[32m'max-age=31536000; includeSubdomains; preload'�[39m,
      �[32m'transfer-encoding'�[39m: �[32m'chunked'�[39m,
      vary: �[32m'Accept-Encoding, Accept, X-Requested-With'�[39m,
      �[32m'x-content-type-options'�[39m: �[32m'nosniff'�[39m,
      �[32m'x-frame-options'�[39m: �[32m'deny'�[39m,
      �[32m'x-github-api-version-selected'�[39m: �[32m'2022-11-28'�[39m,
      �[32m'x-github-media-type'�[39m: �[32m'github.v3; format=json'�[39m,
      �[32m'x-github-request-id'�[39m: �[32m'DC47:1A5A82:1269F430:223801BB:66B31306'�[39m,
      �[32m'x-ratelimit-limit'�[39m: �[32m'30'�[39m,
      �[32m'x-ratelimit-remaining'�[39m: �[32m'30'�[39m,
      �[32m'x-ratelimit-reset'�[39m: �[32m'1723011906'�[39m,
      �[32m'x-ratelimit-resource'�[39m: �[32m'search'�[39m,
      �[32m'x-ratelimit-used'�[39m: �[32m'1'�[39m,
      �[32m'x-xss-protection'�[39m: �[32m'0'�[39m
    },
    data: {
      documentation_url: �[32m'https://docs.github.com/free-pro-team@latest/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits'�[39m,
      message: �[32m'You have exceeded a secondary rate limit. Please wait a few minutes before you try again. If you reach out to GitHub Support for help, please include the request ID DC47:1A5A82:1269F430:223801BB:66B31306.'�[39m
    }
  },
  request: {
    method: �[32m'GET'�[39m,
    url: �[32m'https://api.github.com/search/issues?q=is%3Apr%20author%3Aehconitin%20is%3Aclosed%20repo%3Atwentyhq%2Ftwenty&per_page=2&page=1'�[39m,
    headers: {
      accept: �[32m'application/vnd.github.v3+json'�[39m,
      �[32m'user-agent'�[39m: �[32m'octokit-rest.js/18.12.0 octokit-core.js/3.6.0 Node.js/18.20.4 (linux; x64)'�[39m,
      authorization: �[32m'token [REDACTED]'�[39m
    },
    request: { hook: �[36m[Function: bound bound register]�[39m }
  }
}
danger-results://tmp/danger-results-7c3fd46d.json

Generated by 🚫 dangerJS against 857e5d9

@ehconitin ehconitin deleted the fixed-issue-6489 branch August 7, 2024 07:05
editor,
children,
}: CustomAddBlockItemProps) => {
const Components = useComponentsContext();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@FelixMalfait
this should've been const Components = useComponentsContext()! to remove ts errors.

Copy link
Member

Choose a reason for hiding this comment

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

Ah damn, I don't really like the const Components = useComponentsContext()! but should have done an if() + return to avoid the scenario where it's null. Would you mind raising a PR for this? Otherwise I will do it today! Thanks a lot!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will raise it dw. Will also remove some of the entityId ts errors. ps: there are 3 of them
Will clean it up

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants