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

Cleanup Vue components #279

Merged
merged 1 commit into from
Feb 12, 2021
Merged

Cleanup Vue components #279

merged 1 commit into from
Feb 12, 2021

Conversation

SamChou19815
Copy link
Contributor

@SamChou19815 SamChou19815 commented Feb 12, 2021

Summary

Cleanup vue components by

  • Declaring each component prop as required or give it a default value
  • Declare components in components: {...}, instead of Vue.component('name', Component). This gives better type-checking and autocompletion.

Unfortunately, the Vuetr plugin has a bug with imported types in props. Therefore, I have to make all the common types global.

Test Plan

Move around the app and see no warnings in console.

@SamChou19815 SamChou19815 requested a review from a team as a code owner February 12, 2021 05:54
@dti-github-bot
Copy link
Member

[diff-counting] Significant lines: 467.

@github-actions
Copy link
Contributor

Visit the preview URL for this PR (updated for commit 98c77de):

https://cornelldti-courseplan-dev--pr279-vue-component-cleanu-wywls67f.web.app

(expires Fri, 19 Feb 2021 05:57:28 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Copy link
Collaborator

@tcho6319 tcho6319 left a comment

Choose a reason for hiding this comment

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

Thanks for this great improvement in the codebase Sam! I left some comments but once those are addressed, the PR should be good to go!

import store from '@/store';
import store from '../store';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it better to use ../ here instead of @/? I thought @ referred to src.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is used to make the ts project for requirement generator happy

<bottombar
<bottom-bar
Copy link
Collaborator

Choose a reason for hiding this comment

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

Without declaring the name of the component as in the old style (Vue.component('bottombar', BottomBar);), how do we know that bottom-bar refers to the component BottomBar? Just curious!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's some standard case transform vue performs. CamelCase to lower-case-with-dash

Comment on lines 106 to 107
Vue.component('semesterview', SemesterView);
Vue.component('requirements', Requirements);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we waiting on handling these until after the migration to the global data store?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

contentClass="content-course"
content-class="content-course"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't the required prop name contentClass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also some case transformation on props

Copy link
Collaborator

@tcho6319 tcho6319 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you so much Sam.

@SamChou19815 SamChou19815 merged commit 84ef322 into master Feb 12, 2021
@SamChou19815 SamChou19815 deleted the vue-component-cleanup branch February 12, 2021 18:11
SamChou19815 added a commit that referenced this pull request Feb 16, 2021
## Summary

This diff continues the work of #279. It refactors the IncompleteSubReqCourse component so that the prop no longer relies on `CrseInfo` and `SubReqCourseSlot`, so that we can cleanup the last `Vue.component(...)` call that doesn't work well with Vuetr.

I also moved the type of `SubReqCourseSlot` from `src/requirement/types` into `SubRequirement.vue`, since only that component and `Requirement.vue` are using it.

## Test Plan

See all courses and incomplete subreq courses still load
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.

3 participants