Move most of currentTitleSecretText's functionality into page.titlePrefix, using less code.
This commit is contained in:
parent
610c2b32ec
commit
0a2127b626
|
@ -9,7 +9,6 @@ import Prism from "prismjs";
|
|||
import "prismjs/components/prism-json";
|
||||
Prism.highlightAll();
|
||||
|
||||
|
||||
import {
|
||||
changePage,
|
||||
renderPage,
|
||||
|
|
|
@ -42,11 +42,8 @@ export function setPageTitle(title) {
|
|||
|
||||
function currentTitleSecretText() {
|
||||
let currentSecretText = pageState.currentSecret;
|
||||
if (pageState.currentPage == pages.KEY_VALUE_SECRETS_EDIT) currentSecretText += " (edit)";
|
||||
if (pageState.currentPage == pages.KEY_VALUE_DELETE) currentSecretText += " (delete)";
|
||||
if (pageState.currentPage == pages.KEY_VALUE_VERSIONS) currentSecretText += " (versions)";
|
||||
if (pageState.currentPage == pages.NEW_TOTP) currentSecretText += " (new)";
|
||||
if (pageState.currentPage == pages.TRANSIT_ENCRYPT) currentSecretText += " (encrypt)";
|
||||
currentSecretText += pageState.currentPage.titlePrefix;
|
||||
|
||||
if (pageState.currentSecretVersion != "0") currentSecretText += ` (v${pageState.currentSecretVersion})`;
|
||||
return currentSecretText;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@ export class KeyValueDeletePage extends Page {
|
|||
]
|
||||
}));
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (delete)";
|
||||
}
|
||||
get name() {
|
||||
return "K/V Delete";
|
||||
}
|
||||
|
|
|
@ -76,6 +76,9 @@ export class KeyValueNewPage extends Page {
|
|||
});
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (new)";
|
||||
}
|
||||
|
||||
get name() {
|
||||
return "K/V New";
|
||||
|
|
|
@ -64,6 +64,9 @@ export class KeyValueSecretsEditPage extends Page {
|
|||
});
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (edit)";
|
||||
}
|
||||
|
||||
get name() {
|
||||
return "K/V Secrets Edit";
|
||||
|
|
|
@ -39,7 +39,10 @@ export class KeyValueVersionsPage extends Page {
|
|||
})
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (versions)";
|
||||
}
|
||||
|
||||
get name() {
|
||||
|
|
|
@ -84,6 +84,11 @@ export class NewTOTPPage extends Page {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (new)";
|
||||
}
|
||||
|
||||
get name() {
|
||||
return "Create New TOTP";
|
||||
}
|
||||
|
|
|
@ -64,6 +64,10 @@ export class TransitDecryptPage extends Page {
|
|||
});
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (decrypt)";
|
||||
}
|
||||
|
||||
get name() {
|
||||
return "Transit Decrypt";
|
||||
}
|
||||
|
|
|
@ -85,6 +85,10 @@ export class TransitEncryptPage extends Page {
|
|||
});
|
||||
}
|
||||
|
||||
get titlePrefix() {
|
||||
return " (encrypt)";
|
||||
}
|
||||
|
||||
get name() {
|
||||
return "Transit Encrypt";
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ export class Page {
|
|||
get name() {
|
||||
return "Page";
|
||||
}
|
||||
get titlePrefix() {
|
||||
return "";
|
||||
}
|
||||
goBack() {
|
||||
changePage(pages.HOME);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue