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

Migrate all core theming to vuex driven dynamic styles #4587

Merged
merged 9 commits into from
Dec 18, 2018

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Dec 11, 2018

Summary

#4524 did a lot of good things, but by separating each build into a separate, independent process, it broke the ability to do dynamic coreAPI injection at build time. Along with this, it also broke the ability to do custom styling of Kolibri at build time using a build time specified external plugin.

This PR rectifies some of this in a slightly different way by migrating all styling that hitherto has been done by variables specified in core-theme.scss to be driven by a core object in Vuex state.

As a bonus, it also adds a colour customization tool in dev mode to let people dynamically change styles.

Reviewer guidance

Check that styling is still applied correctly in the many components that have been refactored - I still have some more work to do manually verifying all this also, although I was mostly checking as I went, and did a post-pass of high visibility areas.

Also read the additions to the docs and see if they make sense!

References

No current issues this addresses, but will enable custom theming for accessibility and cosmetic purposes in future.


Contributor Checklist

PR process:

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Testing:

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Gherkin stories have been updated
  • Unit tests have been updated

Reviewer Checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.rst

@rtibbles rtibbles added the TODO: needs review Waiting for review label Dec 11, 2018
@rtibbles rtibbles added this to the 0.12.0 milestone Dec 11, 2018
@codecov
Copy link

codecov bot commented Dec 18, 2018

Codecov Report

Merging #4587 into develop will increase coverage by 23.12%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #4587       +/-   ##
===========================================
+ Coverage    52.57%   75.7%   +23.12%     
===========================================
  Files          725     246      -479     
  Lines        23890   11496    -12394     
  Branches      3174    1371     -1803     
===========================================
- Hits         12561    8703     -3858     
+ Misses       10649    2481     -8168     
+ Partials       680     312      -368
Impacted Files Coverage Δ
kolibri/core/auth/serializers.py 95.65% <0%> (ø) ⬆️
kolibri/core/logger/api_urls.py 100% <0%> (ø) ⬆️
...iews/lessons/LessonResourceSelectionPage/index.vue
kolibri/core/assets/src/timer.js
kolibri/core/assets/src/heartbeat.js
...s/style_guide/assets/src/views/StyleGuideIndex.vue
kolibri/core/assets/src/router.js
.../assets/src/views/content/DropdownButton/index.vue
...coach/assets/src/constants/assignmentsConstants.js
.../plugins/device_management/assets/src/constants.js
... and 373 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6a64f3...7f44768. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 18, 2018

Codecov Report

Merging #4587 into develop will increase coverage by 0.26%.
The diff coverage is 60.81%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4587      +/-   ##
===========================================
+ Coverage    52.52%   52.79%   +0.26%     
===========================================
  Files          726      736      +10     
  Lines        24128    24425     +297     
  Branches      3218     3257      +39     
===========================================
+ Hits         12674    12895     +221     
- Misses       10773    10847      +74     
- Partials       681      683       +2
Impacted Files Coverage Δ
...ore/assets/src/views/AppError/ReportErrorModal.vue 30.76% <ø> (ø) ⬆️
...lugins/user/assets/src/views/ProfilePage/index.vue 46.34% <ø> (+2.43%) ⬆️
.../setup_wizard/assets/src/views/ProgressToolbar.vue 100% <ø> (ø) ⬆️
...ibri/plugins/learn/assets/src/views/LearnIndex.vue 83.87% <ø> (ø) ⬆️
...plugins/user/assets/src/views/SignInPage/index.vue 50.36% <ø> (+1.45%) ⬆️
...ns/learn/assets/src/views/ContentCardGroupGrid.vue 33.33% <ø> (ø) ⬆️
...libri/plugins/user/assets/src/views/SignUpPage.vue 49.39% <ø> (+2.4%) ⬆️
...gement/assets/src/views/UserPage/EditUserModal.vue 0% <ø> (ø) ⬆️
...rc/views/exams/CoachExamsPage/PreviewExamModal.vue 17.91% <ø> (ø) ⬆️
...sets/src/views/onboarding-forms/OnboardingForm.vue 100% <ø> (ø) ⬆️
... and 125 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0287959...69856a1. Read the comment docs.

Copy link
Contributor

@indirectlylit indirectlylit left a comment

Choose a reason for hiding this comment

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

couple small comments. Overall I think it's best to get this in the mainline and open new issues as we find them

if (process.env.NODE !== 'production') {
const colourPicker = require('../utils/colourPicker').default;
colourPicker.start();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fun, but I don't think it should be turned on by default in the devserver.

Also, colourPicker.js is unnecessary. You can just drop ColourPicker.vue in CoreBase.vue.

Maybe add a prop on CoreBase like

showColorPicker: {
  type: Boolean,
  default: false,
}

and then add to the template

...

    <GlobalSnackbar />
    <ColourPicker v-if="showColorPicker" />
  </div>

</template>

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I did it like this so that it wouldn't even get bundled into the production build.

@indirectlylit
Copy link
Contributor

getting some travis failures too

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

Successfully merging this pull request may close these issues.

2 participants