diff --git a/src/components/ReplyModal.jsx b/src/components/ReplyModal.jsx index 3f1541ce..8b2e8ec3 100644 --- a/src/components/ReplyModal.jsx +++ b/src/components/ReplyModal.jsx @@ -6,7 +6,6 @@ import useGeneralStore from '../hooks/stores/useGeneralStore'; import Modal from 'react-modal'; import Draggable from 'react-draggable'; import useError from '../hooks/useError'; -import useSuccess from '../hooks/useSuccess'; const ReplyModal = ({ isOpen, closeModal }) => { diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx index 7f16b24f..a6125b25 100644 --- a/src/components/views/Catalog.jsx +++ b/src/components/views/Catalog.jsx @@ -15,7 +15,6 @@ import getCommentMediaInfo from '../../utils/getCommentMediaInfo'; import handleStyleChange from '../../utils/handleStyleChange'; import useClickForm from '../../hooks/useClickForm'; import useError from '../../hooks/useError'; -import useSuccess from '../../hooks/useSuccess'; const Catalog = () => { diff --git a/src/components/views/Pending.jsx b/src/components/views/Pending.jsx index bbedd732..e54bbfe4 100644 --- a/src/components/views/Pending.jsx +++ b/src/components/views/Pending.jsx @@ -10,6 +10,7 @@ import ImageBanner from '../ImageBanner'; import Post from '../Post'; import PostLoader from '../PostLoader'; import SettingsModal from '../SettingsModal'; +import formatState from '../../utils/formatState'; import getCommentMediaInfo from '../../utils/getCommentMediaInfo'; import getDate from '../../utils/getDate'; import handleQuoteClick from '../../utils/handleQuoteClick'; @@ -166,11 +167,7 @@ const Pending = () => { Catalog ] - {comment ? ( - Preview - ) : ( - Fetching IPFS... - )} + {formatState(comment.state)}
diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx index ee404fcd..e4cdc1ed 100644 --- a/src/components/views/Thread.jsx +++ b/src/components/views/Thread.jsx @@ -13,6 +13,7 @@ import PostLoader from '../PostLoader'; import ReplyModal from '../ReplyModal'; import SettingsModal from '../SettingsModal'; import findShortParentCid from '../../utils/findShortParentCid'; +import formatState from '../../utils/formatState'; import getCommentMediaInfo from '../../utils/getCommentMediaInfo'; import getDate from '../../utils/getDate'; import handleAddressClick from '../../utils/handleAddressClick'; @@ -387,10 +388,10 @@ const Thread = () => { No replies yet ) ) : ( - Fetching IPNS... + {formatState(comment.state)} ) ) : ( - Fetching IPNS... + {formatState(comment.state)} )}
diff --git a/src/utils/formatState.js b/src/utils/formatState.js new file mode 100644 index 00000000..bfc4952b --- /dev/null +++ b/src/utils/formatState.js @@ -0,0 +1,18 @@ +function formatState(str) { + return ( + str + .replace(/-/g, " ") + .split(" ") + .map((word) => { + word = word.toLowerCase(); + if (word === "ipfs" || word === "ipns") { + return word.toUpperCase(); + } else { + return word.charAt(0).toUpperCase() + word.slice(1); + } + }) + .join(" ") + "..." + ); +} + +export default formatState; \ No newline at end of file