Skip to content

Commit 03db183

Browse files
committed
Make the slide preview work
1 parent 61c3b76 commit 03db183

File tree

7 files changed

+53
-25
lines changed

7 files changed

+53
-25
lines changed

apps/codelab/src/app/admin/content/presentation-editor/content.component.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ContentService } from './services/content.service';
33
import { ActivatedRoute } from '@angular/router';
44
import { map } from 'rxjs/operators';
55
import { combineLatest } from 'rxjs';
6-
import { ContentPresentation } from './types';
76
import { NavigationService } from './services/navigation.service';
87

98
@Component({
@@ -12,16 +11,7 @@ import { NavigationService } from './services/navigation.service';
1211
styleUrls: ['./content.component.css'],
1312
})
1413
export class ContentComponent {
15-
readonly presentation$ = combineLatest([
16-
this.navigationService.selectedPresentationId$,
17-
this.contentService.state$,
18-
]).pipe(
19-
map(([presentationId, presentations]) => {
20-
return presentations.find(
21-
(p: ContentPresentation) => p.id === presentationId
22-
);
23-
})
24-
);
14+
readonly presentation$ = this.contentService.presentation$;
2515

2616
currentSlideIndex$ = this.navigationService.currentSlideIndex$;
2717

apps/codelab/src/app/admin/content/presentation-editor/services/content.service.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject, Injectable, OnDestroy } from '@angular/core';
2-
import { merge, Subject } from 'rxjs';
2+
import { combineLatest, merge, Subject } from 'rxjs';
33
import { distinctUntilChanged, map, scan, shareReplay, take, tap, } from 'rxjs/operators';
44
import { nanoid } from 'nanoid';
55
import { ContentBlock, ContentPresentation } from '../types';
@@ -51,6 +51,17 @@ export class ContentService implements OnDestroy {
5151
shareReplay(1),
5252
);
5353

54+
readonly presentation$ = combineLatest([
55+
this.navigationService.selectedPresentationId$,
56+
this.state$,
57+
]).pipe(
58+
map(([presentationId, presentations]) => {
59+
return presentations.find(
60+
(p: ContentPresentation) => p.id === presentationId
61+
);
62+
})
63+
);
64+
5465
constructor(
5566
private readonly navigationService: NavigationService
5667
) {

apps/codelab/src/app/admin/content/presentation-editor/slide-editor/action-bar/action-bar.component.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@ export class ActionBarComponent {
1818
},
1919
angularApp: {
2020
code: {
21-
'app.ts': '// Angular app!!',
22-
'component.ts': '// C',
23-
'module.ts': '// M',
21+
'index.html': `
22+
[<app-component></app-component>]
23+
`,
24+
'main.ts': `
25+
import {bootstrapApplication} from '@angular/platform-browser';
26+
import {AppComponent} from './app.component';
27+
bootstrapApplication(AppComponent);
28+
`,
29+
'app.component.ts': `
30+
@Component({
31+
selector: 'app-component',
32+
template: '<h1>LOL<h1>',
33+
standalone: true
34+
})
35+
export class AppComponent {
36+
}
37+
`,
2438
},
2539
},
2640
};

apps/codelab/src/app/admin/content/presentation-editor/wrappers/custom-component-editors/codelab-code-demo-console-editor/codelab-code-demo-console-editor.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@
4545
(ngModelChange)="update()"
4646
[files]="openFiles"
4747
[ui]="ui"
48-
[bootstrap]="false"
48+
[bootstrap]="'main'"
4949
></code-demo>

apps/codelab/src/app/shared/slide-styles.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
12
:host ::ng-deep {
3+
--font-size: 20px;
24
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
35
font-weight: 300;
6+
47
aside {
58
background: #ebf7ff;
69
padding: 8px;
710
margin: 16px -8px -8px -8px;
811
border-radius: 8px;
12+
font-size: var(--font-size);
913

1014
&:before {
1115
content: '❤️';
@@ -28,8 +32,11 @@
2832
}
2933

3034
ul,
31-
p {
35+
p, // TODO(kirjs): Improve the specificity
36+
li:not(.action-item):not(.action-item):not(.action-item) {
3237
margin-bottom: 24px;
33-
font-size: 20px;
38+
font-size: var(--font-size);
3439
}
40+
41+
3542
}

apps/codelab/src/app/v2/presentation/presentation.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<slide-deck
22
slideShortcuts
33
slidesRouting
4-
*ngIf="contentService.state$ | async as presentation"
4+
*ngIf="presentation$ | async as presentation"
55
>
66
<codelab-progress-bar></codelab-progress-bar>
77

88
<slide-arrows></slide-arrows>
9-
<div *ngFor="let slide of presentation[2].slides">
9+
<div *ngFor="let slide of presentation.slides">
1010
<div *slide id="infer__">
1111
<slides-v2-slide [slide1]="slide"></slides-v2-slide>
1212
</div>
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { NavigationService } from '../../admin/content/presentation-editor/services/navigation.service';
32
import { ContentService } from '../../admin/content/presentation-editor/services/content.service';
43

54
@Component({
65
selector: 'slides-presentation',
76
templateUrl: './presentation.component.html',
8-
styleUrls: ['./presentation.component.css'],
7+
styleUrls: [
8+
'./presentation.component.css',
9+
'../../shared/slide-styles.scss',],
910
})
1011
export class PresentationComponent implements OnInit {
12+
readonly presentation$ = this.contentService.presentation$;
13+
14+
1115
constructor(
12-
readonly contentService: ContentService
13-
) {}
16+
private readonly contentService: ContentService,
17+
) {
18+
}
1419

15-
ngOnInit(): void {}
20+
ngOnInit(): void {
21+
}
1622
}

0 commit comments

Comments
 (0)