Skip to content

Commit 71d96ac

Browse files
committed
chore: fix initial comments for layout, grid, treeview, conversationalui
1 parent 3a9e830 commit 71d96ac

File tree

9 files changed

+394
-414
lines changed

9 files changed

+394
-414
lines changed

β€Žexamples-standalone/kendoangular-landing-page/src/app/components/conversational-ui/conversational-ui.component.html

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
<kendo-aiprompt
1111
class="prompt"
1212
(promptRequest)="onPromptRequest($event)"
13-
(commandExecute)="onCommandExecute($event)"
1413
[promptOutputs]="promptOutputs"
15-
[promptCommands]="commands"
16-
[promptSuggestions]="suggestions"
14+
[promptSuggestions]="promptSuggestions"
1715
[(activeView)]="activeView"
1816
>
1917
<kendo-aiprompt-prompt-view></kendo-aiprompt-prompt-view>
2018
<kendo-aiprompt-output-view></kendo-aiprompt-output-view>
21-
<kendo-aiprompt-command-view></kendo-aiprompt-command-view>
2219
</kendo-aiprompt>
2320
</div>
2421
</div>
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,42 @@
1-
import { CommonModule } from "@angular/common";
2-
import { Component } from "@angular/core";
1+
import { CommonModule } from '@angular/common';
2+
import { Component } from '@angular/core';
33

4-
import { KENDO_BUTTONS } from "@progress/kendo-angular-buttons";
4+
import { KENDO_BUTTONS } from '@progress/kendo-angular-buttons';
5+
import { guid } from '@progress/kendo-angular-common';
56
import {
6-
CommandExecuteEvent,
77
KENDO_CONVERSATIONALUI,
88
Message,
9-
PromptCommand,
109
PromptOutput,
1110
PromptRequestEvent,
1211
SendMessageEvent,
1312
User,
14-
} from "@progress/kendo-angular-conversational-ui";
15-
import { KENDO_INPUTS } from "@progress/kendo-angular-inputs";
16-
import { KENDO_LAYOUT } from "@progress/kendo-angular-layout";
17-
import {
18-
bellIcon,
19-
eyeIcon,
20-
infoCircleIcon,
21-
questionCircleIcon,
22-
SVGIcon,
23-
warningCircleIcon,
24-
xIcon,
25-
} from "@progress/kendo-svg-icons";
26-
27-
import { from, merge, Observable, Subject } from "rxjs";
28-
import { map, scan } from "rxjs/operators";
29-
import { ChatService } from "./chat.service";
13+
} from '@progress/kendo-angular-conversational-ui';
14+
import { KENDO_INPUTS } from '@progress/kendo-angular-inputs';
15+
import { KENDO_LAYOUT } from '@progress/kendo-angular-layout';
16+
import { eyeIcon, SVGIcon, xIcon } from '@progress/kendo-svg-icons';
17+
import { from, merge, Observable, Subject } from 'rxjs';
18+
import { map, scan } from 'rxjs/operators';
19+
import { defaultResponse, promptData } from '../../data/ai-prompt-data';
20+
import { ChatService } from './chat.service';
3021

3122
@Component({
32-
selector: "app-conversational-ui",
23+
selector: 'app-conversational-ui',
3324
imports: [CommonModule, KENDO_CONVERSATIONALUI, KENDO_BUTTONS, KENDO_INPUTS, KENDO_LAYOUT],
3425
providers: [ChatService],
35-
templateUrl: "./conversational-ui.component.html",
36-
styleUrl: "./conversational-ui.component.css",
26+
templateUrl: './conversational-ui.component.html',
27+
styleUrl: './conversational-ui.component.css',
3728
})
3829
export class ConversationalUiComponent {
39-
public closeIcon: SVGIcon = xIcon;
40-
public eye: SVGIcon = eyeIcon;
4130
public feed: Observable<Message[]>;
42-
31+
public promptOutputs: PromptOutput[] = [];
32+
public activeView: number = 0;
4333
public readonly user: User = {
4434
id: 1,
4535
};
46-
4736
public readonly bot: User = {
4837
id: 0,
4938
};
50-
51-
public promptOutputs: PromptOutput[] = [];
52-
public activeView: number = 0;
53-
public idCounter = 0;
54-
55-
public commands: PromptCommand[] = [
56-
{
57-
text: "Command text 1",
58-
id: 0,
59-
icon: "bell",
60-
svgIcon: bellIcon,
61-
},
62-
{
63-
text: "Command text 2",
64-
id: 1,
65-
icon: "info",
66-
svgIcon: infoCircleIcon,
67-
},
68-
{
69-
text: "Command text 3",
70-
id: 2,
71-
icon: "question",
72-
svgIcon: questionCircleIcon,
73-
},
74-
{
75-
text: "Command text 4",
76-
id: 3,
77-
icon: "warning",
78-
svgIcon: warningCircleIcon,
79-
},
80-
];
81-
82-
public suggestions: string[] = ["Generate out-of-office email template", "Write a LinkedIn post on the importance of work/life balance"];
39+
public promptSuggestions = promptData.map((s) => s.suggestion);
8340

8441
private local: Subject<Message> = new Subject<Message>();
8542

@@ -88,16 +45,16 @@ export class ConversationalUiComponent {
8845
author: this.bot,
8946
suggestedActions: [
9047
{
91-
type: "reply",
92-
value: "Neat!",
48+
type: 'reply',
49+
value: 'Neat!',
9350
},
9451
{
95-
type: "reply",
96-
value: "Thanks, but this is boring.",
52+
type: 'reply',
53+
value: 'Thanks, but this is boring.',
9754
},
9855
],
9956
timestamp: new Date(),
100-
text: "Hello, this is a demo bot. I don`t do much, but I can count symbols!",
57+
text: 'Hello, this is a demo bot. I don`t do much, but I can count symbols!',
10158
};
10259

10360
this.feed = merge(
@@ -135,23 +92,18 @@ export class ConversationalUiComponent {
13592
this.activeView = 1;
13693
}
13794

138-
public onCommandExecute(ev: CommandExecuteEvent): void {
139-
this.createPromptOutput(ev);
140-
this.activeView = 1;
141-
}
95+
private createPromptOutput(ev: PromptRequestEvent): void {
96+
const response = promptData.find((s) => s.suggestion === ev.prompt);
14297

143-
private createPromptOutput(ev: PromptRequestEvent | CommandExecuteEvent): void {
144-
this.idCounter += 1;
145-
const newOutput = {
146-
title: ev.isRetry ? "Retry test title" : "Test title",
147-
id: this.idCounter,
148-
prompt: (ev as PromptRequestEvent).prompt
149-
? (ev as PromptRequestEvent).prompt
150-
: (ev as CommandExecuteEvent).command.text,
151-
output: "Test content",
98+
const output: PromptOutput = {
99+
id: guid(),
100+
title: ev.prompt,
101+
output: response?.response || defaultResponse,
102+
prompt: ev.prompt,
152103
isRetry: ev.isRetry,
153-
commandId: (ev as PromptRequestEvent).prompt ? null : (ev as CommandExecuteEvent).command.id,
154104
};
155-
this.promptOutputs.unshift(newOutput as PromptOutput);
105+
106+
this.promptOutputs.unshift(output);
107+
this.activeView = 1;
156108
}
157109
}

β€Žexamples-standalone/kendoangular-landing-page/src/app/components/grid/dynamic-grid.component.css

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
}
1616

1717
.red {
18-
color: #f31700;
18+
color: #d51923;
1919
}
2020

2121
.green {
22-
color: #37b400;
22+
color: #278200;
2323
}
2424
.k-grid .k-table-row.k-table-alt-row {
2525
background-color: transparent;
26-
}
26+
}

β€Žexamples-standalone/kendoangular-landing-page/src/app/components/layout/my-layout.component.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
</button>
66
</div>
77
<kendo-drawer-container class="customClass">
8-
<kendo-drawer #drawer [items]="items" mode="push" [mini]="true" [expanded]="true" (select)="onSelect($event)">
8+
<kendo-drawer
9+
#drawer
10+
[items]="items"
11+
mode="push"
12+
[mini]="true"
13+
[expanded]="true"
14+
[autoCollapse]="false"
15+
(select)="onSelect($event)"
16+
>
917
</kendo-drawer>
1018
<kendo-drawer-content>
1119
<layout-component [selectedItem]="selected"></layout-component>

β€Žexamples-standalone/kendoangular-landing-page/src/app/components/treeview/treeview.component.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="container">
22
<div class="wrapper">
3-
<p>TreeView - Multiple Selection Mode with Checkboxes</p>
3+
<p>Multiple Selection Mode with Checkboxes</p>
44
<kendo-treeview
55
[nodes]="data"
66
textField="text"
@@ -16,7 +16,7 @@
1616
</div>
1717

1818
<div class="wrapper">
19-
<p>TreeView - Drag and Drop Support</p>
19+
<p>Drag and Drop Support</p>
2020
<kendo-treeview
2121
[nodes]="treeData"
2222
textField="text"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export const defaultResponse = 'The request cannot be processed at this time. Please excuse us for the inconvenience.';
2+
3+
export const promptData = [
4+
{
5+
suggestion: 'Generate out-of-office email template',
6+
response: `Subject: Out of Office: [Your Name]
7+
8+
Dear [Recipient's Name],
9+
10+
I am currently out of the office until [Return Date] and won't have access to email. For urgent matters, please contact [Colleague's Name] at [Colleague's Email]. I'll respond to your email upon my return.
11+
12+
Thank you,
13+
[Your Name]`,
14+
},
15+
{
16+
suggestion: 'Write a LinkedIn post on the importance of work/life balance',
17+
response: `🌟 Embracing Work/Life Balance for Success 🌟
18+
19+
Hello LinkedIn network! πŸ‘‹ Today, let's talk about a key to our well-being: work/life balance. πŸŒβš–οΈ
20+
21+
In our fast-paced world, balancing professional and personal life is not just a luxury, it's a necessity for health and productivity. πŸ“ˆπŸŒΏ
22+
23+
✨ Key Points ✨
24+
25+
Enhances Productivity: Less burnout, more motivation. πŸš€
26+
Boosts Creativity: New experiences = fresh ideas. πŸ’‘
27+
Improves Health: Mental and physical benefits. πŸ§˜β€β™‚οΈ
28+
Strengthens Relationships: Quality time matters. 🀝
29+
Let's champion a culture where success and well-being go hand in hand. Share your work/life balance tips below! πŸ‘‡
30+
31+
#WorkLifeBalance #Productivity #WellBeing`,
32+
},
33+
];

0 commit comments

Comments
Β (0)