Skip to content

Commit

Permalink
Added coffee-bloom / first drop timer to brew-add.
Browse files Browse the repository at this point in the history
Also added new icon
Rating changed to -1/0
  • Loading branch information
graphefruit committed Feb 4, 2020
1 parent b519f69 commit 57c2bfd
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 15 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- Jump directly from homescreen to brew/grinders/preparation etc
- Added roaster name for bean selection aswell as display on brew / bean overview
- Visually enhanchements on brew overview
- Rating changed to -1/0. -1 means - not rated
- Changed brew-add added blooming-time aswell as first drip time as button to own timer.


Issues fixed:
- Forcetouch on iOS didn't work and just displayed home page
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ ion-icon {
&[class*="custom-coffee-beans"] {
mask-image: url(../assets/svg/coffee-beans.svg);
}

&[class*="custom-coffee-blooming"] {
mask-image: url(../assets/svg/coffee-blooming.svg);
}
}

.position-absolute-button {
Expand Down
22 changes: 15 additions & 7 deletions src/app/brew/brew-add/brew-add.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@
<timer #brewTemperatureTime label="{{'BREW_DATA_TEMPERATURE_TIME' | translate}}" timeInSeconds="0"
*ngIf="settings.brew_temperature_time === true"></timer>

<timer #timer (timerTicked)="brewTimeTicked($event)" label="{{'BREW_DATA_TIME' | translate}}" timeInSeconds="0"
*ngIf="settings.brew_time === true"></timer>
<brew-timer #timer
(bloomTimer)="setCoffeeBloomingTime($event)"
(dripTimer)="setCoffeeDripTime($event)"
(timerTicked)="brewTimeTicked($event)"
*ngIf="settings.brew_time === true"
[bloomTimerVisible]="settings.coffee_blooming_time"

[dripTimerVisible]="settings.coffee_first_drip_time"
label="{{'BREW_DATA_TIME' | translate}}"
timeInSeconds="0"></brew-timer>

<ion-item *ngIf="settings.brew_time === true && settings.coffee_first_drip_time === true" lines="full">
<ion-label>
Expand All @@ -72,16 +80,16 @@
<ion-item *ngIf="settings.coffee_blooming_time === true">
<ion-label stacked>{{"BREW_DATA_COFFEE_BLOOMING_TIME" | translate}}</ion-label>
<ion-input remove-empty-number prevent-characters [(ngModel)]="data.coffee_blooming_time" type="text"></ion-input>
<ion-button (click)="setCoffeeBloomingTime()" fill="outline" size="default" slot="end">
<!--<ion-button (click)="setCoffeeBloomingTime()" fill="outline" size="default" slot="end">
<ion-icon name="time"></ion-icon>
</ion-button>
</ion-button>-->
</ion-item>
<ion-item *ngIf="settings.coffee_first_drip_time === true">
<ion-label stacked>{{"BREW_DATA_COFFEE_FIRST_DRIP_TIME" | translate}}</ion-label>
<ion-input remove-empty-number prevent-characters [(ngModel)]="data.coffee_first_drip_time" type="text"></ion-input>
<ion-button (click)="setCoffeeDripTime()" fill="outline" size="default" slot="end">
<!--<ion-button (click)="setCoffeeDripTime()" fill="outline" size="default" slot="end">
<ion-icon name="time"></ion-icon>
</ion-button>
</ion-button>-->
</ion-item>
<ion-row *ngIf="settings.brew_quantity === true">
<ion-col class="ion-no-padding" col-8 col-sm-10>
Expand Down Expand Up @@ -111,7 +119,7 @@
</ion-item>
<ion-item *ngIf="settings.rating === true">
<ion-label stacked>{{"BREW_DATA_RATING" | translate }}</ion-label>
<ion-range [(ngModel)]="data.rating" debounce="500s" max="10" min="1" snaps="true" step="1">
<ion-range [(ngModel)]="data.rating" debounce="500s" max="10" min="-1" snaps="true" step="1">
<ion-icon name="sad" size="small" slot="start"></ion-icon>
<ion-icon name="happy" size="small" slot="end"></ion-icon>
</ion-range>
Expand Down
6 changes: 4 additions & 2 deletions src/app/brew/brew-add/brew-add.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ export class BrewAddComponent implements OnInit {
return 0;
}

public setCoffeeDripTime(): void {
public setCoffeeDripTime($event): void {
console.log($event);
this.data.coffee_first_drip_time = this.getTime();
}

public setCoffeeBloomingTime(): void {
public setCoffeeBloomingTime($event): void {
console.log($event);
this.data.coffee_blooming_time = this.getTime();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/brew/brew-edit/brew-edit.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<ion-item *ngIf="showRating()">
<ion-label stacked>{{"BREW_DATA_RATING" | translate }}
</ion-label>
<ion-range [(ngModel)]="data.rating" debounce="500s" max="10" min="1" snaps="true" step="1">
<ion-range [(ngModel)]="data.rating" debounce="500s" max="10" min="-1" snaps="true" step="1">
<ion-icon name="sad" size="small" slot="start"></ion-icon>
<ion-icon name="happy" size="small" slot="end"></ion-icon>
</ion-range>
Expand Down
4 changes: 2 additions & 2 deletions src/app/info/about/about.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
<ion-item>
<ion-icon name="ios-information-circle-outline" item-left></ion-icon>
<div class="white-space-normal">
GNU General Public License v3.0
&nbsp;GNU General Public License v3.0
</div>
</ion-item>
<ion-item>
<ion-icon item-left name="ios-help-buoy"></ion-icon>
<div>{{versionStr}}</div>
<div>&nbsp;{{versionStr}}</div>
</ion-item>
</ion-list>
</ion-card>
Expand Down
5 changes: 5 additions & 0 deletions src/app/info/credits/credits.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export class CreditsComponent implements OnInit {
TITLE: 'Loading Coffee',
LINK: 'https://icons8.com/preloaders',
DESCRIPTION: `https://icons8.com/preloaders/en/terms_of_use`
},
'ion-coffee-blooming': {
TITLE: 'Coffee blooming',
LINK: 'https://www.flaticon.com/packs/coffee-9',
DESCRIPTION: `<div>Icons made by <a (click)="openLink($event,'https://www.flaticon.com/authors/good-ware')" href="https://www.flaticon.com/authors/good-ware" title="Good Ware">Good Ware</a> from <a (click)="openLink($event,'https://www.flaticon.com/')" href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>`
}
};

Expand Down
7 changes: 4 additions & 3 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {BrewPopoverComponent} from '../brew/brew-popover/brew-popover.component'
import {BrewTableComponent} from '../brew/brew-table/brew-table.component';
import {BrewTextComponent} from '../brew/brew-text/brew-text.component';
import {TimerComponent} from '../../components/timer/timer.component';
import {BrewTimerComponent} from '../../components/brew-timer/brew-timer.component';
import {FormsModule} from '@angular/forms';
import {MillPage} from '../mill/mill.page';
import {MillEditComponent} from '../mill/mill-edit/mill-edit.component';
Expand Down Expand Up @@ -70,7 +71,7 @@ import {AppVersion} from '@ionic-native/app-version/ngx';
PreparationEditComponent, MillPage, MillEditComponent, MillAddComponent, BrewAddComponent,
FormatDatePipe, KeysPipe, AsyncImageComponent, SearchPipe, RemoveEmptyNumberDirective,
PreventCharacterDirective, BrewPage, BrewDetailComponent, BrewEditComponent, BrewPhotoViewComponent,
BrewPopoverComponent, BrewPopoverActionsComponent, BrewTableComponent, BrewTextComponent, TimerComponent],
BrewPopoverComponent, BrewPopoverActionsComponent, BrewTableComponent, BrewTextComponent, TimerComponent, BrewTimerComponent],
entryComponents: [SettingsPage, StatisticPage, HomePage, BeansPage, BeansAddComponent, BeansEditComponent, AboutComponent,
ContactComponent,
CreditsComponent,
Expand All @@ -80,7 +81,7 @@ import {AppVersion} from '@ionic-native/app-version/ngx';
ThanksComponent, LogComponent, LogTextComponent, PreparationPage,
PreparationAddComponent, PreparationEditComponent, MillPage, MillEditComponent,
MillAddComponent, BrewAddComponent, BrewPage, BrewDetailComponent, BrewEditComponent,
BrewPhotoViewComponent, BrewPopoverComponent, BrewPopoverActionsComponent, BrewTableComponent, BrewTextComponent, TimerComponent],
BrewPhotoViewComponent, BrewPopoverComponent, BrewPopoverActionsComponent, BrewTableComponent, BrewTextComponent, TimerComponent, BrewTimerComponent],
imports: [
CommonModule,
IonicModule,
Expand Down Expand Up @@ -116,7 +117,7 @@ import {AppVersion} from '@ionic-native/app-version/ngx';
BrewAddComponent, FormatDatePipe,
KeysPipe, AsyncImageComponent, SearchPipe, RemoveEmptyNumberDirective,
PreventCharacterDirective, BrewPage, BrewDetailComponent, BrewEditComponent,
BrewPhotoViewComponent, BrewPopoverComponent, BrewPopoverActionsComponent, BrewTableComponent, BrewTextComponent, TimerComponent],
BrewPhotoViewComponent, BrewPopoverComponent, BrewPopoverActionsComponent, BrewTableComponent, BrewTextComponent, TimerComponent, BrewTimerComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SharedModule {
Expand Down
89 changes: 89 additions & 0 deletions src/assets/svg/coffee-blooming.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions src/components/brew-timer/brew-timer.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<ion-item class="no-bottom-border item">
<ion-label stacked>{{ label }}</ion-label>
<ion-input [(ngModel)]="timer.seconds" prevent-characters type="number"></ion-input>
<ion-button (click)="initTimer()"
*ngIf="!timer.runTimer && (timer.hasStarted || timer.hasFinished) || timer.hasFinished" fill="outline"
size="default"
slot="end">
<ion-icon name="refresh"></ion-icon>

</ion-button>
<ion-button (click)="bloomTime()" *ngIf="timer.runTimer && timer.hasStarted && !timer.hasFinished && showBloomTimer"
fill="outline" size="default"
slot="end">
<ion-icon class="custom-coffee-blooming"></ion-icon>
</ion-button>
<ion-button (click)="dripTime()" *ngIf="timer.runTimer && timer.hasStarted && !timer.hasFinished && showDripTimer"
fill="outline" size="default"
slot="end">
<ion-icon name="ios-water"></ion-icon>
</ion-button>
<ion-button (click)="pauseTimer()" *ngIf="timer.runTimer && timer.hasStarted && !timer.hasFinished" fill="outline"
size="default"
slot="end">
<ion-icon name="pause"></ion-icon>

</ion-button>


<ion-button (click)="resumeTimer()" *ngIf="!timer.runTimer && timer.hasStarted && !timer.hasFinished" fill="outline"
size="default"
slot="end">
<ion-icon name="play"></ion-icon>

</ion-button>
<ion-button (click)="startTimer()" *ngIf="!timer.hasStarted" fill="outline" size="default"
slot="end">
<ion-icon name="play"></ion-icon>
</ion-button>
</ion-item>

14 changes: 14 additions & 0 deletions src/components/brew-timer/brew-timer.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:host {
.brew-image img {
max-width: 50%;
max-height: 200px;
}

ion-button.circle-button {
--border-radius: 100%;
height: 65px;
width: 65px;

}
}

27 changes: 27 additions & 0 deletions src/components/brew-timer/brew-timer.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';

import {BrewTimerComponent} from './brew-timer.component';

describe('BrewTimerComponent', () => {
let component: BrewTimerComponent;
let fixture: ComponentFixture<BrewTimerComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [BrewTimerComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(BrewTimerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 57c2bfd

Please sign in to comment.