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 part of #9749: Migrate base-content #12371

Merged
merged 137 commits into from
Jun 8, 2021

Conversation

ashutoshc8101
Copy link
Contributor

@ashutoshc8101 ashutoshc8101 commented Mar 30, 2021

Overview

  1. This PR fixes Toast Messages Should Work in Angular components #12386 and fixes part of Migrate directives/controllers to Angular components #9749.
  2. This PR does the following: Migrates base-content directive.

PR is open for some dependencies (top navigation bar, footer) of base-content.
So, I used upgradeComponent for that dependencies. If those PRs get merged before this, I will update this PR to use the migrated components.

Essential Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The linter/Karma presubmit checks have passed locally on your machine.
  • "Allow edits from maintainers" is checked. (See here for instructions on how to enable it.)
    • This lets reviewers restart your CircleCI tests for you.
  • The PR is made from a branch that's not called "develop".

Proof that changes are correct

base-content:

base-content-2021-03-31_21.54.49.mp4

PR Pointers

  • Make sure to follow the instructions for making a code change.
  • Oppiabot will notify you when you don't add a PR_CHANGELOG label. If you are unable to do so, please @-mention a code owner (who will be in the Reviewers list), or ask on Gitter.
  • For what code owners will expect, see the Code Owner's wiki page.
  • Make sure your PR follows conventions in the style guide, otherwise this will lead to review delays.
  • Never force push. If you do, your PR will be closed.
  • Oppiabot can assign anyone for review/help if you leave a comment like the following: "{{Question/comment}} @{{reviewer_username}} PTAL"
  • Some of the e2e tests are flaky, and can fail for reasons unrelated to your PR. We are working on fixing this, but in the meantime, if you need to restart the tests, please check the "If your build fails" wiki page.

@oppiabot
Copy link

oppiabot bot commented Mar 30, 2021

Hi @ashutoshc8101, the body of this PR is missing the required description, please update the body with a description of what this PR does.
Also, the karma and linter checklist has not been checked, please make sure to run the frontend tests and lint tests before pushing. Thanks!

@oppiabot
Copy link

oppiabot bot commented Mar 30, 2021

Hi, @ashutoshc8101, this pull request does not have a "CHANGELOG: ..." label as mentioned in the PR checkbox list. Assigning @ ashutoshc8101 to add the required label. PRs without this label will not be merged. If you are unsure of which label to add, please ask the reviewers for guidance. Thanks!

@oppiabot
Copy link

oppiabot bot commented Mar 30, 2021

Hi @ashutoshc8101, when creating WIP/Draft PRs, ensure that your commit messages are prefixed with [ci skip] or [skip ci] to prevent CI checks from running. You can learn more about it here.

@oppiabot
Copy link

oppiabot bot commented Mar 30, 2021

Hi @ashutoshc8101. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

Comment on lines +70 to +77
this.getHeaderText = () => {
return this.pageTitleService.getPageTitleForMobileView();
};

this.getSubheaderText = () => {
return this.pageTitleService.getPageSubtitleForMobileView();
};
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why declare functions inside ngOnInit() ?
Because pageTitleService is undefined while declaring the functions in the conventional way.

Copy link
Member

Choose a reason for hiding this comment

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

Put this in a comment above the two functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 85 to 101
.oppia-sidebar-menu-open {
box-shadow: 1px 0 3px rgba(0,0,0,0.12), 1px 0 2px rgba(0,0,0,0.24);
height: 110vh;
overflow-y: scroll;
-ms-transform: translate(0, 0);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
.oppia-sidebar-menu-open::after {
height: 0;
opacity: 0;
-webkit-transition: opacity 0.5s, width 0.1s 0.5s, height 0.1s 0.5s;
transition: opacity 0.5s, width 0.1s 0.5s, height 0.1s 0.5s;
width: 0;
}
</style>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why move this css from oppia.css to component?
Because component's css was taking priority over the global css due to view encapsulation (unlike ajs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was causing issues showing sidebar

SidebarStatusService.toggleSidebar();
// SidebarStatusService.toggleSidebar();
// $scope.update = !$scope.update;
$scope.toggle();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why this is changed?
Due to change detection issues with upgradeComponent.
When toggleSidebar is called directly from there, change detection only occurs in ajs not in angular.
So, I changed this in such a way that both ajs and angular change detection work.

@@ -42,7 +42,7 @@
<nav class="navbar navbar-expand navbar-light oppia-navbar oppia-prevent-selection" role="navigation"
headroom tolerance="0" offset="0">
<div class="navbar-container">
<top-navigation-bar></top-navigation-bar>
<top-navigation-wrapper></top-navigation-wrapper>
Copy link
Contributor Author

@ashutoshc8101 ashutoshc8101 Mar 31, 2021

Choose a reason for hiding this comment

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

to fix the side effects of the changes which were made to fix change detection.

@ashutoshc8101 ashutoshc8101 changed the title Base components Fix part of #9749: Migrate base-content, alerts-and-warnings, side-navigation-bar, alert-message and loading-message directives Mar 31, 2021
@ashutoshc8101 ashutoshc8101 marked this pull request as ready for review March 31, 2021 16:22
@brianrodri brianrodri self-requested a review June 6, 2021 05:24
@oppiabot
Copy link

oppiabot bot commented Jun 6, 2021

Unassigning @brianrodri since they have already approved the PR.

@oppiabot
Copy link

oppiabot bot commented Jun 6, 2021

Unassigning @nithusha21 since they have already approved the PR.

@ashutoshc8101
Copy link
Contributor Author

@sagangwee PTAL

@sagangwee sagangwee removed their assignment Jun 7, 2021
Copy link
Contributor

@sagangwee sagangwee left a comment

Choose a reason for hiding this comment

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

@ashutoshc8101 LGTM for codeowners.

@oppiabot oppiabot bot unassigned sagangwee Jun 7, 2021
@oppiabot
Copy link

oppiabot bot commented Jun 7, 2021

Unassigning @sagangwee since they have already approved the PR.

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.

Toast Messages Should Work in Angular components