Commit a0345846 by Nabil Sadki

Merge branch 'v1.1.0.0' into v1.1.5.0

parents c52c3892 0f9502d8
...@@ -2,6 +2,7 @@ v1.1.0.0 ...@@ -2,6 +2,7 @@ v1.1.0.0
- Add login form - Add login form
- Optimise launch time - Optimise launch time
- Fix presentation slider skip transition - Fix presentation slider skip transition
- Optimise offers list loading
v1.0.8.3 v1.0.8.3
- Show main slide - Show main slide
......
...@@ -13,22 +13,45 @@ ...@@ -13,22 +13,45 @@
<ion-refresher (ionRefresh)="doRefresh($event)"> <ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content></ion-refresher-content> <ion-refresher-content></ion-refresher-content>
</ion-refresher> </ion-refresher>
<div *ngIf="_TRIP.filtredProducts.length <= 0">
<ion-card class="skeleton" tappable no-margin margin-bottom>
<ion-skeleton-text class="img" animated></ion-skeleton-text>
<ion-card-header>
<ion-card-subtitle color="primary">
<ion-skeleton-text style="width: 80%" animated></ion-skeleton-text>
</ion-card-subtitle>
<ion-card-title>
<ion-skeleton-text style="height: 20px" animated></ion-skeleton-text>
</ion-card-title>
</ion-card-header>
<!-- <ion-card class="top-card" no-margin> <ion-card-content no-padding padding-horizontal padding-bottom>
<ion-card-content no-padding> <ion-skeleton-text style="width: 80%" animated></ion-skeleton-text>
<ion-item lines="none"> <ion-skeleton-text animated></ion-skeleton-text>
<ion-label class="text-1x bold text-primary">Catégories</ion-label> <ion-skeleton-text style="width: 80%" animated></ion-skeleton-text>
<ion-select cancelText="Fermer" class="text-primary" [(ngModel)]="terms" (ionChange)="onContextChange($event.id)"> <ion-skeleton-text style="width: 50%" animated></ion-skeleton-text>
<ion-select-option value="all">- Tout -</ion-select-option>
<ion-select-option *ngFor="let category of _TRIP.cats" [value]="category.id">
{{ category.label }}
</ion-select-option>
</ion-select>
</ion-item>
</ion-card-content> </ion-card-content>
</ion-card> --> </ion-card>
<!--list of trips--> <ion-card class="skeleton" tappable no-margin margin-bottom>
<ion-card *ngFor="let trip of _TRIP.filtredProducts" (click)="viewDetail(trip.id)" tappable no-margin margin-bottom> <ion-skeleton-text class="img" animated></ion-skeleton-text>
<ion-card-header>
<ion-card-subtitle color="primary">
<ion-skeleton-text style="width: 80%" animated></ion-skeleton-text>
</ion-card-subtitle>
<ion-card-title>
<ion-skeleton-text style="height: 20px" animated></ion-skeleton-text>
</ion-card-title>
</ion-card-header>
<ion-card-content no-padding padding-horizontal padding-bottom>
<ion-skeleton-text style="width: 80%" animated></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text style="width: 80%" animated></ion-skeleton-text>
<ion-skeleton-text style="width: 50%" animated></ion-skeleton-text>
</ion-card-content>
</ion-card>
</div>
<ion-card *ngFor="let trip of _TRIP.offersCardList" (click)="viewDetail(trip.id)" tappable no-margin margin-bottom>
<div class="img-spinner-wrap ion-text-center"> <div class="img-spinner-wrap ion-text-center">
<ion-spinner name="dots" *ngIf="trip.hidden"></ion-spinner> <ion-spinner name="dots" *ngIf="trip.hidden"></ion-spinner>
</div> </div>
...@@ -69,4 +92,9 @@ ...@@ -69,4 +92,9 @@
</ion-item> </ion-item>
</ion-card> </ion-card>
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)">
<ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="Chargement...">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
</ion-content> </ion-content>
\ No newline at end of file
.dashboard { .dashboard {
ion-card { ion-card {
ion-skeleton-text.img {
margin: 0 !important;
min-height: 160px;
}
ion-badge { ion-badge {
float: right; float: right;
margin-top: -36px; margin-top: -36px;
...@@ -23,50 +27,51 @@ ...@@ -23,50 +27,51 @@
} }
} }
} }
} }
.no-visibility { .no-visibility {
visibility: hidden; visibility: hidden;
} }
.img-spinner-wrap { .img-spinner-wrap {
position: absolute; position: absolute;
width: 100%; width: 100%;
min-height: 10rem; min-height: 10rem;
padding-top: 4.5rem; padding-top: 4.5rem;
} }
div[scrollx=true], div[scrolly=true] { div[scrollx="true"],
div[scrolly="true"] {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
::-webkit-scrollbar { ::-webkit-scrollbar {
display: none; display: none;
} }
} }
div[scrollx=true] { div[scrollx="true"] {
overflow-x: auto; overflow-x: auto;
} }
div[scrolly=true] { div[scrolly="true"] {
overflow-y: auto; overflow-y: auto;
} }
.app { .app {
padding: 0; padding: 0;
display: grid; display: grid;
grid-gap: 20px 0; grid-gap: 20px 0;
// grid-template-columns: 20px 1fr 20px; // grid-template-columns: 20px 1fr 20px;
align-content: start; align-content: start;
} }
.app > * { .app > * {
grid-column: 2 / -2; grid-column: 2 / -2;
} }
.app > .full { .app > .full {
grid-column: 1 / -1; grid-column: 1 / -1;
} }
.hs { .hs {
display: grid; display: grid;
// grid-gap: calc(20px / 2); // grid-gap: calc(20px / 2);
grid-template-columns: repeat(9999999, auto); grid-template-columns: repeat(9999999, auto);
...@@ -76,29 +81,28 @@ ...@@ -76,29 +81,28 @@
scroll-snap-type: x proximity; scroll-snap-type: x proximity;
// padding-bottom: calc(.75 * 20px); // padding-bottom: calc(.75 * 20px);
// margin-bottom: calc(-.25 * 20px); // margin-bottom: calc(-.25 * 20px);
} }
/* Demo styles */ /* Demo styles */
ion-content { ion-content {
display: grid; display: grid;
place-items: center; place-items: center;
// background: #456173; // background: #456173;
} }
ul { ul {
list-style: none; list-style: none;
padding: 0; padding: 0;
} }
.app { .app {
// background: #DBD0BC; // background: #DBD0BC;
overflow-y: scroll; overflow-y: scroll;
} }
.hs > li, .hs > li,
.item { .item {
scroll-snap-align: center; scroll-snap-align: center;
// padding: calc(20px / 2 * 1.5); // padding: calc(20px / 2 * 1.5);
display: flex; display: flex;
...@@ -107,4 +111,4 @@ ...@@ -107,4 +111,4 @@
align-items: center; align-items: center;
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
} }
\ No newline at end of file
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ToastController } from '@ionic/angular'; import { ToastController, IonInfiniteScroll } from '@ionic/angular';
import { AlloService } from '../../services/allo-service'; import { AlloService } from '../../services/allo-service';
import { TripService } from '../../services/trip-service'; import { TripService } from '../../services/trip-service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
...@@ -11,6 +11,7 @@ import { Router } from '@angular/router'; ...@@ -11,6 +11,7 @@ import { Router } from '@angular/router';
styleUrls: ['./offres-carte.page.scss'], styleUrls: ['./offres-carte.page.scss'],
}) })
export class OffresCartePage implements OnInit { export class OffresCartePage implements OnInit {
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
public toast: any; public toast: any;
...@@ -21,7 +22,21 @@ export class OffresCartePage implements OnInit { ...@@ -21,7 +22,21 @@ export class OffresCartePage implements OnInit {
private router: Router, private router: Router,
private storage: Storage) { } private storage: Storage) { }
ngOnInit() { ngOnInit() { }
loadData(event) {
setTimeout(() => {
++this._TRIP.offersCardListPointer;
let loadedData = this._TRIP.filtredProducts.slice(this._TRIP.offersCardListPointer, this._TRIP.offersCardListPointer + 2);
if (loadedData) {
this._TRIP.offersCardListPointer = this._TRIP.offersCardListPointer + 1;
this._TRIP.offersCardList = this._TRIP.offersCardList.concat(loadedData);
console.log(loadedData, this._TRIP.offersCardList, this._TRIP.offersCardListPointer);
event.target.complete();
} else {
event.target.disabled = true;
}
}, 300);
} }
setImgVisible(trip) { setImgVisible(trip) {
......
...@@ -9,6 +9,8 @@ import { AlloService } from './allo-service'; ...@@ -9,6 +9,8 @@ import { AlloService } from './allo-service';
export class TripService { export class TripService {
public products: Array<any> = []; public products: Array<any> = [];
public filtredProducts: Array<any> = []; public filtredProducts: Array<any> = [];
public offersCardList: Array<any>;
public offersCardListPointer = 1;
public brands: Array<any> = []; public brands: Array<any> = [];
public cats: Array<any> = []; public cats: Array<any> = [];
public request: any; public request: any;
...@@ -51,7 +53,10 @@ export class TripService { ...@@ -51,7 +53,10 @@ export class TripService {
this.products = this._ALLO.shuffleArray(products); this.products = this._ALLO.shuffleArray(products);
this.products.forEach((element) => { element.hidden = true; }); this.products.forEach((element) => { element.hidden = true; });
// setTimeout(() => {
this.filtredProducts = this.products; this.filtredProducts = this.products;
this.offersCardList = this.filtredProducts.slice(0, 2);
// }, 3000);
} }
if (null !== data && 'object' === typeof data && data.hasOwnProperty('cats')) { if (null !== data && 'object' === typeof data && data.hasOwnProperty('cats')) {
var cats = this._ALLO.jsonToArray(data.cats); var cats = this._ALLO.jsonToArray(data.cats);
...@@ -103,5 +108,7 @@ export class TripService { ...@@ -103,5 +108,7 @@ export class TripService {
this.filtredProducts = this.products.filter(item => { this.filtredProducts = this.products.filter(item => {
return item.categories_ids.includes(categoryId); return item.categories_ids.includes(categoryId);
}); });
this.offersCardList = this.filtredProducts.slice(0, 2);
this.offersCardListPointer = 1;
} }
} }
Markdown is supported
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