Skip to content

Commit 83aaa0b

Browse files
committed
perf: 修改 setting
1 parent 975477d commit 83aaa0b

File tree

4 files changed

+88
-1
lines changed

4 files changed

+88
-1
lines changed

src/app/elements/chat/chat.component.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<div
2+
(click)="onSettingOpenDrawer()"
3+
[hidden]="!isShowSetting || subViews.length > 1"
4+
class="drag-setting"
5+
>
6+
<i class="fa fa-cog"></i>
7+
</div>
18
<div *ngIf="chatAiEnabled" class="chat-container" id="chatContainer">
29
<iframe
310
[src]="iframeURL | safeUrl"

src/app/elements/chat/chat.component.scss

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,66 @@
1212
border: none;
1313
}
1414
}
15+
16+
.drag-setting {
17+
position: absolute;
18+
right: 10px;
19+
bottom: 100px;
20+
width: 36px;
21+
height: 36px;
22+
line-height: 38px;
23+
margin-bottom: 2px;
24+
text-align: center;
25+
border-radius: 50%;
26+
cursor: pointer;
27+
transform: translateX(20%);
28+
background-color: rgba(88, 88, 88, .8);
29+
border: 1px solid transparent;
30+
transition: border-color 0.3s ease;
31+
32+
&:hover {
33+
.setting-list {
34+
display: block;
35+
transform: translateY(0);
36+
}
37+
38+
i {
39+
opacity: 1;
40+
transform: rotate(45deg);
41+
}
42+
}
43+
44+
i {
45+
font-size: 18px;
46+
color: white;
47+
opacity: 0.8;
48+
}
49+
50+
.setting-list {
51+
position: absolute;
52+
bottom: 35px;
53+
right: 4px;
54+
margin: 0;
55+
padding: 0;
56+
display: none;
57+
list-style-type: none;
58+
transition: all 0.3s ease;
59+
transform: translateY(100%);
60+
61+
.setting-item {
62+
width: 28px;
63+
height: 28px;
64+
line-height: 28px;
65+
padding: 2px;
66+
border-radius: 50%;
67+
margin-bottom: 2px;
68+
overflow: hidden;
69+
background-color: #FFFFFF;
70+
71+
&:hover {
72+
background-color: #f0f1f5;
73+
border-color: #a0a0a0;
74+
}
75+
}
76+
}
77+
}

src/app/elements/chat/chat.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,27 @@ export class ElementChatComponent implements OnInit {
1919
) {
2020
}
2121

22+
get isShowSetting() {
23+
return true;
24+
const connectMethods = ['koko', 'lion', 'tinker', 'panda'];
25+
return (
26+
this.currentView.hasOwnProperty('connectMethod')
27+
&& connectMethods.includes(this.currentView.connectMethod.component)
28+
);
29+
}
30+
31+
get subViews() {
32+
return this.currentView.hasOwnProperty('subViews') ? this.currentView.subViews : [];
33+
}
34+
2235
get chatAiEnabled() {
2336
return this._settingSvc.globalSetting.CHAT_AI_ENABLED;
2437
}
2538

39+
onSettingOpenDrawer() {
40+
this.currentView.iframeElement.postMessage({name: 'OPEN'}, '*');
41+
}
42+
2643
ngOnInit() {
2744
this.viewSrv.currentView$.subscribe((state: View) => {
2845
this.currentView = state;

src/app/elements/nav/nav.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class ElementNavComponent implements OnInit {
5454
return [
5555
{
5656
id: 'FileManager',
57-
name: 'File Manager',
57+
name: 'File Explorer',
5858
children: [
5959
{
6060
id: 'Connect',

0 commit comments

Comments
 (0)