Skip to content

Commit

Permalink
#851 - Added pressure-profile check
Browse files Browse the repository at this point in the history
  • Loading branch information
graphefruit committed Dec 11, 2024
1 parent 3fe3d01 commit 9ea82de
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/brew/brew-detail/brew-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ <h3>{{data | brewFunctionPipe: BREW_FUNCTION_PIPE_ENUM.FORMATTED_TOTAL_MILL_TIME
<h2>{{"BREW_DATA_PRESSURE_PROFILE" | translate}}:</h2>
<h3>{{data.pressure_profile}}</h3>
</ion-label>
<ion-button *ngIf="(data | brewFunctionPipe : BREW_FUNCTION_PIPE_ENUM.IS_PRESSURE_PARAMETER_URL)" style="margin-left:0px;" (click)="openURL(data.pressure_profile)"
tabIndex="1" class="big-icon-only" fill="clear" slot="end" tappable>
<ion-icon class="ion-color-accent" name="globe-outline" slot="icon-only"></ion-icon>
</ion-button>
</ion-item>
<ion-item *ngIf="(settings | brewFieldVisiblePipe: [settings.manage_parameters.method_of_preparation_tool,
choosenPreparation.manage_parameters.method_of_preparation_tool,
Expand Down
5 changes: 5 additions & 0 deletions src/app/brew/brew-detail/brew-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export class BrewDetailComponent {
this.uiShowSectionBeforeBrew = this.showSectionBeforeBrew();
this.uiShowCupping = this.showCupping();
}
public openURL(_url) {
if (_url) {
this.uiHelper.openExternalWebpage(_url);
}
}

public async ionViewDidEnter() {
this.uiAnalytics.trackEvent(
Expand Down
4 changes: 4 additions & 0 deletions src/components/brews/brew-brewing/brew-brewing.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
[(ngModel)]="data.pressure_profile" autocapitalize="sentences"
placeholder="{{'BREW.PLACE_HOLDER.BREW_DATA_PRESSURE_PROFILE' | translate}}" spellcheck="false"
type="text"></ion-input>
<ion-button *ngIf="(data | brewFunctionPipe: BREW_FUNCTION_PIPE_ENUM.IS_PRESSURE_PARAMETER_URL)" style="margin-left:0px;" (click)="openURL(data.pressure_profile)"
tabIndex="1" class="big-icon-only" fill="clear" slot="end" tappable>
<ion-icon class="ion-color-accent" name="globe-outline" slot="icon-only"></ion-icon>
</ion-button>
</ion-item>
<ion-item *ngIf="searchResultsAvailable('pressure_profile')" [style.order]="(settings | brewFieldOrderPipe: [settings.brew_order.before.pressure_profile,
choosenPreparation.brew_order.before.pressure_profile,
Expand Down
5 changes: 5 additions & 0 deletions src/components/brews/brew-brewing/brew-brewing.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ export class BrewBrewingComponent implements OnInit, AfterViewInit {
private readonly hapticService: HapticService,
) {}

public openURL(_url) {
if (_url) {
this.uiHelper.openExternalWebpage(_url);
}
}
public setUIParams() {
this.uiShowSectionAfterBrew = this.showSectionAfterBrew();
this.uiShowSectionWhileBrew = this.showSectionWhileBrew();
Expand Down
1 change: 1 addition & 0 deletions src/enums/brews/brewFunctionPipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export enum BREW_FUNCTION_PIPE_ENUM {
GET_WATER_NAME = 'GET_WATER_NAME',
HAS_CUSTOM_FLAVORS = 'HAS_CUSTOM_FLAVORS',
HAS_PREDEFINED_FLAVORS = 'HAS_PREDEFINED_FLAVORS',
IS_PRESSURE_PARAMETER_URL = 'IS_PRESSURE_PARAMETER_URL',
}
4 changes: 3 additions & 1 deletion src/pipes/brew/brewFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BREW_FUNCTION_PIPE_ENUM } from '../../enums/brews/brewFunctionPipe';
export class BrewFunction implements PipeTransform {
public transform(
value: Brew,
arg: BREW_FUNCTION_PIPE_ENUM | Array<BREW_FUNCTION_PIPE_ENUM | any>
arg: BREW_FUNCTION_PIPE_ENUM | Array<BREW_FUNCTION_PIPE_ENUM | any>,
): any {
try {
let action;
Expand Down Expand Up @@ -55,6 +55,8 @@ export class BrewFunction implements PipeTransform {
return value.hasCustomFlavors();
case BREW_FUNCTION_PIPE_ENUM.HAS_PREDEFINED_FLAVORS:
return value.hasPredefinedFlavors();
case BREW_FUNCTION_PIPE_ENUM.IS_PRESSURE_PARAMETER_URL:
return value.pressure_profile.startsWith('http');
}
} catch (ex) {}
}
Expand Down

0 comments on commit 9ea82de

Please sign in to comment.