1
0
Fork 0

Move most of currentTitleSecretText's functionality into page.titlePrefix, using less code.

This commit is contained in:
Kitteh 2021-04-17 11:06:34 +01:00
parent 610c2b32ec
commit 0a2127b626
10 changed files with 30 additions and 7 deletions

View file

@ -9,7 +9,6 @@ import Prism from "prismjs";
import "prismjs/components/prism-json";
Prism.highlightAll();
import {
changePage,
renderPage,

View file

@ -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;
}

View file

@ -38,7 +38,9 @@ export class KeyValueDeletePage extends Page {
]
}));
}
get titlePrefix() {
return " (delete)";
}
get name() {
return "K/V Delete";
}

View file

@ -76,6 +76,9 @@ export class KeyValueNewPage extends Page {
});
}
get titlePrefix() {
return " (new)";
}
get name() {
return "K/V New";

View file

@ -64,6 +64,9 @@ export class KeyValueSecretsEditPage extends Page {
});
}
get titlePrefix() {
return " (edit)";
}
get name() {
return "K/V Secrets Edit";

View file

@ -39,7 +39,10 @@ export class KeyValueVersionsPage extends Page {
})
}));
});
}
get titlePrefix() {
return " (versions)";
}
get name() {

View file

@ -84,6 +84,11 @@ export class NewTOTPPage extends Page {
});
});
}
get titlePrefix() {
return " (new)";
}
get name() {
return "Create New TOTP";
}

View file

@ -64,6 +64,10 @@ export class TransitDecryptPage extends Page {
});
}
get titlePrefix() {
return " (decrypt)";
}
get name() {
return "Transit Decrypt";
}

View file

@ -85,6 +85,10 @@ export class TransitEncryptPage extends Page {
});
}
get titlePrefix() {
return " (encrypt)";
}
get name() {
return "Transit Encrypt";
}

View file

@ -7,6 +7,9 @@ export class Page {
get name() {
return "Page";
}
get titlePrefix() {
return "";
}
goBack() {
changePage(pages.HOME);
}