Skip to content

Commit

Permalink
Add empty welcome page
Browse files Browse the repository at this point in the history
Contributes to #28
  • Loading branch information
salah3x committed Jul 30, 2019
1 parent 98d1e5d commit 988c75b
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const routes: Routes = [
loadChildren: () =>
import('./auth/auth.module').then(m => m.AuthPageModule),
canActivate: [FirstVisitGuard]
},
{
path: 'welcome',
loadChildren: () =>
import('./welcome/welcome.module').then(m => m.WelcomePageModule)
}
];
@NgModule({
Expand Down
20 changes: 20 additions & 0 deletions src/app/welcome/welcome.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Routes, RouterModule } from '@angular/router';

import { IonicModule } from '@ionic/angular';

import { WelcomePage } from './welcome.page';

const routes: Routes = [
{
path: '',
component: WelcomePage
}
];

@NgModule({
imports: [CommonModule, IonicModule, RouterModule.forChild(routes)],
declarations: [WelcomePage]
})
export class WelcomePageModule {}
11 changes: 11 additions & 0 deletions src/app/welcome/welcome.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<ion-content>
<ion-slides pager="true" [options]="slideOpts">
<ion-slide>
<h1>Slide 1</h1>
</ion-slide>
<ion-slide>
<h1>Slide 2</h1>
<ion-button (click)="onStart()">Start</ion-button>
</ion-slide>
</ion-slides>
</ion-content>
3 changes: 3 additions & 0 deletions src/app/welcome/welcome.page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ion-slides {
height: 100%;
}
26 changes: 26 additions & 0 deletions src/app/welcome/welcome.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { WelcomePage } from './welcome.page';

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

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

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

it('should create', () => {
expect(component).toBeTruthy();
});
});
21 changes: 21 additions & 0 deletions src/app/welcome/welcome.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Plugins } from '@capacitor/core';

@Component({
selector: 'app-welcome',
templateUrl: './welcome.page.html',
styleUrls: ['./welcome.page.scss']
})
export class WelcomePage {
slideOpts = {
speed: 500
};

constructor(private router: Router) {}

async onStart() {
await Plugins.Storage.set({ key: 'visited', value: 'true' });
await this.router.navigate(['']);
}
}

0 comments on commit 988c75b

Please sign in to comment.