Skip to content

Commit 328d0e1

Browse files
committed
Show Schedule for Multiple Days
1 parent 1535f1c commit 328d0e1

File tree

8 files changed

+1243
-888
lines changed

8 files changed

+1243
-888
lines changed

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@
8383
<plugin name="cordova-plugin-ionic-webview" spec="2.0.0-beta.1" />
8484
<plugin name="cordova-plugin-statusbar" spec="^2.4.2" />
8585
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.2" />
86-
<engine name="ios" spec="^4.5.5" />
8786
<engine name="android" spec="7.0.0" />
87+
<engine name="ios" spec="~4.5.5" />
8888
</widget>

package-lock.json

Lines changed: 932 additions & 861 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
"rxjs": "6.3.3",
4646
"sw-toolbox": "3.6.0",
4747
"tslib": "^1.9.0",
48-
"zone.js": "^0.8.26"
48+
"zone.js": "^0.8.26",
49+
"ion2-calendar": "^3.0.0-rc.0",
50+
"moment": "^2.24.0"
4951
},
5052
"devDependencies": {
5153
"@angular-devkit/architect": "0.11.0",

src/app/pages/schedule/schedule.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<ion-searchbar [(ngModel)]="queryText" (ionChange)="updateSchedule()" placeholder="Search"></ion-searchbar>
2525
</ion-toolbar>
2626
</ion-header>
27+
<ion-content>
28+
<ion-calendar [(ngModel)]="selectDate" (change)="changeDay($event)" [format]="'YYYY-MM-DD'" [options]="calOptions">
29+
</ion-calendar>
30+
</ion-content>
2731
<ion-content>
2832
<ion-list #scheduleList [hidden]="shownSessions === 0">
2933
<ion-item-group *ngFor="let group of groups" [hidden]="group.hide">
@@ -33,7 +37,8 @@
3337
</ion-label>
3438
</ion-item-divider>
3539

36-
<ion-item-sliding *ngFor="let session of group.sessions" #slidingItem [attr.track]="session.tracks[0] | lowercase" [hidden]="session.hide">
40+
<ion-item-sliding *ngFor="let session of group.sessions" #slidingItem [attr.track]="session.tracks[0] | lowercase"
41+
[hidden]="session.hide">
3742
<ion-item routerLink="/app/tabs/schedule/session/{{session.id}}">
3843
<ion-label>
3944
<h3>{{session.name}}</h3>
@@ -59,7 +64,9 @@ <h3>{{session.name}}</h3>
5964
</ion-list-header>
6065

6166
<ion-fab slot="fixed" vertical="bottom" horizontal="end" #fab>
62-
<ion-fab-button><ion-icon name="share"></ion-icon></ion-fab-button>
67+
<ion-fab-button>
68+
<ion-icon name="share"></ion-icon>
69+
</ion-fab-button>
6370
<ion-fab-list side="top">
6471
<ion-fab-button color="vimeo" (click)="openSocial('Vimeo', fab)">
6572
<ion-icon name="logo-vimeo"></ion-icon>

src/app/pages/schedule/schedule.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import { IonicModule } from '@ionic/angular';
66
import { SchedulePage } from './schedule';
77
import { ScheduleFilterPage } from '../schedule-filter/schedule-filter';
88
import { SchedulePageRoutingModule } from './schedule-routing.module';
9+
import { CalendarModule } from 'ion2-calendar';
910

1011
@NgModule({
1112
imports: [
1213
CommonModule,
1314
FormsModule,
1415
IonicModule,
15-
SchedulePageRoutingModule
16+
SchedulePageRoutingModule,
17+
CalendarModule
1618
],
1719
declarations: [
1820
SchedulePage,

src/app/pages/schedule/schedule.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { AlertController, IonList, LoadingController, ModalController, ToastCont
55
import { ScheduleFilterPage } from '../schedule-filter/schedule-filter';
66
import { ConferenceData } from '../../providers/conference-data';
77
import { UserData } from '../../providers/user-data';
8+
import { map } from 'rxjs/operators';
9+
import { CalendarComponentOptions, DayConfig, DefaultDate } from 'ion2-calendar';
10+
import * as moment from 'moment';
811

912
@Component({
1013
selector: 'page-schedule',
@@ -15,14 +18,18 @@ export class SchedulePage implements OnInit {
1518
// Gets a reference to the list element
1619
@ViewChild('scheduleList') scheduleList: IonList;
1720

18-
dayIndex = 0;
1921
queryText = '';
2022
segment = 'all';
2123
excludeTracks: any = [];
2224
shownSessions: any = [];
2325
groups: any = [];
2426
confDate: string;
25-
27+
selectDate: string;
28+
daysConfig: DayConfig[] = [];
29+
calOptions: CalendarComponentOptions = {
30+
from: 1293683278, // the start unix timestamp
31+
daysConfig: this.daysConfig
32+
};
2633
constructor(
2734
public alertCtrl: AlertController,
2835
public confData: ConferenceData,
@@ -35,16 +42,33 @@ export class SchedulePage implements OnInit {
3542

3643
ngOnInit() {
3744
// this.app.setTitle('Schedule');
38-
this.updateSchedule();
45+
this.findFirstSchedueDay();
46+
}
47+
48+
findFirstSchedueDay() {
49+
this.confData.load().pipe().subscribe((data: any) => {
50+
this.selectDate = data.schedule[0].date;
51+
data.schedule.forEach((v) => {
52+
this.daysConfig.push({
53+
date: moment(v.date, 'YYYY-MM-DD').toDate(),
54+
marked: true
55+
});
56+
});
57+
this.updateSchedule();
58+
});
59+
}
60+
61+
changeDay($event) {
62+
this.updateSchedule($event);
3963
}
4064

41-
updateSchedule() {
65+
updateSchedule(date: string = this.selectDate) {
4266
// Close any open sliding items when the schedule updates
4367
if (this.scheduleList) {
4468
this.scheduleList.closeSlidingItems();
4569
}
4670

47-
this.confData.getTimeline(this.dayIndex, this.queryText, this.excludeTracks, this.segment).subscribe((data: any) => {
71+
this.confData.getTimeline(date, this.queryText, this.excludeTracks, this.segment).subscribe((data: any) => {
4872
this.shownSessions = data.shownSessions;
4973
this.groups = data.groups;
5074
});

src/app/providers/conference-data.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,21 @@ export class ConferenceData {
6565
}
6666

6767
getTimeline(
68-
dayIndex: number,
68+
selectDate: string,
6969
queryText = '',
7070
excludeTracks: any[] = [],
7171
segment = 'all'
7272
) {
7373
return this.load().pipe(
7474
map((data: any) => {
75-
const day = data.schedule[dayIndex];
75+
let day = data.schedule.filter((scheduleEntity: any) => {
76+
return scheduleEntity.date === selectDate;
77+
})[0];
78+
if (!day) {
79+
day = {};
80+
day.shownSessions = 0;
81+
return day;
82+
}
7683
day.shownSessions = 0;
7784

7885
queryText = queryText.toLowerCase().replace(/,|\.|-/g, ' ');

0 commit comments

Comments
 (0)