diff --git a/src/components/views/All.jsx b/src/components/views/All.jsx
index 3bfee60e..b7e7e79c 100755
--- a/src/components/views/All.jsx
+++ b/src/components/views/All.jsx
@@ -34,6 +34,7 @@ import handleAddressClick from '../../utils/handleAddressClick';
import handleImageClick from '../../utils/handleImageClick';
import handleQuoteClick from '../../utils/handleQuoteClick';
import handleQuoteHover from '../../utils/handleQuoteHover';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import removeHighlight from '../../utils/removeHighlight';
import useAnonModeRef from '../../hooks/useAnonModeRef';
@@ -926,7 +927,10 @@ const All = () => {
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
>
- - handleOptionClick(thread.cid)}>Hide thread
+ - {
+ handleOptionClick(thread.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
@@ -1258,7 +1262,10 @@ const All = () => {
style={{ display: openMenuCid === reply.cid ? 'block' : 'none' }}
>
- - handleOptionClick(reply.cid)}>Hide post
+ - {
+ handleOptionClick(reply.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/components/views/AllCatalog.jsx b/src/components/views/AllCatalog.jsx
index 4f55504e..88bd8f1b 100755
--- a/src/components/views/AllCatalog.jsx
+++ b/src/components/views/AllCatalog.jsx
@@ -21,6 +21,7 @@ import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
import countLinks from '../../utils/countLinks';
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import useError from '../../hooks/useError';
import useFeedRows from '../../hooks/useFeedRows';
@@ -383,7 +384,10 @@ const CatalogPost = ({post}) => {
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
>
- - handleOptionClick(thread.cid)}>Hide thread
+ - {
+ handleOptionClick(thread.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/components/views/Board.jsx b/src/components/views/Board.jsx
index 08537c88..ca48ba7f 100755
--- a/src/components/views/Board.jsx
+++ b/src/components/views/Board.jsx
@@ -36,6 +36,7 @@ import handleAddressClick from '../../utils/handleAddressClick';
import handleImageClick from '../../utils/handleImageClick';
import handleQuoteClick from '../../utils/handleQuoteClick';
import handleQuoteHover from '../../utils/handleQuoteHover';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import removeHighlight from '../../utils/removeHighlight';
import useAnonModeRef from '../../hooks/useAnonModeRef';
@@ -1000,7 +1001,12 @@ const Board = () => {
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
>
- - handleOptionClick("rules")}>Hide thread
+ - {
+ handleOptionClick("rules");
+ handleShareClick(selectedAddress, "rules");
+ }}>
+ Share thread
+
{/* {isModerator ? (
<>
change rules
@@ -1131,7 +1137,10 @@ const Board = () => {
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
>
- - handleOptionClick("rules")}>Hide thread
+ - {
+ handleOptionClick("rules");
+ handleShareClick(selectedAddress, "rules");
+ }}>Share thread
{/* {isModerator ? (
<>
change rules
@@ -1284,7 +1293,10 @@ const Board = () => {
style={{ display: openMenuCid === subplebbit.pubsubTopic ? 'block' : 'none' }}
>
- - handleOptionClick(subplebbit.pubsubTopic)}>Hide thread
+ - {
+ handleOptionClick("description");
+ handleShareClick(selectedAddress, "description");
+ }}>Share thread
{/* {isModerator ? (
<>
change description
@@ -1615,7 +1627,10 @@ const Board = () => {
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
>
- - handleOptionClick(thread.cid)}>Hide thread
+ - {
+ handleOptionClick(thread.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
@@ -1941,7 +1956,10 @@ const Board = () => {
style={{ display: openMenuCid === reply.cid ? 'block' : 'none' }}
>
- - handleOptionClick(reply.cid)}>Hide post
+ - {
+ handleOptionClick(reply.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx
index e737d9f5..7467735c 100755
--- a/src/components/views/Catalog.jsx
+++ b/src/components/views/Catalog.jsx
@@ -22,6 +22,7 @@ import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
import countLinks from '../../utils/countLinks';
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import useAnonModeRef from '../../hooks/useAnonModeRef';
import useClickForm from '../../hooks/useClickForm';
@@ -317,7 +318,10 @@ const CatalogPost = ({post}) => {
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
>
- - handleOptionClick("rules")}>Hide thread
+ - {
+ handleOptionClick("rules");
+ handleShareClick(selectedAddress, "rules");
+ }}>Share thread
{/* {isModerator ? (
<>
change rules
@@ -405,7 +409,10 @@ const CatalogPost = ({post}) => {
style={{ display: openMenuCid === "description" ? 'block' : 'none' }}
>
- - handleOptionClick("description")}>Hide thread
+ - {
+ handleOptionClick("description");
+ handleShareClick(selectedAddress, "description");
+ }}>Share thread
{/* {isModerator ? (
<>
change description
@@ -581,7 +588,10 @@ const CatalogPost = ({post}) => {
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
>
- - handleOptionClick(thread.cid)}>Hide thread
+ - {
+ handleOptionClick(thread.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/components/views/Description.jsx b/src/components/views/Description.jsx
index 19aa2605..5201b6de 100644
--- a/src/components/views/Description.jsx
+++ b/src/components/views/Description.jsx
@@ -16,6 +16,7 @@ import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
import getDate from '../../utils/getDate';
import handleImageClick from '../../utils/handleImageClick';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import useGeneralStore from '../../hooks/stores/useGeneralStore';
import packageJson from '../../../package.json';
@@ -363,7 +364,10 @@ const Description = () => {
style={{ display: openMenuCid === subplebbit.pubsubTopic ? 'block' : 'none' }}
>
- - handleOptionClick(subplebbit.pubsubTopic)}>Hide thread
+ - {
+ handleOptionClick("description");
+ handleShareClick(selectedAddress, "description");
+ }}>Share thread
{/* {isModerator ? (
<>
change description
diff --git a/src/components/views/Rules.jsx b/src/components/views/Rules.jsx
index ecdb6952..7265cccc 100644
--- a/src/components/views/Rules.jsx
+++ b/src/components/views/Rules.jsx
@@ -14,6 +14,7 @@ import AdminListModal from '../modals/AdminListModal';
import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
import getDate from '../../utils/getDate';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import useGeneralStore from '../../hooks/stores/useGeneralStore';
import packageJson from '../../../package.json';
@@ -345,7 +346,10 @@ const Rules = () => {
style={{ display: openMenuCid === "rules" ? 'block' : 'none' }}
>
- - handleOptionClick("rules")}>Hide thread
+ - {
+ handleOptionClick("rules");
+ handleShareClick(selectedAddress, "rules");
+ }}>Share thread
{/* {isModerator ? (
<>
change rules
diff --git a/src/components/views/Subscriptions.jsx b/src/components/views/Subscriptions.jsx
index 6e674085..5690c869 100755
--- a/src/components/views/Subscriptions.jsx
+++ b/src/components/views/Subscriptions.jsx
@@ -35,6 +35,7 @@ import handleAddressClick from '../../utils/handleAddressClick';
import handleImageClick from '../../utils/handleImageClick';
import handleQuoteClick from '../../utils/handleQuoteClick';
import handleQuoteHover from '../../utils/handleQuoteHover';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import removeHighlight from '../../utils/removeHighlight';
import useAnonModeRef from '../../hooks/useAnonModeRef';
@@ -937,7 +938,10 @@ const Subscriptions = () => {
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
>
- - handleOptionClick(thread.cid)}>Hide thread
+ - {
+ handleOptionClick(thread.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
@@ -1269,7 +1273,10 @@ const Subscriptions = () => {
style={{ display: openMenuCid === reply.cid ? 'block' : 'none' }}
>
- - handleOptionClick(reply.cid)}>Hide post
+ - {
+ handleOptionClick(reply.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/components/views/SubscriptionsCatalog.jsx b/src/components/views/SubscriptionsCatalog.jsx
index 0dea1769..d15f2c7e 100755
--- a/src/components/views/SubscriptionsCatalog.jsx
+++ b/src/components/views/SubscriptionsCatalog.jsx
@@ -21,6 +21,7 @@ import OfflineIndicator from '../OfflineIndicator';
import SettingsModal from '../modals/SettingsModal';
import countLinks from '../../utils/countLinks';
import getCommentMediaInfo from '../../utils/getCommentMediaInfo';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import useError from '../../hooks/useError';
import useFeedRows from '../../hooks/useFeedRows';
@@ -383,7 +384,10 @@ const CatalogPost = ({post}) => {
style={{ display: openMenuCid === thread.cid ? 'block' : 'none' }}
>
- - handleOptionClick(thread.cid)}>Hide thread
+ - {
+ handleOptionClick(thread.cid);
+ handleShareClick(selectedAddress, thread.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/components/views/Thread.jsx b/src/components/views/Thread.jsx
index 4aaf681a..043679fb 100755
--- a/src/components/views/Thread.jsx
+++ b/src/components/views/Thread.jsx
@@ -33,6 +33,7 @@ import handleAddressClick from '../../utils/handleAddressClick';
import handleImageClick from '../../utils/handleImageClick';
import handleQuoteClick from '../../utils/handleQuoteClick';
import handleQuoteHover from '../../utils/handleQuoteHover';
+import handleShareClick from '../../utils/handleShareClick';
import handleStyleChange from '../../utils/handleStyleChange';
import removeHighlight from '../../utils/removeHighlight';
import useAnonMode from '../../hooks/useAnonMode';
@@ -1067,7 +1068,10 @@ const Thread = () => {
style={{ display: openMenuCid === comment.cid ? 'block' : 'none' }}
>
- - handleOptionClick(comment.cid)}>Hide thread
+ - {
+ handleOptionClick(comment.cid);
+ handleShareClick(selectedAddress, comment.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
@@ -1360,7 +1364,10 @@ const Thread = () => {
style={{ display: openMenuCid === reply.cid ? 'block' : 'none' }}
>
- - handleOptionClick(reply.cid)}>Hide post
+ - {
+ handleOptionClick(reply.cid);
+ handleShareClick(selectedAddress, comment.cid);
+ }}>Share thread
{({ authorAddress }) => (
<>
{authorAddress === account?.author.address ||
diff --git a/src/utils/handleShareClick.js b/src/utils/handleShareClick.js
new file mode 100644
index 00000000..23d71bd2
--- /dev/null
+++ b/src/utils/handleShareClick.js
@@ -0,0 +1,25 @@
+function handleShareClick(selectedAddress, cid) {
+ const plebBzBaseURL = "https://pleb.bz/p/";
+
+ let shareLink = `${plebBzBaseURL}${selectedAddress}/`;
+
+ if (cid === "rules" || cid === "description") {
+ shareLink += cid;
+ } else {
+ shareLink += `c/${cid}`;
+ }
+
+ shareLink += `?redirect=plebchan.eth.limo`;
+
+ if (navigator.clipboard) {
+ navigator.clipboard.writeText(shareLink).then(() => {
+ console.log("Link copied to clipboard!");
+ }).catch(err => {
+ console.error('Could not copy text: ', err);
+ });
+ } else {
+ return;
+ }
+}
+
+export default handleShareClick;
\ No newline at end of file