-
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 pull request #173 from e-picsa/ft-homepage-intro
Homepage guided tour
- Loading branch information
Showing
13 changed files
with
192 additions
and
15 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
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
32 changes: 32 additions & 0 deletions
32
apps/picsa-apps/extension-app/src/app/pages/home/home.tour.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,32 @@ | ||
import type { ITourStep } from '@picsa/shared/services/core/tour.service'; | ||
|
||
export const HOME_TOUR: ITourStep[] = [ | ||
{ | ||
id: 'manual', | ||
text: 'This is the EPICSA Manual. A step-by-step guide to using PICSA with farmers.', | ||
}, | ||
{ | ||
id: 'resources', | ||
text: 'This is where you’ll find helpful resources that will guide your work.', | ||
}, | ||
{ | ||
id: 'monitoring', | ||
text: 'In here, field staff can make records of visits with farmers and provide data on everything they monitored.', | ||
}, | ||
{ | ||
id: 'climate', | ||
text: 'This is the climate tool which provides automatically updated, locally specific climate information graphs. A way for you to analyse the changing climate in your region.', | ||
}, | ||
{ | ||
id: 'budget', | ||
text: 'This budget tool is fully interactive and provides a way for farmers to make extensive budgets with respect to different options in their agro-businesses.', | ||
}, | ||
{ | ||
id: 'crop-probability', | ||
text: 'This is the crop-probability tool. It provides immediate calculations on which crops and varieties have the best chance to succeed, according to regions.', | ||
}, | ||
{ | ||
id: 'option', | ||
text: 'This is the options tool that supports farmers to consider a range of options aimed at increasing production, income and resilience.', | ||
}, | ||
]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,41 @@ | ||
import { Injectable } from '@angular/core'; | ||
import introJs, { IntroJs, Options, Step } from 'intro.js'; | ||
|
||
export interface ITourStep extends Omit<Step, 'intro'> { | ||
id: string; | ||
text: string; | ||
} | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
/** | ||
* Interact with Intro.JS tours | ||
*/ | ||
export class TourService { | ||
private intro: IntroJs; | ||
constructor() { | ||
this.intro = introJs(); | ||
} | ||
|
||
public startTour(tourSteps: ITourStep[], tourOptions: Partial<Options> = {}): void { | ||
// map passed tourId to data attribute selector | ||
const steps = tourSteps.map((step) => { | ||
const mappedStep: Step = { | ||
...step, | ||
element: `[data-tour-id="${step.id}"]`, | ||
intro: step.text, | ||
}; | ||
return mappedStep; | ||
}); | ||
console.log('starting tour', steps); | ||
|
||
this.intro | ||
.setOptions({ | ||
hidePrev: true, | ||
exitOnOverlayClick: false, | ||
tooltipClass: 'picsa-tooltip', | ||
steps, | ||
...tourOptions, | ||
}) | ||
.start(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
libs/shared/src/services/promptToHomePageService.service.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,17 @@ | ||
// Service to facilitate communication between the app-open-prompt and homepage | ||
|
||
import { Injectable } from '@angular/core'; | ||
import { Subject } from 'rxjs'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class CommunicationService { | ||
private userEventSubject = new Subject<void>(); | ||
|
||
userEvent$ = this.userEventSubject.asObservable(); | ||
|
||
triggerUserEvent(): void { | ||
this.userEventSubject.next(); | ||
} | ||
} |
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
Oops, something went wrong.