fix: disabled deletion while edit in progress

This commit is contained in:
Pavel-Savely Savianok 2025-08-08 16:03:46 +03:00
parent f8fa7a8507
commit 52d053e024
2 changed files with 8 additions and 5 deletions

View File

@ -31,7 +31,7 @@ function GetTOTPList(storage) {
editingIndex = index; editingIndex = index;
tempIssuer = element.issuer; tempIssuer = element.issuer;
tempClient = element.client; tempClient = element.client;
updateStorage(storage); _props.settingsStorage.setItem("requestUpdate", Math.random());
}, },
onSave: () => { onSave: () => {
storage[index].issuer = tempIssuer; storage[index].issuer = tempIssuer;
@ -61,6 +61,7 @@ function GetTOTPList(storage) {
updateStorage(storage); updateStorage(storage);
} }
}, },
isEditInProgress: editingIndex !== -1,
}); });
}); });
} }
@ -119,7 +120,7 @@ AppSettingsPage({
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
margin: "10px", marginBottom: "10px",
fontSize: "20px", fontSize: "20px",
color: colors.text, color: colors.text,
borderRadius: "5px", borderRadius: "5px",
@ -151,8 +152,8 @@ AppSettingsPage({
style: { style: {
display: "flex", display: "flex",
justifyContent: "center", justifyContent: "center",
marginTop: "20px", marginTop: "10px",
marginBottom: "20px", marginBottom: "10px",
}, },
}, },
Link( Link(

View File

@ -14,6 +14,7 @@ export function createTOTPCard({
onMoveDown, onMoveDown,
onIssuerChange, onIssuerChange,
onClientChange, onClientChange,
isEditInProgress
}) { }) {
const infoView = View( const infoView = View(
{ {
@ -108,6 +109,7 @@ export function createTOTPCard({
}, },
onClick: onRename, onClick: onRename,
}), }),
!isEditInProgress ?
Button({ Button({
label: "Delete", label: "Delete",
style: { style: {
@ -116,7 +118,7 @@ export function createTOTPCard({
color: colors.text, color: colors.text,
}, },
onClick: onDelete, onClick: onDelete,
}), }): null,
], ],
); );