-
Notifications
You must be signed in to change notification settings - Fork 1
TT-39 feat: allow switching amongyears #586
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
Conversation
<!-- -<div class="d-flex"> | ||
- <div | ||
- class="month w-100 text-center align-self-center d-flex flex-column" | ||
- *ngFor="let month of months; let i = index" | ||
- (click)="getMonth(i)" | ||
- [ngClass]="{ active: activeMonth === i }" | ||
- > | ||
- <div class="p-2">{{ month }}</div> | ||
- </div> | ||
-</div> | ||
--> |
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.
should not you remove this dead code?
} | ||
|
||
onChange(monthIndex: number, year: number) { | ||
// tslint:disable-next-line:no-unused-expression |
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.
no reason to have this line here.
this.changeDate.emit({monthIndex, year}); | ||
} | ||
|
||
// tslint:disable-next-line:no-unused-expression |
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.
no reason to have this line here.
for (let i = 5; i > 0; i--) { | ||
this.years.push(this.model.selectedYearMoment.year() - i); | ||
} | ||
for (let i = 0; i <= 6; i++) { | ||
this.years.push(this.model.selectedYearMoment.year() + i); | ||
} |
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.
What are you trying to do here? is this better?
const currentYear = this.model.selectedYearMoment.year();
for (let i = currentYear -5; i < currentYear+5; i++) {
if( i !== currentYear){ this.years.push(i); }
}
selectYear(year: number) { | ||
this.isShowYears = false; | ||
this.model.selectedYearMoment = moment().year(year); | ||
this.model.updateYearText(); // in set get aendern |
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.
What do you mean?
// in set get aendern
@@ -36,7 +40,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy { | |||
} | |||
|
|||
ngOnInit(): void { | |||
this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1)); | |||
// this.store.dispatch(new entryActions.LoadEntries(new Date().getMonth() + 1)); |
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 we remove this commented line?
// getMonth(month: number) { | ||
// this.store.dispatch(new entryActions.LoadEntries(month)); | ||
// } |
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 we remove this commented code?
|
||
renderYears() { | ||
this.years = []; | ||
for (let i = 5; i > 0; i--) { |
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.
What are these magic numbers doing here?
<!-- -<div class="d-flex"> | ||
- <div | ||
- class="month w-100 text-center align-self-center d-flex flex-column" | ||
- *ngFor="let month of months; let i = index" | ||
- (click)="getMonth(i)" | ||
- [ngClass]="{ active: activeMonth === i }" | ||
- > | ||
- <div class="p-2">{{ month }}</div> | ||
- </div> | ||
-</div> | ||
--> |
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.
Please, let's try to avoid pushing commented code. Unless this would be needed somewhere else.
|
||
// getMonth(month: number) { | ||
// this.store.dispatch(new entryActions.LoadEntries(month)); | ||
// } |
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 same comment as before. No commented code pushed, please.
@@ -1,23 +1,133 @@ | |||
import { Component, OnInit, Output, EventEmitter } from '@angular/core'; | |||
import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core'; | |||
import * as moment from 'moment'; |
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.
Do we need to import everything from moment? Or just some utilities.
I'm suggesting this because in front end we need to be careful of what we are importing. Sometimes it impacts to the performance.
No description provided.