Skip to content

Commit

Permalink
add hashtags to twitter intent
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanglen committed Nov 10, 2023
1 parent 404d5a5 commit 1260134
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/potlock/widget/Cart/Checkout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const TRASH_ICON_URL =
const DEFAULT_GATEWAY = "https://near.social/potlock.near";
const POTLOCK_TWITTER_ACCOUNT_ID = "PotLock_";

const DEFAULT_SHARE_HASHTAGS = ["BOS", "PublicGoods", "Donations"];

// const Wrapper = styled.div`
// display: flex;
// flex-direction: row;
Expand Down Expand Up @@ -219,7 +221,8 @@ const twitterIntent = useMemo(() => {
} on @${POTLOCK_TWITTER_ACCOUNT_ID}! Support public goods at `;
text = encodeURIComponent(text);
url = encodeURIComponent(url);
return twitterIntentBase + text + `&url=${url}`;
hashtags = DEFAULT_SHARE_HASHTAGS.join(",");
return twitterIntentBase + text + `&url=${url}` + `&hashtags=${hashtags}`;
}, [state.successfulDonationRecipientId, state.successfulDonationRecipientProfile]);

// console.log(encodeURIComponent("https://twitter.com/intent/tweet?text=Hello%20world"));
Expand Down
5 changes: 4 additions & 1 deletion build/potlock/src/Cart/Checkout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const TRASH_ICON_URL =
const DEFAULT_GATEWAY = "https://near.social/potlock.near";
const POTLOCK_TWITTER_ACCOUNT_ID = "PotLock_";

const DEFAULT_SHARE_HASHTAGS = ["BOS", "PublicGoods", "Donations"];

// const Wrapper = styled.div`
// display: flex;
// flex-direction: row;
Expand Down Expand Up @@ -219,7 +221,8 @@ const twitterIntent = useMemo(() => {
} on @${POTLOCK_TWITTER_ACCOUNT_ID}! Support public goods at `;
text = encodeURIComponent(text);
url = encodeURIComponent(url);
return twitterIntentBase + text + `&url=${url}`;
hashtags = DEFAULT_SHARE_HASHTAGS.join(",");
return twitterIntentBase + text + `&url=${url}` + `&hashtags=${hashtags}`;
}, [state.successfulDonationRecipientId, state.successfulDonationRecipientProfile]);

// console.log(encodeURIComponent("https://twitter.com/intent/tweet?text=Hello%20world"));
Expand Down

0 comments on commit 1260134

Please sign in to comment.