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

feat(aio): add survey link #21371

Closed
wants to merge 1 commit into from

Conversation

petebacondarwin
Copy link
Member

Closes #21094

@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release comp: aio hotlist: devrel labels Jan 7, 2018
@petebacondarwin petebacondarwin added this to REVIEW in docs-infra Jan 7, 2018
</a>
<aio-top-menu *ngIf="isSideBySide" [nodes]="topMenuNodes"></aio-top-menu>
<aio-search-box class="search-container" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
</mat-toolbar-row>
Copy link
Member Author

Choose a reason for hiding this comment

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

The changes between this lines 18 and 28 are just because I had to move the toolbar content into a toolbar-row.

style({height: '*'}),
animate(250, style({height: 0}))
])
])
Copy link
Member Author

Choose a reason for hiding this comment

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

If we add the :enter transition to this animation then we could also use it for displaying the search results more smoothly.

private readonly SURVEY_EXPIRATION_DATE = new Date(2018, 1, 22);
private get localStorage() { return this.window.localStorage; }
showSurvey = !this.localStorage.getItem(this.SURVEY_KEY) && this.SURVEY_EXPIRATION_DATE > this.currentDate;

Copy link
Member Author

Choose a reason for hiding this comment

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

I worried that this is rather hard coded for this "generic" shell application but in this case, I felt that it was a temporary and rare feature that didn't warrant building the infrastructure t make this dynamically data driven.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm actually expect that we'll use this feature a lot, so it would be better if we moved this to the proposed "NotificationComponent".

'<path d="M0 0h24v24H0z" fill="none"/>' +
'</svg>'
},
multi: true
Copy link
Member Author

Choose a reason for hiding this comment

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

I hardcoded the two icons that are needed by the survey link component so that there is no flash of unwanted text. This will of course make the initial JS file slightly larger.

Copy link
Contributor

Choose a reason for hiding this comment

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

:-( we should find a way to deal with this better in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

We could try using HTTP push to preload these files so that we don't need to include them in the source...

@@ -10,7 +10,6 @@ mat-toolbar.mat-toolbar {
right: 0;
left: 0;
z-index: 10;
padding: 0 16px 0 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

Now we are using toolbar rows this messed up the alignment.

padding-top: 10px;
@media (max-width: 400px) {
display: none;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

If the screen gets super small (>400px) then we also hide the survey-icon, otherwise there is not enough space to display the text and the close button.

@petebacondarwin petebacondarwin force-pushed the aio-survey branch 2 times, most recently from 20476d6 to 0f3b280 Compare January 7, 2018 22:14
@mary-poppins
Copy link

You can preview 0f3b280 at https://pr21371-0f3b280.ngbuilds.io/.

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

the rest looks great. thanks for speedy turnaround!

"polyfills": 11858
},
"uncompressed": {
"inline": 1558,
"main": 456432,
"main": 462030,
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 this small feature add 6kb? was it because of some material design component?

Copy link
Contributor

Choose a reason for hiding this comment

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

can you please check the sourcemap explorer to see if you can identify where all these kbs are coming from? your own code can't weigh more than 1kb.

private readonly SURVEY_EXPIRATION_DATE = new Date(2018, 1, 22);
private get localStorage() { return this.window.localStorage; }
showSurvey = !this.localStorage.getItem(this.SURVEY_KEY) && this.SURVEY_EXPIRATION_DATE > this.currentDate;

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm actually expect that we'll use this feature a lot, so it would be better if we moved this to the proposed "NotificationComponent".

<mat-icon class="survey-icon" [svgIcon]="icon" [attr.aria-label]="iconText"></mat-icon>
</a>
<a href="{{surveyUrl}}" (click)="hideSurvey.next()" class="survey-link">{{message}}</a>
<a href="{{surveyUrl}}" (click)="hideSurvey.next()" class="survey-button">{{buttonText}}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

I originally thought that only dismissing the notification via the close button would permanently hide it. But I guess you are right that even on android/ios if you click on a notification the notification disappears. So let's keep it this way.

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ SurveyLinkComponent ],
schemas: [NO_ERRORS_SCHEMA]
Copy link
Contributor

Choose a reason for hiding this comment

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

why NO_ERRORS_SCHEMA?

Copy link
Member Author

Choose a reason for hiding this comment

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

So we don't have to load the Material components just for the unit testing

<aio-top-menu *ngIf="isSideBySide" [nodes]="topMenuNodes"></aio-top-menu>
<aio-search-box class="search-container" #searchBox (onSearch)="doSearch($event)" (onFocus)="doSearch($event)"></aio-search-box>
<mat-toolbar-row class="survey-container" [@accordion]="showSurvey" *ngIf="showSurvey">
<aio-survey-link
Copy link
Contributor

Choose a reason for hiding this comment

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

uh. oh. I'm sorry that I wasn't clear enough in the specification. This should have been just a generic NotificationComponent that takes campaign ID (used for local storage identifier), expiration date, an action url, and a html content to be reprojected.

<aio-notification
    campaignId="someId"
    expiration="2018-01-20"
    icon="insert_comment" /* optional, defaults to insert_comment */
    labels="Go to survey"
    href="https://bit.ly/angular-survey-2018">
  Help Angular by taking a <b>1 minute survey</b>!
</aio-notification>

The component can have a host listener for the click events. If a user clicks on the host element, the component will store info about the notification being dismissed and then it will navigate to the href.

@IgorMinar
Copy link
Contributor

IgorMinar commented Jan 8, 2018 via email

@mary-poppins
Copy link

You can preview 9629552 at https://pr21371-9629552.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 835a0f0 at https://pr21371-835a0f0.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 40a71b8 at https://pr21371-40a71b8.ngbuilds.io/.

@petebacondarwin
Copy link
Member Author

Made all the updates and investigated the change to the size. Locally I could only see in source-map-explorer about 3k of size increase due to the new functionality. Not quite sure where the 5k in the CI build is coming from.

@StephenFluin
Copy link
Contributor

Also, if we wanted to put an end date it now we can. We are planning to run the survey through Jan 19th. This can be added separately / or just removed when the time is right in a different PR if you prefer.

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

For reference:
As discussed offline, the marketing pages have a white top offset when the notification is shown.

survey-marketing

@mary-poppins
Copy link

You can preview b0eaa08 at https://pr21371-b0eaa08.ngbuilds.io/.

@mary-poppins
Copy link

You can preview dbd2e3c at https://pr21371-dbd2e3c.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 22c0489 at https://pr21371-22c0489.ngbuilds.io/.

@alexeagle
Copy link
Contributor

@gkalpak okay to merge now?

@gkalpak gkalpak added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Jan 11, 2018
Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

Oh, I didn't realize the merge label was applied. (I would have removed it.)
Everything looks great now, except for this one last glitch:

Expected:
hamburger-offset-expected

Actual:
hamburger-offset-actual

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@mary-poppins
Copy link

You can preview 0e4faca at https://pr21371-0e4faca.ngbuilds.io/.

@mary-poppins
Copy link

You can preview d7d825c at https://pr21371-d7d825c.ngbuilds.io/.

@gkalpak gkalpak added cla: yes and removed cla: no labels Jan 11, 2018
Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

It should all be good now (let's see if Travis agrees).

@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jan 11, 2018
@petebacondarwin
Copy link
Member Author

alexeagle pushed a commit that referenced this pull request Jan 12, 2018
@alexeagle alexeagle closed this in 4f31492 Jan 12, 2018
@petebacondarwin petebacondarwin removed this from MERGE in docs-infra Jan 12, 2018
@petebacondarwin petebacondarwin deleted the aio-survey branch January 16, 2018 11:04
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes hotlist: devrel target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIO: Add developer survey link to top of pages
7 participants