-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ft-server-translations
- Loading branch information
Showing
18 changed files
with
709 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import { marker as translateMarker } from '@biesbjerg/ngx-translate-extract-marker'; | ||
import type { ITourStep } from '@picsa/shared/services/core/tour'; | ||
import { _wait } from '@picsa/utils'; | ||
|
||
/** | ||
* Example tour to select a site from list | ||
* Includes route listeners to automatically trigger table tour once table loaded | ||
*/ | ||
export const BUDGET_CREATE_TOUR: ITourStep[] = [ | ||
{ | ||
text: 'Welcome to the budget tool tour. We will first show the main features and then create a new tour', | ||
}, | ||
{ | ||
id: 'create', | ||
text: 'New budgets ', | ||
|
||
tourOptions: { | ||
showBullets: false, | ||
showButtons: false, | ||
}, | ||
// Resume the tour once the user has navigated to a station | ||
routeEvents: { | ||
handler: ({ queryParams }, service) => { | ||
if (queryParams.stationId) { | ||
_wait(500).then(() => { | ||
service.startTour(BUDGET_TABLE_TOUR); | ||
}); | ||
return true; | ||
} | ||
return false; | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
/** | ||
* Example tour to interact with crop probability table | ||
* Steps are independent of station select tour to make it easier to handle tables that | ||
* will be loaded dynamically | ||
*/ | ||
export const BUDGET_TABLE_TOUR: ITourStep[] = [ | ||
{ | ||
customElement: { | ||
selector: 'section.table-container', | ||
}, | ||
text: translateMarker( | ||
'In the crop information table, you will be able to see the probabilities for different crops through the different seasons.' | ||
), | ||
}, | ||
|
||
{ | ||
id: 'season-start', | ||
text: translateMarker( | ||
'Crop probabilities depend on when the season starts.\nHere you can see the probabilities of the season starting at different dates' | ||
), | ||
}, | ||
{ | ||
customElement: { | ||
selector: 'tr[mat-header-row]:last-of-type', | ||
}, | ||
text: translateMarker( | ||
'Each row contains information about crop, variety, days to maturity and water requirement. Probabilities of receiving requirements are shown for different planting dates' | ||
), | ||
}, | ||
{ | ||
customElement: { | ||
autoScroll: false, | ||
selector: 'tbody>tr>td:nth-of-type(2)', | ||
}, | ||
text: translateMarker('Here we can see information for a specific crop variety'), | ||
}, | ||
{ | ||
customElement: { | ||
autoScroll: false, | ||
selector: 'tbody>tr>td:nth-of-type(3)', | ||
}, | ||
text: translateMarker('This is the number of days to maturity for the variety'), | ||
}, | ||
{ | ||
customElement: { | ||
autoScroll: false, | ||
selector: 'tbody>tr>td:nth-of-type(4)', | ||
}, | ||
text: translateMarker('This is water requirement for the variety'), | ||
}, | ||
{ | ||
customElement: { | ||
autoScroll: false, | ||
selector: 'tbody>tr>td:nth-of-type(5)', | ||
}, | ||
text: translateMarker( | ||
'The maturity and water requirements can be used to calculate the chance of satisfying these conditions for a specific planting date' | ||
), | ||
}, | ||
{ | ||
customElement: { | ||
selector: 'crop-probability-crop-select', | ||
}, | ||
text: translateMarker('The crop filter shows more information for specific crops'), | ||
}, | ||
{ | ||
text: translateMarker('Now you are ready to explore the crop information tool'), | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
apps/picsa-tools/crop-probability-tool/src/app/pages/home/home.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
.tour-button { | ||
picsa-tour-button { | ||
margin-left: auto; | ||
margin-right: 8px; | ||
min-height: 48px; | ||
padding: 4px; | ||
} | ||
.tour-icon { | ||
border: 1px solid var(--color-primary); | ||
border-radius: 50%; | ||
padding: 4px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './tour-button.component'; | ||
export * from './tour.service'; | ||
export type { ITourStep } from './tour.types'; |
50 changes: 50 additions & 0 deletions
50
libs/shared/src/services/core/tour/tour-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
|
||
import { PicsaTranslateModule } from '../../../modules/translate'; | ||
import { TourService } from './tour.service'; | ||
|
||
/** | ||
* Help button which, when clicked triggers start of tour with id as provided. | ||
* NOTE - tourId must first be registered with tour service to be available | ||
*/ | ||
@Component({ | ||
selector: 'picsa-tour-button', | ||
template: ` <button mat-button class="tour-button" color="primary" (click)="startTour()"> | ||
<mat-icon class="tour-icon mat-elevation-z4">question_mark</mat-icon> | ||
<span>{{ 'Demo' | translate }}</span> | ||
</button>`, | ||
standalone: true, | ||
imports: [CommonModule, MatIconModule, MatButtonModule, PicsaTranslateModule], | ||
styles: [ | ||
` | ||
:host { | ||
display: block; | ||
} | ||
.tour-button { | ||
min-height: 48px; | ||
padding: 4px; | ||
} | ||
.tour-icon { | ||
border: 1px solid var(--color-primary); | ||
border-radius: 50%; | ||
padding: 4px; | ||
} | ||
`, | ||
], | ||
}) | ||
export class PicsaTourButton implements OnInit { | ||
@Input() tourId: string; | ||
constructor(private service: TourService) {} | ||
|
||
ngOnInit() {} | ||
|
||
public startTour() { | ||
if (!this.tourId) { | ||
throw new Error(`No tourId provided to component`); | ||
} | ||
this.service.startTourById(this.tourId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.