add new loading states

This commit is contained in:
Tom
2023-05-09 15:58:19 +02:00
parent 66e90138d0
commit 2aff229997
6 changed files with 82 additions and 117 deletions
-27
View File
@@ -1,27 +0,0 @@
function formatState(str) {
if (!str) {
return null;
}
const formattedWords = str
.replace(/-/g, " ")
.split(" ")
.map((word, index) => {
word = word.toLowerCase();
if (word === "ipfs" || word === "ipns") {
return word.toUpperCase();
} else if (index === 0) {
return word.charAt(0).toUpperCase() + word.slice(1);
} else {
return word;
}
});
if (formattedWords[0] === "Failed" || formattedWords[0] === "Succeeded") {
return formattedWords.join(" ") + ".";
}
return formattedWords.join(" ") + "...";
}
export default formatState;