changed page names for automatic routing

This commit is contained in:
Ryan Bakkes 2022-01-04 04:09:19 +01:00
parent b7fdeddc9c
commit adbe142ffc
9 changed files with 28 additions and 24 deletions

View File

@ -11,8 +11,8 @@ const routes: Routes = [
loadChildren: () => import('./beliefs/beliefs.module').then( m => m.BeliefsPageModule)
},
{
path: 'values',
loadChildren: () => import('./values/values.module').then( m => m.ValuesPageModule)
path: 'valuesSorting',
loadChildren: () => import('./valuesSorting/valuesSorting.module').then( m => m.ValuesSortingPageModule)
},
{
path: 'valuesAlign',

View File

@ -76,8 +76,10 @@ export class ModalsGamePage {
break;
case "Values":
await this.game.initValuesGame();
break;
const status = await this.game.initValuesGame();
console.log(`/${game.toLowerCase()}${status}`);
this.router.navigateByUrl(`/${game.toLowerCase()}${status}`);
return;
}
// routing is in lowercase, set text to lower

View File

@ -43,7 +43,7 @@ export class GameService {
// if (data["Status"] == "Success") {
// console.log(data["Data"]);
await this.storage.set(`${game.toUpperCase()}GAME_TOKEN`, { status: "sorting", cards:[{"title":"Temp_card_1"}, {"title":"Temp_card_2"}, {"title":"Temp_card_3"}, {"title":"Temp_card_4"}, {"title":"Temp_card_5"}, {"title":"Temp_card_6"}, {"title":"Temp_card_7"}, {"title":"Temp_card_8"}]});
await this.storage.set(`${game.toUpperCase()}GAME_TOKEN`, { status: "Sorting", cards:[{"title":"Temp_card_1"}, {"title":"Temp_card_2"}, {"title":"Temp_card_3"}, {"title":"Temp_card_4"}, {"title":"Temp_card_5"}, {"title":"Temp_card_6"}, {"title":"Temp_card_7"}, {"title":"Temp_card_8"}]});
// }
// return data;
// }),
@ -53,8 +53,10 @@ export class GameService {
public async initValuesGame(){
console.log("[GameService] Initializing Value game...");
this.cardset = await this.storage.get("VALUESGAME_TOKEN");
console.log(this.cardset["cards"]);
this.cardset = this.cardset["cards"];
const token = await this.storage.get("VALUESGAME_TOKEN");
// console.log(this.cardset["cards"]);
this.cardset = token["cards"];
return token["status"];
}
}

View File

@ -1,11 +1,11 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { ValuesPage } from './values.page';
import { ValuesSortingPage } from './valuesSorting.page';
const routes: Routes = [
{
path: '',
component: ValuesPage,
component: ValuesSortingPage,
}
];
@ -13,4 +13,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ValuesPageRoutingModule {}
export class ValuesSortingPageRoutingModule {}

View File

@ -2,9 +2,9 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';
import { ValuesPage } from './values.page';
import { ValuesSortingPage } from './valuesSorting.page';
import { ValuesPageRoutingModule } from './values-routing.module';
import { ValuesSortingPageRoutingModule } from './valuesSorting-routing.module';
@NgModule({
@ -12,8 +12,8 @@ import { ValuesPageRoutingModule } from './values-routing.module';
CommonModule,
FormsModule,
IonicModule,
ValuesPageRoutingModule
ValuesSortingPageRoutingModule
],
declarations: [ValuesPage]
declarations: [ValuesSortingPage]
})
export class ValuesPageModule {}
export class ValuesSortingPageModule {}

View File

@ -1,19 +1,19 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ValuesPage } from './values.page';
import { ValuesSortingPage } from './valuesSorting.page';
describe('HomePage', () => {
let component: ValuesPage;
let fixture: ComponentFixture<ValuesPage>;
let component: ValuesSortingPage;
let fixture: ComponentFixture<ValuesSortingPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ValuesPage ],
declarations: [ ValuesSortingPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ValuesPage);
fixture = TestBed.createComponent(ValuesSortingPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));

View File

@ -6,10 +6,10 @@ import { GameService } from '../services/game.service';
@Component({
selector: 'app-home',
templateUrl: 'values.page.html',
styleUrls: ['values.page.scss'],
templateUrl: 'valuesSorting.page.html',
styleUrls: ['valuesSorting.page.scss'],
})
export class ValuesPage {
export class ValuesSortingPage {
@ViewChildren('card') cards: QueryList<ElementRef>;
cardsArray: Array<ElementRef>;