Skip to content

Commit

Permalink
change graphic color, hide graphic weight and height icon
Browse files Browse the repository at this point in the history
  • Loading branch information
renanfranca committed Dec 12, 2021
1 parent 9ceb0f5 commit c02f1f4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h2 data-cy="babyProfileDetailsHeading">
</a>
</div>
<div class="col-lg-10 col-sm-9 col-6 text-left">
<a [routerLink]="['/nap/new']" class="btn btn-primary m-0 text-white">
<a [routerLink]="['/nap/new']" class="btn btn-primary m-0 text-white p-2 mt-1">
<fa-icon icon="plus"></fa-icon>
<span class="d-none d-sm-inline" jhiTranslate="gatewayApp.babyBabyProfile.addNap"> Nap </span>
</a>
Expand Down Expand Up @@ -183,7 +183,11 @@ <h2 data-cy="babyProfileDetailsHeading">
<fa-icon icon="plus"></fa-icon>
<span class="d-none d-sm-inline" jhiTranslate="gatewayApp.babyBabyProfile.addWight"> Weight </span>
</a>
<button (click)="showHideLastWeightsDaysAgoGraphic()" class="btn btn-info btn-sm p-2 mt-1">
<button
(click)="showHideLastWeightsDaysAgoGraphic()"
[hidden]="hideLastWeightsDaysAgoGraphicIcon"
class="btn btn-info btn-sm p-2 mt-1"
>
<fa-icon icon="chart-area"></fa-icon>
</button>
</div>
Expand Down Expand Up @@ -220,7 +224,11 @@ <h4 class="nvd3-chart-title mobile">{{ d3ChartTranslate.last30Days }}</h4>
<fa-icon icon="plus"></fa-icon>
<span class="d-none d-sm-inline" jhiTranslate="gatewayApp.babyBabyProfile.addHight"> Height </span>
</a>
<button (click)="showHideLastHeightsDaysAgoGraphic()" class="btn btn-info btn-sm p-2 mt-1">
<button
(click)="showHideLastHeightsDaysAgoGraphic()"
[hidden]="hideLastHeightsDaysAgoGraphicIcon"
class="btn btn-info btn-sm p-2 mt-1"
>
<fa-icon icon="chart-area"></fa-icon>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { HeightService } from 'app/entities/baby/height/service/height.service';
import { HumorHistoryService } from 'app/entities/baby/humor-history/service/humor-history.service';
import { NapService } from 'app/entities/baby/nap/service/nap.service';
import { WeightService } from 'app/entities/baby/weight/service/weight.service';
import { IWeight } from 'app/entities/baby/weight/weight.model';
import { D3ChartService } from 'app/shared/d3-chart.service';
import * as dayjs from 'dayjs';
import { NvD3Component } from 'ng2-nvd3';
Expand All @@ -28,12 +29,14 @@ export class BabyProfileDetailComponent implements OnInit, AfterViewInit {
averageHumorHistoryLastCurrentWeek: any = {};
averageHumorHistoryOptions?: any;
averageHumorHistoryData?: any;
lastWeightsDaysAgo: any = {};
lastWeightsDaysAgo: IWeight[] = [];
lastWeightsDaysAgoOptions?: any;
lastWeightsDaysAgoData?: any;
hideLastWeightsDaysAgoGraphicIcon = false;
lastHeightsDaysAgo: any = {};
lastHeightsDaysAgoOptions?: any;
lastHeightsDaysAgoData?: any;
hideLastHeightsDaysAgoGraphicIcon = false;
latestWeight?: any;
latestHeight?: any;
favoriteNapPlace?: any;
Expand Down Expand Up @@ -219,13 +222,13 @@ export class BabyProfileDetailComponent implements OnInit, AfterViewInit {
}
}

isShowLastWeightsDaysAgoGraphic(lastWeightsDaysAgo: any): boolean {
return Object.keys(lastWeightsDaysAgo).length > 1;
isShowLastWeightsDaysAgoGraphic(lastWeightsDaysAgo: IWeight[]): boolean {
return lastWeightsDaysAgo.length > 1;
}

showHideLastWeightsDaysAgoGraphic(): void {
if (this.isShowLastWeightsDaysAgoGraphic(this.lastWeightsDaysAgo)) {
this.lastWeightsDaysAgo = {};
this.lastWeightsDaysAgo = [];
this.createLastWeightsDaysAgo();
} else {
this.weightService.lastWeightsByDaysByBabyProfile(this.babyProfile!.id!, 30).subscribe((res: HttpResponse<any>) => {
Expand Down Expand Up @@ -277,12 +280,20 @@ export class BabyProfileDetailComponent implements OnInit, AfterViewInit {
this.weightService.latestWeightByBabyProfile(id).subscribe((res: HttpResponse<any>) => {
this.latestWeight = res.body;
});
this.weightService.lastWeightsByDaysByBabyProfile(id, 30).subscribe((res: HttpResponse<any>) => {
const weights = res.body;
this.hideLastWeightsDaysAgoGraphicIcon = weights.length <= 1;
});
}

getHeightData(id: number): void {
this.heightService.latestHeightByBabyProfile(id).subscribe((res: HttpResponse<any>) => {
this.latestHeight = res.body;
});
this.heightService.lastHeightsByDaysByBabyProfile(id, 30).subscribe((res: HttpResponse<any>) => {
const heights = res.body;
this.hideLastHeightsDaysAgoGraphicIcon = heights.length <= 1;
});
}

byteSize(base64String: string): string {
Expand Down Expand Up @@ -411,7 +422,7 @@ export class BabyProfileDetailComponent implements OnInit, AfterViewInit {
{
values: weightValues,
key: this.d3ChartTranslate.weight,
color: '#ffeb3b',
color: 'rgb(252 145 78)',
area: true,
},
];
Expand All @@ -437,7 +448,7 @@ export class BabyProfileDetailComponent implements OnInit, AfterViewInit {
{
values: heightValues,
key: this.d3ChartTranslate.height,
color: '#ffeb3b',
color: 'rgb(153 255 81)',
area: true,
},
];
Expand Down

0 comments on commit c02f1f4

Please sign in to comment.