Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/app/pages/schedule/schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
<ion-list #scheduleList [hidden]="shownSessions !== 0">
<div *ngIf="segment === 'favorites'" class="ion-padding ion-text-center empty-favorites">
<ion-icon name="star-outline" class="empty-icon"></ion-icon>
<h2>No favorites yet</h2>
<p>Browse the schedule and tap the <ion-icon name="star-outline" style="font-size: 1em; vertical-align: middle;"></ion-icon> on sessions you're interested in to build your personal schedule.</p>
<h2 *ngIf="!hasFavoritesOnOtherDays">No favorites yet</h2>
<p *ngIf="!hasFavoritesOnOtherDays">Browse the schedule and tap the <ion-icon name="star-outline" style="font-size: 1em; vertical-align: middle;"></ion-icon> on sessions you're interested in to build your personal schedule.</p>
<h2 *ngIf="hasFavoritesOnOtherDays">No favorites on {{days[dayIndex]?.day}}</h2>
<p *ngIf="hasFavoritesOnOtherDays">You have favorites on other days.</p>
<ion-button *ngIf="hasFavoritesOnOtherDays" fill="clear" size="small" (click)="showAllFavorites()">Show favorites on other days</ion-button>
<ion-button fill="clear" size="small" (click)="toggleFavorites()">Show all sessions</ion-button>
</div>
<div *ngIf="segment !== 'favorites'">
Expand All @@ -56,7 +59,7 @@ <h2>No favorites yet</h2>
<ion-item-group *ngFor="let group of groups" [hidden]="group.hide">
<ion-item-divider sticky>
<ion-label [class]="(group.startTime < currentTime)? 'past': (group.startTime)? 'future' : 'non'">
{{days[dayIndex].day}} - {{group.time}}
{{allDaysMode ? group.dayLabel : days[dayIndex]?.day}} - {{group.time}}
</ion-label>
</ion-item-divider>

Expand Down
32 changes: 32 additions & 0 deletions src/app/pages/schedule/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export class SchedulePage implements OnInit, OnDestroy {
currentTime: Date;
todayIndex: string = null;
jumpBtnCollapsed: boolean = false;
hasFavoritesOnOtherDays: boolean = false;
allDaysMode: boolean = false;
private favoritesSubscription: Subscription;

constructor(
Expand Down Expand Up @@ -130,6 +132,7 @@ export class SchedulePage implements OnInit, OnDestroy {

updateSchedule() {
this.searchedAllDays = false;
this.allDaysMode = false;

// Close any open sliding items when the schedule updates
if (this.scheduleList) {
Expand All @@ -143,6 +146,12 @@ export class SchedulePage implements OnInit, OnDestroy {
this.confData.getTimeline(this.dayIndex, this.queryText, this.excludeTracks, this.segment).subscribe((data: any) => {
this.shownSessions = data.shownSessions;
this.groups = data.groups;

if (this.segment === 'favorites' && this.shownSessions === 0) {
this.checkFavoritesOnOtherDays();
} else {
this.hasFavoritesOnOtherDays = false;
}
});

this.changeDetectorRef.detectChanges();
Expand Down Expand Up @@ -178,6 +187,29 @@ export class SchedulePage implements OnInit, OnDestroy {
this.updateSchedule();
}

checkFavoritesOnOtherDays() {
this.hasFavoritesOnOtherDays = false;
for (let i = 0; i < this.days.length; i++) {
if (String(i) === this.dayIndex) continue;
this.confData.getTimeline(String(i), '', this.excludeTracks, 'favorites').subscribe((data: any) => {
if (data.shownSessions > 0) {
this.hasFavoritesOnOtherDays = true;
this.changeDetectorRef.detectChanges();
}
});
}
}

showAllFavorites() {
this.allDaysMode = true;
this.confData.getAllDaysTimeline(this.queryText, this.excludeTracks, 'favorites').subscribe((data: any) => {
this.shownSessions = data.shownSessions;
this.groups = data.groups;
this.hasFavoritesOnOtherDays = false;
this.changeDetectorRef.detectChanges();
});
}

searchAllDays() {
let found = false;
let checked = 0;
Expand Down
41 changes: 41 additions & 0 deletions src/app/providers/conference-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,47 @@ export class ConferenceData {
);
}

getAllDaysTimeline(
queryText = '',
excludeTracks: any[] = [],
segment = 'all'
) {
return this.load().pipe(
map((data: any) => {
const schedule = data.schedule.sort(function(a, b){var x = a.date; var y = b.date; return ((x < y) ? -1 : ((x > y) ? 1 : 0));});
let shownSessions = 0;
const allGroups = [];

queryText = queryText.toLowerCase().replace(/,|\.|-/g, ' ');
const queryWords = queryText.split(' ').filter(w => !!w.trim().length);

schedule.forEach((day: any) => {
const dateObj = new Date(day.date + "T00:00:00.000-12:00");
const dayLabel = dateObj.toLocaleDateString('en-us', {timeZone: environment.timezone, weekday: 'short'});

day.groups.forEach((group: any) => {
group.hide = true;
group.dayLabel = dayLabel;

group.sessions.forEach((session: any) => {
this.filterSession(session, queryWords, excludeTracks, segment);
if (!session.hide) {
group.hide = false;
shownSessions++;
}
});

if (!group.hide) {
allGroups.push(group);
}
});
});

return { shownSessions, groups: allGroups };
})
);
}

getSessions(
queryText = '',
excludeTracks: any[] = [],
Expand Down
Loading