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

chore: refactor shell to individual files #16893

Merged
merged 21 commits into from
Oct 2, 2024
Merged

Conversation

sean-brydon
Copy link
Member

@sean-brydon sean-brydon commented Oct 1, 2024

What does this PR do?

This PR is one of many that refactors the Shell component out of one file and into many sub components. This PR is just extracting with no performance improvements. They will happen in a follow up PR

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Oct 2, 2024 2:00pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Oct 2, 2024 2:00pm

Copy link
Contributor

github-actions bot commented Oct 1, 2024

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Chore/refactor shell". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@sean-brydon sean-brydon changed the title Chore/refactor shell chore: refactor shell to individual files Oct 1, 2024
@sean-brydon sean-brydon marked this pull request as ready for review October 1, 2024 12:17
@graphite-app graphite-app bot requested a review from a team October 1, 2024 12:17
@dosubot dosubot bot added the 💻 refactor label Oct 1, 2024
@sean-brydon sean-brydon added the high-risk Requires approval by Foundation team label Oct 1, 2024
@graphite-app graphite-app bot requested a review from a team October 1, 2024 12:18
Copy link
Member Author

Choose a reason for hiding this comment

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

Move to a hook that can live outside of shell

Copy link
Member Author

Choose a reason for hiding this comment

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

Same goes as above with its helper fuctions

Copy link

graphite-app bot commented Oct 1, 2024

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (10/01/24)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (10/01/24)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Create a hook that boots intercom - no need for this to live directly in shell either. Means we can control when the "me" query is called much easier i the future as it was being called on every render

Copy link
Member Author

Choose a reason for hiding this comment

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

Wow thats a lot less lines

return bannersHeight;
};

const useBanners = () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Lets just have one hook to get all banners and calculate the height

Copy link
Contributor

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

Great refactor @sean-brydon

Test Cases

  • Desktop view ✅
  • Reduced side bar ✅
  • Mobile nav ❌
  • Unauthed redirect to login page ✅
  • Onboarding trigger ✅

Blocking

  • If we're refactoring right now can we abstract some of the hooks logic so we can prepare for the app router migration? If it's too big then I'm ok having this in a follow up PR. FYI @hbjORbj
  • In the mobile nav container when clicking More I get this error
    CleanShot 2024-10-01 at 10 27 25@2x

Non-blocking

  • Have you considered using useCallback at all to help with preventing rerenders? I'm also ok with having it in a follow up PR

onInteractOutside={() => {
setMenuOpen(false);
}}
className="min-w-56 hariom group overflow-hidden rounded-md">
Copy link
Contributor

Choose a reason for hiding this comment

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

How did @hariombalhara sneak in here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats a great question lol

@sean-brydon
Copy link
Member Author

  • Have you considered using useCallback at all to help with preventing rerenders? I'm also ok with having it in a follow up PR

100%! As i mentioned in the PR description - i've not made any perf improvements here. Just making the component more manageable!

If we're refactoring right now can we abstract some of the hooks logic so we can prepare for the app router migration? If it's too big then I'm ok having this in a follow up PR. FYI @hbjORbj

I don't understand what you mean here? I've tried to abstract all hooks that were present in the shell

Mobile nav ❌
On it! Also some type errors i need to fix around this area too

Copy link
Contributor

github-actions bot commented Oct 2, 2024

E2E results are ready!

Copy link
Contributor

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

Navigation is now working as expected.

In terms of my abstracting hooks logic comment. We can't call hooks in server components so ideally I would have liked to see the logic inside of the hooks to be abstracted. Although looking through it some more I realize it would be too big for this PR so let's cross that bridge when we get there.

@sean-brydon sean-brydon merged commit 4553455 into main Oct 2, 2024
39 checks passed
@sean-brydon sean-brydon deleted the chore/refactor-shell branch October 2, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only high-risk Requires approval by Foundation team ready-for-e2e 💻 refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants