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

fix: reorganized components #562

Merged
merged 11 commits into from
Oct 11, 2023
Merged

Conversation

arnaut08
Copy link
Contributor

@arnaut08 arnaut08 commented Sep 6, 2023

Issue number #546

Relevant #546

Please check the following

  • Do the tests still pass? (see Run the Tests)
  • Is the code formatted properly? (see Linting (Formatting))
  • For New Features:
    • Have tests been added to cover any new features or fixes?
    • Has the documentation been updated accordingly?

Please describe additional details for testing this change

I don't think additional details are required as it's just the reorganization of the components files.

Copy link
Collaborator

@seriouslysean seriouslysean left a comment

Choose a reason for hiding this comment

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

Solid work so far! I think this is headed mostly in the right direction but I have a lot of thoughts on how I think we should be separating everything.

Considering how we utilize the components, it makes sense to me to split by route for now, and then organizing within route based folders.

Something like this:

  • /routes/
    • /home/
      • /components
      • /js
    • /about/
      • /components
      • /js

Etc, which would allow us to code split by route if we so choose by doing async imports. It also would keep a logical separation of components we use within those pages and we could set up route based aliases in vite. Any shared functionality would live under some sort of core, or global namespace.

@itsalaidbacklife penny for your thoughts.

@arnaut08
Copy link
Contributor Author

arnaut08 commented Sep 7, 2023

Considering how we utilize the components, it makes sense to me to split by route for now, and then organizing within route based folders.

Something like this:

  • /routes/

    • /home/

      • /components
      • /js
    • /about/

      • /components
      • /js

Currently we have all the views(route specific files) inside the /views directory. As per my understanding, you're suggesting for us to split the files as per the routes, right? So we'll have a /routes directory and individual directories for each route with respective view file, and respective components grouped in the components directory, right?
Something like this:

  • Main view file - /routes/home/HomeView.vue
  • Respective component files - /routes/home/components/...

Also, what exactly is the js subdirectory for? Is it for respective utility function files?

@seriouslysean
Copy link
Collaborator

seriouslysean commented Sep 7, 2023

Also, what exactly is the js subdirectory for? Is it for respective utility function files?

@arnaut08 exactly that. Utilities, store files, or anything other js imports related to just that route. You may not need the folder if the route doesn't have any right now, though.

I'll file a follow up to look in to async importing the top level Vue files from the router to garner the benefit from the file restructure.

See #563

@arnaut08
Copy link
Contributor Author

arnaut08 commented Sep 7, 2023

I've reorganized it as per the routes and handled #563 as well.
Please note: I couldn't find any route specific js files being imported anywhere and the utility files which are being imported in some routes is also being used in the server application. That's why I haven't included that in my changes yet. Please let me know if I missed anything.

Copy link
Collaborator

@seriouslysean seriouslysean left a comment

Choose a reason for hiding this comment

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

This is super close! Convert all the relative paths to aliases and in the vite config make an entry for the new areas; core, and each route as a top level so you can do something like ~core/components/FileName.Vue.

src/core/components/TheHeader.vue Outdated Show resolved Hide resolved
src/routes/game/components/GameDialogs.vue Outdated Show resolved Hide resolved
src/routes/game/components/GameUnavailableView.vue Outdated Show resolved Hide resolved
src/routes/game/components/GameUnavailableView.vue Outdated Show resolved Hide resolved
@itsalaidbacklife
Copy link
Contributor

@arnaut08 sorry to have left this hanging. This is looking good. I need to sync up with @seriouslysean and give this a look together but we should have the final feedback for you by end of week

@arnaut08
Copy link
Contributor Author

Sorry for the delayed response. I've made the changes suggested by @seriouslysean. Please review those changes and consider them for the feedback. Thank you.

Copy link
Contributor

@itsalaidbacklife itsalaidbacklife left a comment

Choose a reason for hiding this comment

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

This is a great start. I apologize that it's taken so long to get a full review on this. It's a high impact restructuring so we wanted to make sure the internal team was in sync about the desired structure. I'm requesting a slight rework of how the folders are organized, and of removing the ~ aliases and sticking with @ relative imports.

For the folder change, we will remove the core folder, and move both core/components and core/composables directly into src/components (for base components) and src/composables (for root composables).

Additionally, let's rename the src/routes/auth folder to src/routes/login as that's the name of the route.

Again, great work! This will add a lot of value, especially making it easier for new contributors to find components while onboarding. Thanks for your contribution! Please comment here (or join us on discord) if you have any questions.

src/core/components/AwardCard.vue Outdated Show resolved Hide resolved
src/core/components/RulesDialog.vue Outdated Show resolved Hide resolved
src/core/components/UsernameToolTip.vue Outdated Show resolved Hide resolved
src/core/composables/navLink.js Outdated Show resolved Hide resolved
src/router.js Outdated Show resolved Hide resolved
vite.config.js Outdated Show resolved Hide resolved
src/routes/game/components/SevenDoubleJacksDialog.vue Outdated Show resolved Hide resolved
@itsalaidbacklife
Copy link
Contributor

@arnaut08 are you still interested in finishing this task?

@arnaut08
Copy link
Contributor Author

arnaut08 commented Oct 9, 2023

@arnaut08 are you still interested in finishing this task?

Hey! I'm so sorry for the delayed response. Yes, I'll make the changes as per your latest comments.

@itsalaidbacklife
Copy link
Contributor

@arnaut08 it's not a problem at all. Open source is always at your own pace, and these kinds of sweeping reorganization bear the brunt of the challenge around merge conflicts.

I'm just commenting on the open PR's to check which ones are abandoned and should be closed accordingly. I'll leave this open. Reach out here or on discord if you get stuck or would like help.

Copy link
Contributor

@itsalaidbacklife itsalaidbacklife left a comment

Choose a reason for hiding this comment

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

@arnaut08 excellent work. This all looks right. I have two whitespace nitpicks in the comments. Other than that, the only thing to do is to fix the merge conflicts. Let me know if you'd like help navigating them.

This is a great reorganization that I'm looking forward to finalizing. Thanks for your contribution!

src/routes/home/components/GameListItem.vue Outdated Show resolved Hide resolved
src/stores/gameList.js Outdated Show resolved Hide resolved
@itsalaidbacklife itsalaidbacklife added the hacktoberfest This issue welcomes contributions for Hacktoberfest. label Oct 11, 2023
@itsalaidbacklife
Copy link
Contributor

itsalaidbacklife commented Oct 11, 2023

@arnaut08 this is great. There are just two remaining merge conflicts in

src/components/HowItWorksDialog.vue
src/views/RulesView.vue

which were just updated today. Apologies that this has been a moving target. I can stop merging other PR's until this is done so that your update can go live before other things go in because you've been working on this for a while and it is so high-impact

@arnaut08
Copy link
Contributor Author

Apologies that this has been a moving target

No worries at all. I've resolved the remaining conflicts.

Copy link
Contributor

@itsalaidbacklife itsalaidbacklife 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, thanks for taking this on!

@itsalaidbacklife itsalaidbacklife dismissed seriouslysean’s stale review October 11, 2023 19:31

Change requests are addressed

@itsalaidbacklife itsalaidbacklife merged commit e7245f6 into cuttle-cards:main Oct 11, 2023
9 checks passed
Haviles04 pushed a commit to Haviles04/cuttle that referenced this pull request Oct 12, 2023
* fix: reorganized components

* fix: reorganized files as per the routes

* fix: aliases added and routes reconfigured

* fix: reconfigured paths

* fix: corrected paths after resolving conflicts

* fix: removed extra whitespaces

* fix: fixed remaining paths
Haviles04 pushed a commit to Haviles04/cuttle that referenced this pull request Oct 12, 2023
* fix: reorganized components

* fix: reorganized files as per the routes

* fix: aliases added and routes reconfigured

* fix: reconfigured paths

* fix: corrected paths after resolving conflicts

* fix: removed extra whitespaces

* fix: fixed remaining paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest This issue welcomes contributions for Hacktoberfest.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DevEx]: Reorganize Vue components
3 participants