slightly improve popups
This commit is contained in:
parent
113530acb8
commit
bb135bed65
14 changed files with 136 additions and 98 deletions
|
|
@ -432,7 +432,7 @@ function showConfirmPopup(titleKey, descHtml, confirmActionKey, cancelActionKey,
|
|||
let popupContainer = document.getElementById("generic-popup-container");
|
||||
let popupInner = document.getElementById("generic-popup-inner");
|
||||
|
||||
let confirmClass = isDestructive ? "popup-btn-danger" : "popup-btn-confirm";
|
||||
let confirmClass = isDestructive ? "popup-btn-danger" : "";
|
||||
|
||||
genericPopupCancelCallback = onCancel;
|
||||
|
||||
|
|
@ -449,10 +449,10 @@ function showConfirmPopup(titleKey, descHtml, confirmActionKey, cancelActionKey,
|
|||
${descHtml}
|
||||
</div>
|
||||
<div style="display: flex; gap: 0.5rem; justify-content: center; width: 100%;">
|
||||
<button class="profile-action-btn popup-btn-cancel" onclick="closeGenericPopup()">
|
||||
<button class="profile-action-btn popup-action-btn popup-btn-cancel" onclick="closeGenericPopup()">
|
||||
<blah>${cancelActionKey}</blah>
|
||||
</button>
|
||||
<button class="profile-action-btn ${confirmClass}" onclick="if(genericPopupConfirmCallback) genericPopupConfirmCallback()">
|
||||
<button class="profile-action-btn popup-action-btn ${confirmClass}" onclick="if(genericPopupConfirmCallback) genericPopupConfirmCallback()">
|
||||
<blah>${confirmActionKey}</blah>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -474,7 +474,7 @@ function showPromptPopup(titleKey, descHtml, placeholderKey, confirmActionKey, c
|
|||
let popupContainer = document.getElementById("generic-popup-container");
|
||||
let popupInner = document.getElementById("generic-popup-inner");
|
||||
|
||||
let confirmClass = isDestructive ? "popup-btn-danger" : "popup-btn-confirm";
|
||||
let confirmClass = isDestructive ? "popup-btn-danger" : "";
|
||||
|
||||
genericPopupCancelCallback = onCancel;
|
||||
|
||||
|
|
@ -491,12 +491,15 @@ function showPromptPopup(titleKey, descHtml, placeholderKey, confirmActionKey, c
|
|||
<div style="width: 100%; text-align: center; color: var(--text-color); opacity: 0.8; margin-top: 0.5rem; margin-bottom: 1rem;">
|
||||
${descHtml}
|
||||
</div>
|
||||
<input type="text" id="generic-popup-input" class="forminput" placeholder="{blah(${placeholderKey})}" style="width: 100%; margin-bottom: 1rem; box-sizing: border-box;" onkeydown="if(arguments[0].key === 'Enter') { if(genericPopupConfirmCallback) genericPopupConfirmCallback(); }">
|
||||
<div class="input-group" style="margin: 0 auto 1.5rem auto; width: 100%;">
|
||||
<label for="generic-popup-input" style="margin-left: 0;"><blah>${placeholderKey}</blah></label>
|
||||
<input type="text" id="generic-popup-input" class="forminput" placeholder="${processBlah(placeholderKey)}" style="margin-left: 0; margin-right: 0; width: 100%; box-sizing: border-box;" onkeydown="if(arguments[0].key === 'Enter') { if(genericPopupConfirmCallback) genericPopupConfirmCallback(); }">
|
||||
</div>
|
||||
<div style="display: flex; gap: 0.5rem; justify-content: center; width: 100%;">
|
||||
<button class="profile-action-btn popup-btn-cancel" onclick="closeGenericPopup()">
|
||||
<button class="profile-action-btn popup-action-btn popup-btn-cancel" onclick="closeGenericPopup()">
|
||||
<blah>${cancelActionKey}</blah>
|
||||
</button>
|
||||
<button class="profile-action-btn ${confirmClass}" onclick="if(genericPopupConfirmCallback) genericPopupConfirmCallback()">
|
||||
<button class="profile-action-btn popup-action-btn ${confirmClass}" onclick="if(genericPopupConfirmCallback) genericPopupConfirmCallback()">
|
||||
<blah>${confirmActionKey}</blah>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -531,7 +534,7 @@ function closeRotationPopup() {
|
|||
|
||||
async function showRotationPopup(groupId, originalMessagePayload) {
|
||||
pendingRotationMessagePayload = originalMessagePayload;
|
||||
showAction("action.key.rotation", "key_rotation");
|
||||
showAction("action.key.rotating", "key_rotation");
|
||||
|
||||
try {
|
||||
let membersRaw = await fetchEncrypted("group/members", groupId);
|
||||
|
|
@ -539,7 +542,7 @@ async function showRotationPopup(groupId, originalMessagePayload) {
|
|||
|
||||
let members = JSON.parse(membersRaw);
|
||||
|
||||
let descHtml = `<blah>desc.key.rotation.info</blah><br><br><b>${members.length} <blah>label.members</blah></b>`;
|
||||
let descHtml = `<blah>desc.key.rotation.you</blah><br><br><b>${members.length} <blah>label.keys.to.encrypt</blah></b>`;
|
||||
|
||||
showConfirmPopup(
|
||||
"title.key.rotation",
|
||||
|
|
@ -557,6 +560,7 @@ async function showRotationPopup(groupId, originalMessagePayload) {
|
|||
|
||||
async function executeKeyRotation() {
|
||||
closeRotationPopup();
|
||||
clearAction("key_rotation");
|
||||
showAction("action.key.rotating", "key_rotation_exec");
|
||||
|
||||
try {
|
||||
|
|
@ -2742,7 +2746,7 @@ async function inviteToGroupPrompt(groupId) {
|
|||
showPromptPopup(
|
||||
"action.invite",
|
||||
"",
|
||||
"prompt.invite.username",
|
||||
"title.username",
|
||||
"action.invite",
|
||||
"action.cancel",
|
||||
async (targetUsername) => {
|
||||
|
|
@ -4282,17 +4286,26 @@ async function changePassword() {
|
|||
}
|
||||
|
||||
async function deleteAccount() {
|
||||
if (!confirm(processBlah("desc.delete.account") + "\n\n" + processBlah("prompt.are.you.sure"))) return;
|
||||
showAction("action.account.deleting", "accountdel");
|
||||
let res = await fetchPostEnc(`${url}/deleteaccount?id=${window.id}`, "");
|
||||
clearAction("accountdel");
|
||||
let text = res;
|
||||
if (text.startsWith("success:")) {
|
||||
alert(processBlah(text));
|
||||
logout();
|
||||
} else {
|
||||
showBlahNotification(text);
|
||||
}
|
||||
showConfirmPopup(
|
||||
"title.delete.account",
|
||||
"<blah>desc.delete.account</blah><br><br><blah>prompt.are.you.sure</blah>",
|
||||
"action.delete.account",
|
||||
"action.cancel",
|
||||
async () => {
|
||||
showAction("action.account.deleting", "accountdel");
|
||||
let res = await fetchPostEnc(`${url}/deleteaccount?id=${window.id}`, "");
|
||||
clearAction("accountdel");
|
||||
let text = res;
|
||||
if (text.startsWith("success:")) {
|
||||
alert(processBlah(text));
|
||||
logout();
|
||||
} else {
|
||||
showBlahNotification(text);
|
||||
}
|
||||
},
|
||||
null,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
async function saveProfile() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue