Skip to content

Commit 35a8fb9

Browse files
committed
docs: Update code examples
1 parent 0986534 commit 35a8fb9

File tree

4 files changed

+65
-22
lines changed

4 files changed

+65
-22
lines changed

docusaurus/docs/Angular/basics/upgrade-v2.mdx

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@ Below you can find the list of breaking changes and instructions on how to updat
1414

1515
## Peer dependencies
1616

17-
### stream-chat-css
18-
19-
You can drop the `@stream-io/stream-chat-css` dependency because going forward `stream-chat-angular` will encapsulate the library.
20-
21-
Rewrite your stylesheet imports to this:
22-
23-
`~stream-chat-angular/src/assets/styles/scss/index.scss`
24-
25-
Or this if you were using CSS:
26-
27-
`~stream-chat-angular/src/assets/styles/css/index.css`
28-
29-
It's still possible to individually import stylesheets you just have to replace the `~@stream-io/stream-chat-css/dist` prefix with `~stream-chat-angular/src/assets/styles`.
30-
3117
### stream-chat
3218

3319
Upgrade to stream-chat `^6.3.0`.
@@ -43,6 +29,36 @@ Our [generics guide](../concepts/generics.mdx) explains this topic in more detai
4329

4430
You can find the full list of breaking changes in stream-chat [v5](https://github.com/GetStream/stream-chat-js/releases/tag/v5.0.0) and [v6](https://github.com/GetStream/stream-chat-js/releases/tag/v6.0.0) on GitHub.
4531

32+
#### Angular 13
33+
34+
Run the following command to updgrade if you're using Angular 13:
35+
36+
```
37+
38+
```
39+
40+
#### Angular 12
41+
42+
Run the following command to updgrade if you're using Angular 12:
43+
44+
```
45+
npm install [email protected] stream-chat-angular@3 --legacy-peer-deps
46+
```
47+
48+
### stream-chat-css
49+
50+
You can drop the `@stream-io/stream-chat-css` dependency because going forward `stream-chat-angular` will encapsulate the library.
51+
52+
Rewrite your stylesheet imports to this:
53+
54+
`~stream-chat-angular/src/assets/styles/scss/index.scss`
55+
56+
Or this if you were using CSS:
57+
58+
`~stream-chat-angular/src/assets/styles/css/index.css`
59+
60+
It's still possible to individually import stylesheets you just have to replace the `~@stream-io/stream-chat-css/dist` prefix with `~stream-chat-angular/src/assets/styles`.
61+
4662
## Inputs removed in favor of channel capabilities
4763

4864
The following inputs are removed:

docusaurus/docs/Angular/code-examples/channel-invites.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ Create the template (for example in your `AppComponent`):
209209
</ng-template>
210210
```
211211

212-
Register the template in your TypeScript code (for example in your `AppComponent`):
212+
Register the template in your TypeScript code (for example in your `AppComponent`).
213+
214+
These are the necessary steps:
215+
216+
- Create a reference to the custom template
217+
- Import the [CustomTemplatesService](../services/CustomTemplatesService.mdx)
218+
- Register your custom template
213219

214220
```typescript
215221
import {
@@ -235,14 +241,15 @@ import { environment } from "../environments/environment";
235241
styleUrls: ["./app.component.scss"],
236242
})
237243
export class AppComponent implements AfterViewInit {
244+
// Create a reference to the custom template
238245
@ViewChild("channelActionsTemplate")
239246
private channelActionsTemplate!: TemplateRef<ChannelActionsContext>;
240247

241248
constructor(
242249
private chatService: ChatClientService,
243250
private channelService: ChannelService,
244251
private streamI18nService: StreamI18nService,
245-
private customTemplatesService: CustomTemplatesService
252+
private customTemplatesService: CustomTemplatesService // Import customTemplatesService
246253
) {
247254
void this.chatService.init(
248255
environment.apiKey,
@@ -257,6 +264,7 @@ export class AppComponent implements AfterViewInit {
257264
}
258265

259266
ngAfterViewInit(): void {
267+
// Register your custom template
260268
this.customTemplatesService.channelActionsTemplate$.next(
261269
this.channelActionsTemplate
262270
);
@@ -384,8 +392,7 @@ Add a reference to the template in your `app.component.ts`:
384392

385393
```typescript
386394
@ViewChild('inviteTemplate') private inviteTemplate!: TemplateRef<{
387-
channel: Channel | ChannelResponse;
388-
}>;
395+
channel: Channel<DefaultStreamChatGenerics> | ChannelResponse<DefaultStreamChatGenerics>;
389396
```
390397
391398
#### Displaying the invitations

docusaurus/docs/Angular/code-examples/emoji-picker.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,15 @@ Let's create the template for the emoji picker (for example in your `AppComponen
162162
</ng-template>
163163
```
164164

165-
Register the template in your TypeScript code (for example in your `AppComponent`):
165+
Register the template in your TypeScript code (for example in your `AppComponent`).
166+
167+
These are the necessary steps:
168+
169+
- Create a reference to the custom template
170+
- Import the [CustomTemplatesService](../services/CustomTemplatesService.mdx)
171+
- Register your custom template
172+
173+
Here is an example file:
166174

167175
```typescript
168176
import {
@@ -188,14 +196,15 @@ import { environment } from "../environments/environment";
188196
styleUrls: ["./app.component.scss"],
189197
})
190198
export class AppComponent implements AfterViewInit {
199+
// Create a reference to the custom template
191200
@ViewChild("emojiPickerTemplate")
192201
private emojiPickerTemplate!: TemplateRef<EmojiPickerContext>;
193202

194203
constructor(
195204
private chatService: ChatClientService,
196205
private channelService: ChannelService,
197206
private streamI18nService: StreamI18nService,
198-
private customTemplatesService: CustomTemplatesService
207+
private customTemplatesService: CustomTemplatesService // Import the customTemplatesService
199208
) {
200209
void this.chatService.init(
201210
environment.apiKey,
@@ -210,6 +219,7 @@ export class AppComponent implements AfterViewInit {
210219
}
211220

212221
ngAfterViewInit(): void {
222+
// Register your custom template
213223
this.customTemplatesService.emojiPickerTemplate$.next(
214224
this.emojiPickerTemplate
215225
);

docusaurus/docs/Angular/code-examples/mention-actions.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ The `Message` component will provide the mentioned user in a variable called `us
2424

2525
This template looks and works like the default mention template, however you can add interactions to this element.
2626

27-
Register the template in your TypeScript code (for example in your `AppComponent`):
27+
Register the template in your TypeScript code (for example in your `AppComponent`).
28+
29+
These are the necessary steps:
30+
31+
- Create a reference to the custom template
32+
- Import the [CustomTemplatesService](../services/CustomTemplatesService.mdx)
33+
- Register your custom template
34+
35+
Here is an example file:
2836

2937
```typescript
3038
import {
@@ -50,14 +58,15 @@ import { environment } from "../environments/environment";
5058
styleUrls: ["./app.component.scss"],
5159
})
5260
export class AppComponent implements AfterViewInit {
61+
// Create a reference to the custom template
5362
@ViewChild("mentionTemplate")
5463
private mentionTemplate!: TemplateRef<MentionTemplateContext>;
5564

5665
constructor(
5766
private chatService: ChatClientService,
5867
private channelService: ChannelService,
5968
private streamI18nService: StreamI18nService,
60-
private customTemplatesService: CustomTemplatesService
69+
private customTemplatesService: CustomTemplatesService // Import the customTemplatesService
6170
) {
6271
void this.chatService.init(
6372
environment.apiKey,
@@ -72,6 +81,7 @@ export class AppComponent implements AfterViewInit {
7281
}
7382

7483
ngAfterViewInit(): void {
84+
// Register your custom template
7585
this.customTemplatesService.mentionTemplate$.next(this.mentionTemplate);
7686
}
7787
}

0 commit comments

Comments
 (0)