add no board selected alert, add missing translations

This commit is contained in:
Tom (plebeius.eth)
2024-09-20 18:05:33 +02:00
parent 3c27fd6c31
commit 3bd530024f
37 changed files with 152 additions and 42 deletions
+10 -5
View File
@@ -128,7 +128,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
const author = account?.author || {};
const { displayName } = author || {};
const [url, setUrl] = useState('');
const { link, publishCommentOptions, setSubmitStore, resetSubmitStore } = useSubmitStore();
const { publishCommentOptions, setSubmitStore, resetSubmitStore } = useSubmitStore();
const { index, publishComment } = usePublishComment(publishCommentOptions);
useEffect(() => {
@@ -195,11 +195,16 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
const currentUrl = urlRef.current?.value.trim() || '';
if (!currentTitle && !currentContent && !currentUrl) {
alert(`Cannot post empty comment`);
alert(t('empty_comment_alert'));
return;
}
if (currentUrl && !isValidURL(currentUrl)) {
alert('The provided link is not a valid URL.');
alert(t('invalid_url_alert'));
return;
}
if ((isInAllView || isInSubscriptionsView) && !publishCommentOptions.subplebbitAddress) {
alert(t('no_board_selected_warning'));
return;
}
@@ -277,12 +282,12 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
const currentUrl = urlRef.current?.value.trim() || '';
if (!currentContent && !currentUrl) {
alert(`Cannot post empty comment`);
alert(t('empty_comment_alert'));
return;
}
if (currentUrl && !isValidURL(currentUrl)) {
alert('The provided link is not a valid URL.');
alert(t('invalid_url_alert'));
return;
}
+2 -2
View File
@@ -73,12 +73,12 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
const currentUrl = urlRef.current?.value.trim() || '';
if (!currentContent && !currentUrl) {
alert(`Cannot post empty comment`);
alert(t('empty_comment_alert'));
return;
}
if (currentUrl && !isValidURL(currentUrl)) {
alert('The provided link is not a valid URL.');
alert(t('invalid_url_alert'));
return;
}