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
feat(aio): add survey link #21371
Conversation
</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> |
There was a problem hiding this comment.
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.
aio/src/app/app.component.ts
Outdated
style({height: '*'}), | ||
animate(250, style({height: 0})) | ||
]) | ||
]) |
There was a problem hiding this comment.
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.
aio/src/app/app.component.ts
Outdated
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; | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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.
20476d6
to
0f3b280
Compare
You can preview 0f3b280 at https://pr21371-0f3b280.ngbuilds.io/. |
There was a problem hiding this 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!
aio/scripts/_payload-limits.json
Outdated
"polyfills": 11858 | ||
}, | ||
"uncompressed": { | ||
"inline": 1558, | ||
"main": 456432, | ||
"main": 462030, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
aio/src/app/app.component.ts
Outdated
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; | ||
|
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why NO_ERRORS_SCHEMA?
There was a problem hiding this comment.
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/src/app/app.component.html
Outdated
<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 |
There was a problem hiding this comment.
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
.
Aha!
…On Mon, Jan 8, 2018, 6:35 AM Pete Bacon Darwin ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In aio/src/app/layout/survey-link/survey-link.component.spec.ts
<#21371 (comment)>:
> @@ -0,0 +1,65 @@
+import { NO_ERRORS_SCHEMA } from ***@***.***/core';
+import { ComponentFixture, TestBed } from ***@***.***/core/testing';
+import { By } from ***@***.***/platform-browser';
+import { SurveyLinkComponent } from './survey-link.component';
+
+describe('TopMenuComponent', () => {
+ let component: SurveyLinkComponent;
+ let fixture: ComponentFixture<SurveyLinkComponent>;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [ SurveyLinkComponent ],
+ schemas: [NO_ERRORS_SCHEMA]
So we don't have to load the Material components just for the unit testing
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#21371 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AANM6HSpiYkGIUOJZVhNmqUAkS7cIBd6ks5tIieYgaJpZM4RVy_a>
.
|
0f3b280
to
9629552
Compare
You can preview 9629552 at https://pr21371-9629552.ngbuilds.io/. |
9629552
to
835a0f0
Compare
You can preview 835a0f0 at https://pr21371-835a0f0.ngbuilds.io/. |
835a0f0
to
40a71b8
Compare
You can preview 40a71b8 at https://pr21371-40a71b8.ngbuilds.io/. |
40a71b8
to
e70ddaa
Compare
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. |
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can preview b0eaa08 at https://pr21371-b0eaa08.ngbuilds.io/. |
You can preview dbd2e3c at https://pr21371-dbd2e3c.ngbuilds.io/. |
dbd2e3c
to
22c0489
Compare
You can preview 22c0489 at https://pr21371-22c0489.ngbuilds.io/. |
@gkalpak okay to merge now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
You can preview 0e4faca at https://pr21371-0e4faca.ngbuilds.io/. |
You can preview d7d825c at https://pr21371-d7d825c.ngbuilds.io/. |
There was a problem hiding this 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).
✨ |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #21094