Skip to content

Commit

Permalink
feat: disable export button when gr export button disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Keldos-Li authored and GaiZhenbiao committed Sep 19, 2024
1 parent 3d27b4d commit 20b2e02
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions web_assets/javascript/chat-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function setChatListHeader() {
}

function setChatList() {
exportBtnCheck();
var selectedChat = null;
var chatList = gradioApp().querySelector('fieldset#history-select-dropdown');
selectedChat = chatList.querySelector("label.selected")
Expand Down Expand Up @@ -54,6 +55,12 @@ function setChatList() {
return;
}

function exportBtnCheck() {
var grHistoryExportBtn = gradioApp().querySelector('#gr-history-download-json-btn');
var exportBtn = gradioApp().querySelector('#export-chat-btn');
exportBtn.disabled = grHistoryExportBtn.disabled;
exportBtn.classList.toggle('disabled', grHistoryExportBtn.disabled);
}

function saveChatHistory(a, b, c, d) {
var fileName = b;
Expand Down
13 changes: 11 additions & 2 deletions web_assets/stylesheet/ChuanhuChat.css
Original file line number Diff line number Diff line change
Expand Up @@ -1094,11 +1094,20 @@ input:checked + .chatbot-input-more-span {
transition: background-color .2s ease;
}
.chuanhu-ui-btn:hover {
background-color: rgba(167, 167, 167, 0.25) !important;
background-color: rgba(167, 167, 167, 0.25);
/* color: unset !important; */
}
.chuanhu-ui-btn:active {
background-color: rgba(167, 167, 167, 0.5) !important;
background-color: rgba(167, 167, 167, 0.5);
}
.chuanhu-ui-btn.disabled {
/* all content transparent 50% */
background-color: transparent;
opacity: 0.5;
cursor: not-allowed !important;
}
.chuanhu-ui-btn.disabled+.dropdown-menu {
display: none !important;
}

.hover-round-btn {
Expand Down

0 comments on commit 20b2e02

Please sign in to comment.