Skip to content
Snippets Groups Projects
Commit 8005d999 authored by fsdavid's avatar fsdavid
Browse files

Quick tour review fixes

parent 88a7eaed
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ import { ComponentPortal } from "@angular/cdk/portal";
import { QuickTourThis } from "./quickTourThis.directive";
import { DoublyLinkedList, IDoublyLinkedItem } from 'src/util'
import { QUICK_TOUR_CMP_INJTKN } from "./constrants";
import {LOCAL_STORAGE_CONST} from "src/util/constants";
export function findInLinkedList<T extends object>(first: IDoublyLinkedItem<T>, predicate: (linkedObj: IDoublyLinkedItem<T>) => boolean): IDoublyLinkedItem<T>{
let compareObj = first,
......@@ -62,6 +63,13 @@ export class QuickTourService {
this.slides.remove(dir)
}
public autoStart() {
if (!localStorage.getItem(LOCAL_STORAGE_CONST.QUICK_TOUR_VIEWED)) {
this.startTour()
localStorage.setItem(LOCAL_STORAGE_CONST.QUICK_TOUR_VIEWED, 'true')
}
}
public startTour() {
if (!this.overlayRef) {
this.overlayRef = this.overlay.create({
......@@ -70,14 +78,14 @@ export class QuickTourService {
hasBackdrop: true,
backdropClass: ['pe-none', 'cdk-overlay-dark-backdrop'],
positionStrategy: this.overlay.position().global(),
})
})
}
if (!this.cmpRef) {
this.cmpRef = this.overlayRef.attach(
new ComponentPortal(this.quickTourCmp)
)
this.currActiveSlide = this.slides.first
this.currentTip$.next(this.currActiveSlide)
}
......
......@@ -33,10 +33,7 @@ export class QuickTourThis implements OnInit, OnChanges, OnDestroy {
this.quickTourService.register(this)
if (this.quickTourCheckAutoStart) {
if (!localStorage.getItem(LOCAL_STORAGE_CONST.QUICK_TOUR_VIEWED)) {
this.quickTourService.startTour()
localStorage.setItem(LOCAL_STORAGE_CONST.QUICK_TOUR_VIEWED, 'true')
}
this.quickTourService.autoStart()
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment