Skip to content

Commit 20b2e02

Browse files
Keldos-LiGaiZhenbiao
authored andcommitted
feat: disable export button when gr export button disabled
1 parent 3d27b4d commit 20b2e02

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

web_assets/javascript/chat-list.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function setChatListHeader() {
1414
}
1515

1616
function setChatList() {
17+
exportBtnCheck();
1718
var selectedChat = null;
1819
var chatList = gradioApp().querySelector('fieldset#history-select-dropdown');
1920
selectedChat = chatList.querySelector("label.selected")
@@ -54,6 +55,12 @@ function setChatList() {
5455
return;
5556
}
5657

58+
function exportBtnCheck() {
59+
var grHistoryExportBtn = gradioApp().querySelector('#gr-history-download-json-btn');
60+
var exportBtn = gradioApp().querySelector('#export-chat-btn');
61+
exportBtn.disabled = grHistoryExportBtn.disabled;
62+
exportBtn.classList.toggle('disabled', grHistoryExportBtn.disabled);
63+
}
5764

5865
function saveChatHistory(a, b, c, d) {
5966
var fileName = b;

web_assets/stylesheet/ChuanhuChat.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,11 +1094,20 @@ input:checked + .chatbot-input-more-span {
10941094
transition: background-color .2s ease;
10951095
}
10961096
.chuanhu-ui-btn:hover {
1097-
background-color: rgba(167, 167, 167, 0.25) !important;
1097+
background-color: rgba(167, 167, 167, 0.25);
10981098
/* color: unset !important; */
10991099
}
11001100
.chuanhu-ui-btn:active {
1101-
background-color: rgba(167, 167, 167, 0.5) !important;
1101+
background-color: rgba(167, 167, 167, 0.5);
1102+
}
1103+
.chuanhu-ui-btn.disabled {
1104+
/* all content transparent 50% */
1105+
background-color: transparent;
1106+
opacity: 0.5;
1107+
cursor: not-allowed !important;
1108+
}
1109+
.chuanhu-ui-btn.disabled+.dropdown-menu {
1110+
display: none !important;
11021111
}
11031112

11041113
.hover-round-btn {

0 commit comments

Comments
 (0)