Skip to content

Commit f29c4b8

Browse files
committed
Export component
1 parent d464eb2 commit f29c4b8

File tree

6 files changed

+84
-2
lines changed

6 files changed

+84
-2
lines changed

Angular/src/app/app-routing.module.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SpeakerComponentComponent as SpeakerComponent } from './speaker/speaker
77
import { TwitterCardsComponent } from './twitter-cards/twitter-cards.component';
88
import { TransitionScreensComponent } from './transition-screens/transition-screens.component';
99
import { NowShowingComponent } from './now-showing/now-showing.component';
10+
import { ExportComponent } from './export/export.component';
1011

1112
const routes: Routes = [
1213
{
@@ -36,7 +37,11 @@ const routes: Routes = [
3637
{
3738
path: 'now-showing/:date',
3839
component: NowShowingComponent
39-
}
40+
},
41+
{
42+
path: 'export',
43+
component: ExportComponent,
44+
},
4045
];
4146

4247
@NgModule({

Angular/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { TransitionScreensComponent } from './transition-screens/transition-scre
1414
import { FormsModule } from '@angular/forms';
1515
import { NowShowingComponent } from './now-showing/now-showing.component';
1616
import { SmallSpeakerComponent } from './small-speaker/small-speaker.component';
17+
import { ExportComponent } from './export/export.component';
1718

1819
@NgModule({
1920
declarations: [
@@ -26,7 +27,8 @@ import { SmallSpeakerComponent } from './small-speaker/small-speaker.component';
2627
NoVaNavComponent,
2728
TransitionScreensComponent,
2829
NowShowingComponent,
29-
SmallSpeakerComponent
30+
SmallSpeakerComponent,
31+
ExportComponent
3032
],
3133
imports: [
3234
BrowserModule,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<table class="table">
2+
<tr *ngFor="let session of sessions">
3+
<td>{{session.title}}</td>
4+
<td>{{toSeconds(session.startsAt) | date : 'shortTime'}}</td>
5+
<td>{{toSeconds(session.endsAt) | date : 'shortTime'}}</td>
6+
<td>{{roomNames[session.roomId]}}</td>
7+
<td>
8+
<span *ngFor="let speaker of session.speakers; last as isLast">
9+
{{speakerNames[speaker]}}{{isLast ? '' : ', '}}
10+
</span>
11+
</td>
12+
</tr>
13+
</table>

Angular/src/app/export/export.component.scss

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { ExportComponent } from './export.component';
4+
5+
describe('ExportComponent', () => {
6+
let component: ExportComponent;
7+
let fixture: ComponentFixture<ExportComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ ExportComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(ExportComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { DateConverterService } from '../date-converter.service';
3+
import { Room, Session, SessionizeService } from '../sessionize-service.service';
4+
5+
@Component({
6+
selector: 'app-export',
7+
templateUrl: './export.component.html',
8+
styleUrls: ['./export.component.scss']
9+
})
10+
export class ExportComponent implements OnInit {
11+
public sessions: Session[] = [];
12+
public roomNames: { [id: number]: string };
13+
public speakerNames: { [id: number]: string };
14+
15+
constructor(private sessionizeService: SessionizeService, private dateConverterService: DateConverterService) { }
16+
17+
ngOnInit(): void {
18+
this.sessionizeService
19+
.getSessionizeData()
20+
.subscribe((sessionizeApiResult) => {
21+
this.sessions = sessionizeApiResult.sessions;
22+
this.roomNames = {};
23+
sessionizeApiResult.rooms.forEach(r => {
24+
this.roomNames[r.id] = r.name;
25+
});
26+
this.speakerNames = {};
27+
sessionizeApiResult.speakers.forEach(s => {
28+
this.speakerNames[s.id] = s.firstName + ' ' + s.lastName;
29+
});
30+
});
31+
}
32+
33+
public toSeconds(dateString: string): number {
34+
return this.dateConverterService.toTime(dateString);
35+
}
36+
37+
}

0 commit comments

Comments
 (0)