From 159e3f8ed5573caeb78e8f9cac988105865b334a Mon Sep 17 00:00:00 2001 From: ziro Date: Sun, 24 Sep 2023 17:42:50 +0700 Subject: [PATCH] chore: Remove crypto related stuff I don't do crypto --- .../components/crypto-address.tsx | 65 ------------------- .../components/crypto-donate-panel.tsx | 52 --------------- .../crypto-donate/components/crypto-icon.tsx | 29 --------- .../components/detailed-crypto-address.tsx | 47 -------------- .../crypto-donate/components/site-wallet.tsx | 30 --------- app/soapbox/features/crypto-donate/index.tsx | 40 ------------ .../crypto-donate/utils/block-explorer.ts | 9 --- .../crypto-donate/utils/block-explorers.json | 26 -------- .../features/crypto-donate/utils/coin-db.ts | 13 ---- .../crypto-donate/utils/manifest-map.ts | 11 ---- .../components/crypto-address-input.tsx | 51 --------------- app/soapbox/features/soapbox-config/index.tsx | 28 -------- .../features/ui/components/modal-root.tsx | 2 - .../components/modals/crypto-donate-modal.tsx | 20 ------ .../features/ui/components/profile-field.tsx | 18 ----- app/soapbox/features/ui/index.tsx | 5 +- .../features/ui/util/async-components.ts | 16 ----- app/soapbox/locales/en.json | 13 ---- app/soapbox/locales/id.json | 13 ---- app/soapbox/locales/ja.json | 13 ---- .../soapbox/__tests__/soapbox-config.test.ts | 19 ------ .../normalizers/soapbox/soapbox-config.ts | 24 ------- app/soapbox/pages/home-page.tsx | 8 --- app/soapbox/types/soapbox.ts | 5 +- app/styles/application.scss | 1 - app/styles/components/crypto-donate.scss | 47 -------------- package.json | 1 - webpack/production.ts | 1 - webpack/rules/assets.ts | 7 -- yarn.lock | 5 -- 30 files changed, 2 insertions(+), 617 deletions(-) delete mode 100644 app/soapbox/features/crypto-donate/components/crypto-address.tsx delete mode 100644 app/soapbox/features/crypto-donate/components/crypto-donate-panel.tsx delete mode 100644 app/soapbox/features/crypto-donate/components/crypto-icon.tsx delete mode 100644 app/soapbox/features/crypto-donate/components/detailed-crypto-address.tsx delete mode 100644 app/soapbox/features/crypto-donate/components/site-wallet.tsx delete mode 100644 app/soapbox/features/crypto-donate/index.tsx delete mode 100644 app/soapbox/features/crypto-donate/utils/block-explorer.ts delete mode 100644 app/soapbox/features/crypto-donate/utils/block-explorers.json delete mode 100644 app/soapbox/features/crypto-donate/utils/coin-db.ts delete mode 100644 app/soapbox/features/crypto-donate/utils/manifest-map.ts delete mode 100644 app/soapbox/features/soapbox-config/components/crypto-address-input.tsx delete mode 100644 app/soapbox/features/ui/components/modals/crypto-donate-modal.tsx delete mode 100644 app/styles/components/crypto-donate.scss diff --git a/app/soapbox/features/crypto-donate/components/crypto-address.tsx b/app/soapbox/features/crypto-donate/components/crypto-address.tsx deleted file mode 100644 index 9352ed029..000000000 --- a/app/soapbox/features/crypto-donate/components/crypto-address.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import React from 'react'; - -import { openModal } from 'soapbox/actions/modals'; -import CopyableInput from 'soapbox/components/copyable-input'; -import { Text, Icon, Stack, HStack } from 'soapbox/components/ui'; -import { useAppDispatch } from 'soapbox/hooks'; - -import { getExplorerUrl } from '../utils/block-explorer'; -import { getTitle } from '../utils/coin-db'; - -import CryptoIcon from './crypto-icon'; - -export interface ICryptoAddress { - address: string - ticker: string - note?: string -} - -const CryptoAddress: React.FC = (props): JSX.Element => { - const { address, ticker, note } = props; - - const dispatch = useAppDispatch(); - - const handleModalClick = (e: React.MouseEvent): void => { - dispatch(openModal('CRYPTO_DONATE', props)); - e.preventDefault(); - }; - - const title = getTitle(ticker); - const explorerUrl = getExplorerUrl(ticker, address); - - return ( - - - - - {title || ticker.toUpperCase()} - - - - - - - {explorerUrl && ( - - - - )} - - - - {note && ( - {note} - )} - - - - ); -}; - -export default CryptoAddress; diff --git a/app/soapbox/features/crypto-donate/components/crypto-donate-panel.tsx b/app/soapbox/features/crypto-donate/components/crypto-donate-panel.tsx deleted file mode 100644 index 929515e4f..000000000 --- a/app/soapbox/features/crypto-donate/components/crypto-donate-panel.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import React from 'react'; -import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { useHistory } from 'react-router-dom'; - -import { Text, Widget } from 'soapbox/components/ui'; -import { useInstance, useSoapboxConfig } from 'soapbox/hooks'; - -import SiteWallet from './site-wallet'; - -const messages = defineMessages({ - actionTitle: { id: 'crypto_donate_panel.actions.view', defaultMessage: 'Click to see {count, plural, one {# wallet} other {# wallets}}' }, -}); - -interface ICryptoDonatePanel { - limit: number -} - -const CryptoDonatePanel: React.FC = ({ limit = 3 }): JSX.Element | null => { - const intl = useIntl(); - const history = useHistory(); - const instance = useInstance(); - - const addresses = useSoapboxConfig().get('cryptoAddresses'); - - if (limit === 0 || addresses.size === 0) { - return null; - } - - const handleAction = () => { - history.push('/donate/crypto'); - }; - - return ( - } - onActionClick={handleAction} - actionTitle={intl.formatMessage(messages.actionTitle, { count: addresses.size })} - > - - - - - - - ); -}; - -export default CryptoDonatePanel; diff --git a/app/soapbox/features/crypto-donate/components/crypto-icon.tsx b/app/soapbox/features/crypto-donate/components/crypto-icon.tsx deleted file mode 100644 index 3b5bf8bf2..000000000 --- a/app/soapbox/features/crypto-donate/components/crypto-icon.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; - -/** Get crypto icon URL by ticker symbol, or fall back to generic icon */ -const getIcon = (ticker: string): string => { - try { - return require(`cryptocurrency-icons/svg/color/${ticker.toLowerCase()}.svg`); - } catch { - return require('cryptocurrency-icons/svg/color/generic.svg'); - } -}; - -interface ICryptoIcon { - ticker: string - title?: string - className?: string -} - -const CryptoIcon: React.FC = ({ ticker, title, className }): JSX.Element => { - return ( -
- {title -
- ); -}; - -export default CryptoIcon; diff --git a/app/soapbox/features/crypto-donate/components/detailed-crypto-address.tsx b/app/soapbox/features/crypto-donate/components/detailed-crypto-address.tsx deleted file mode 100644 index d6c8c3134..000000000 --- a/app/soapbox/features/crypto-donate/components/detailed-crypto-address.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { QRCodeCanvas as QRCode } from 'qrcode.react'; -import React from 'react'; - -import CopyableInput from 'soapbox/components/copyable-input'; -import Icon from 'soapbox/components/icon'; - -import { getExplorerUrl } from '../utils/block-explorer'; -import { getTitle } from '../utils/coin-db'; - -import CryptoIcon from './crypto-icon'; - -interface IDetailedCryptoAddress { - address: string - ticker: string - note?: string -} - -const DetailedCryptoAddress: React.FC = ({ address, ticker, note }): JSX.Element => { - const title = getTitle(ticker); - const explorerUrl = getExplorerUrl(ticker, address); - - return ( -
-
- -
{title || ticker.toUpperCase()}
-
- {explorerUrl && - - } -
-
- {note &&
{note}
} -
- -
- - -
- ); -}; - -export default DetailedCryptoAddress; diff --git a/app/soapbox/features/crypto-donate/components/site-wallet.tsx b/app/soapbox/features/crypto-donate/components/site-wallet.tsx deleted file mode 100644 index bb4bdb6c1..000000000 --- a/app/soapbox/features/crypto-donate/components/site-wallet.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -import { Stack } from 'soapbox/components/ui'; -import { useSoapboxConfig } from 'soapbox/hooks'; - -import CryptoAddress from './crypto-address'; - -interface ISiteWallet { - limit?: number -} - -const SiteWallet: React.FC = ({ limit }): JSX.Element => { - const { cryptoAddresses } = useSoapboxConfig(); - const addresses = typeof limit === 'number' ? cryptoAddresses.take(limit) : cryptoAddresses; - - return ( - - {addresses.map(address => ( - - ))} - - ); -}; - -export default SiteWallet; diff --git a/app/soapbox/features/crypto-donate/index.tsx b/app/soapbox/features/crypto-donate/index.tsx deleted file mode 100644 index f2affe4bd..000000000 --- a/app/soapbox/features/crypto-donate/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useState } from 'react'; -import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; - -import { Accordion, Column, Stack } from 'soapbox/components/ui'; -import { useInstance } from 'soapbox/hooks'; - -import SiteWallet from './components/site-wallet'; - -const messages = defineMessages({ - heading: { id: 'column.crypto_donate', defaultMessage: 'Donate Cryptocurrency' }, -}); - -const CryptoDonate: React.FC = (): JSX.Element => { - const intl = useIntl(); - const instance = useInstance(); - - const [explanationBoxExpanded, toggleExplanationBox] = useState(true); - - return ( - - - } - expanded={explanationBoxExpanded} - onToggle={toggleExplanationBox} - > - - - - - - - ); -}; - -export default CryptoDonate; diff --git a/app/soapbox/features/crypto-donate/utils/block-explorer.ts b/app/soapbox/features/crypto-donate/utils/block-explorer.ts deleted file mode 100644 index b0f7a6965..000000000 --- a/app/soapbox/features/crypto-donate/utils/block-explorer.ts +++ /dev/null @@ -1,9 +0,0 @@ -import blockExplorers from './block-explorers.json'; - -type BlockExplorers = Record; - -export const getExplorerUrl = (ticker: string, address: string): string | null => { - const template = (blockExplorers as BlockExplorers)[ticker]; - if (!template) return null; - return template.replace('{address}', address); -}; diff --git a/app/soapbox/features/crypto-donate/utils/block-explorers.json b/app/soapbox/features/crypto-donate/utils/block-explorers.json deleted file mode 100644 index 814b83634..000000000 --- a/app/soapbox/features/crypto-donate/utils/block-explorers.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "aave": "https://etherscan.io/address/{address}", - "bat": "https://etherscan.io/address/{address}", - "bch": "https://explorer.bitcoin.com/bch/address/{address}", - "btc": "https://explorer.bitcoin.com/btc/address/{address}", - "btg": "https://btgexplorer.com/address/{address}", - "comp": "https://etherscan.io/address/{address}", - "dash": "https://dashblockexplorer.com/address/{address}", - "dgb": "https://digiexplorer.info/address/{address}", - "doge": "https://dogechain.info/address/{address}", - "etc": "https://etcblockexplorer.com/address/{address}", - "eth": "https://etherscan.io/address/{address}", - "grans": "https://ubiqscan.io/address/{address}", - "link": "https://etherscan.io/address/{address}", - "ltc": "https://litecoinblockexplorer.net/address/{address}", - "mkr": "https://etherscan.io/address/{address}", - "oxt": "https://etherscan.io/address/{address}", - "sushi": "https://etherscan.io/address/{address}", - "ubq": "https://ubiqscan.io/address/{address}", - "uni": "https://etherscan.io/address/{address}", - "usdc": "https://etherscan.io/address/{address}", - "vtc": "https://vtcblocks.com/address/{address}", - "xmr": "https://monerohash.com/explorer/search?value={address}", - "xrp": "https://xrpscan.com/account/{address}", - "zec": "https://zecblockexplorer.com/address/{address}" -} diff --git a/app/soapbox/features/crypto-donate/utils/coin-db.ts b/app/soapbox/features/crypto-donate/utils/coin-db.ts deleted file mode 100644 index 1949a62cf..000000000 --- a/app/soapbox/features/crypto-donate/utils/coin-db.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { fromJS } from 'immutable'; - -import manifestMap from './manifest-map'; - -// All this does is converts the result from manifest_map.js into an ImmutableMap -const coinDB = fromJS(manifestMap); -export default coinDB; - -/** Get title from CoinDB based on ticker symbol */ -export const getTitle = (ticker: string): string => { - const title = coinDB.getIn([ticker, 'name']); - return typeof title === 'string' ? title : ''; -}; diff --git a/app/soapbox/features/crypto-donate/utils/manifest-map.ts b/app/soapbox/features/crypto-donate/utils/manifest-map.ts deleted file mode 100644 index b89ba6ef2..000000000 --- a/app/soapbox/features/crypto-donate/utils/manifest-map.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Converts cryptocurrency-icon's manifest file from a list to a map. -// See: https://github.com/spothq/cryptocurrency-icons/blob/master/manifest.json - -import manifest from 'cryptocurrency-icons/manifest.json'; -import { List as ImmutableList, Map as ImmutableMap, fromJS } from 'immutable'; - -const manifestMap = (fromJS(manifest) as ImmutableList>).reduce((acc: ImmutableMap>, entry: ImmutableMap) => { - return acc.set(entry.get('symbol')!.toLowerCase(), entry); -}, ImmutableMap()); - -export default manifestMap.toJS(); diff --git a/app/soapbox/features/soapbox-config/components/crypto-address-input.tsx b/app/soapbox/features/soapbox-config/components/crypto-address-input.tsx deleted file mode 100644 index 08cea6bbf..000000000 --- a/app/soapbox/features/soapbox-config/components/crypto-address-input.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { useIntl, defineMessages } from 'react-intl'; - -import { HStack, Input } from 'soapbox/components/ui'; - -import type { StreamfieldComponent } from 'soapbox/components/ui/streamfield/streamfield'; -import type { CryptoAddress } from 'soapbox/types/soapbox'; - -const messages = defineMessages({ - ticker: { id: 'soapbox_config.crypto_address.meta_fields.ticker_placeholder', defaultMessage: 'Ticker' }, - address: { id: 'soapbox_config.crypto_address.meta_fields.address_placeholder', defaultMessage: 'Address' }, - note: { id: 'soapbox_config.crypto_address.meta_fields.note_placeholder', defaultMessage: 'Note (optional)' }, -}); - -const CryptoAddressInput: StreamfieldComponent = ({ value, onChange }) => { - const intl = useIntl(); - - const handleChange = (key: 'ticker' | 'address' | 'note'): React.ChangeEventHandler => { - return e => { - onChange(value.set(key, e.currentTarget.value)); - }; - }; - - return ( - - - - - - ); -}; - -export default CryptoAddressInput; diff --git a/app/soapbox/features/soapbox-config/index.tsx b/app/soapbox/features/soapbox-config/index.tsx index 15295e212..438536ea0 100644 --- a/app/soapbox/features/soapbox-config/index.tsx +++ b/app/soapbox/features/soapbox-config/index.tsx @@ -25,7 +25,6 @@ import { useAppSelector, useAppDispatch, useFeatures } from 'soapbox/hooks'; import { normalizeSoapboxConfig } from 'soapbox/normalizers'; import toast from 'soapbox/toast'; -import CryptoAddressInput from './components/crypto-address-input'; import FooterLinkInput from './components/footer-link-input'; import PromoPanelInput from './components/promo-panel-input'; import SitePreview from './components/site-preview'; @@ -34,7 +33,6 @@ const messages = defineMessages({ heading: { id: 'column.soapbox_config', defaultMessage: 'Soapbox config' }, saved: { id: 'soapbox_config.saved', defaultMessage: 'Soapbox config saved!' }, copyrightFooterLabel: { id: 'soapbox_config.copyright_footer.meta_fields.label_placeholder', defaultMessage: 'Copyright footer' }, - cryptoDonatePanelLimitLabel: { id: 'soapbox_config.crypto_donate_panel_limit.meta_fields.limit_placeholder', defaultMessage: 'Number of items to display in the crypto homepage widget' }, customCssLabel: { id: 'soapbox_config.custom_css.meta_fields.url_placeholder', defaultMessage: 'URL' }, rawJSONLabel: { id: 'soapbox_config.raw_json_label', defaultMessage: 'Advanced: Edit raw JSON data' }, rawJSONHint: { id: 'soapbox_config.raw_json_hint', defaultMessage: 'Edit the settings data directly. Changes made directly to the JSON file will override the form fields above. Click "Save" to apply your changes.' }, @@ -64,7 +62,6 @@ type ThemeChangeHandler = (theme: string) => void; const templates: Record = { promoPanelItem: ImmutableMap({ icon: '', text: '', url: '' }), footerItem: ImmutableMap({ title: '', url: '' }), - cryptoAddress: ImmutableMap({ ticker: '', address: '', note: '' }), }; const SoapboxConfig: React.FC = () => { @@ -346,31 +343,6 @@ const SoapboxConfig: React.FC = () => { )} - - } /> - - - } - hint={} - component={CryptoAddressInput} - values={soapbox.cryptoAddresses.toArray()} - onChange={handleStreamItemChange(['cryptoAddresses'])} - onAddItem={addStreamItem(['cryptoAddresses'], templates.cryptoAddress)} - onRemoveItem={deleteStreamItem(['cryptoAddresses'])} - /> - - - Number(e.target.value))} - /> - - } /> diff --git a/app/soapbox/features/ui/components/modal-root.tsx b/app/soapbox/features/ui/components/modal-root.tsx index 4596e83f7..74d262710 100644 --- a/app/soapbox/features/ui/components/modal-root.tsx +++ b/app/soapbox/features/ui/components/modal-root.tsx @@ -12,7 +12,6 @@ import { ComposeEventModal, ComposeModal, ConfirmationModal, - CryptoDonateModal, DislikesModal, EditAnnouncementModal, EditFederationModal, @@ -61,7 +60,6 @@ const MODAL_COMPONENTS = { 'COMPOSE_EVENT': ComposeEventModal, 'CONFIRM': ConfirmationModal, 'CREATE_GROUP': CreateGroupModal, - 'CRYPTO_DONATE': CryptoDonateModal, 'DISLIKES': DislikesModal, 'EDIT_ANNOUNCEMENT': EditAnnouncementModal, 'EDIT_FEDERATION': EditFederationModal, diff --git a/app/soapbox/features/ui/components/modals/crypto-donate-modal.tsx b/app/soapbox/features/ui/components/modals/crypto-donate-modal.tsx deleted file mode 100644 index c1724ee78..000000000 --- a/app/soapbox/features/ui/components/modals/crypto-donate-modal.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; - -import { Modal } from 'soapbox/components/ui'; -import DetailedCryptoAddress from 'soapbox/features/crypto-donate/components/detailed-crypto-address'; - -import type { ICryptoAddress } from '../../../crypto-donate/components/crypto-address'; - -const CryptoDonateModal: React.FC void }> = ({ onClose, ...props }) => { - - return ( - -
- -
-
- ); - -}; - -export default CryptoDonateModal; diff --git a/app/soapbox/features/ui/components/profile-field.tsx b/app/soapbox/features/ui/components/profile-field.tsx index a6468a177..d62517899 100644 --- a/app/soapbox/features/ui/components/profile-field.tsx +++ b/app/soapbox/features/ui/components/profile-field.tsx @@ -4,14 +4,9 @@ import { defineMessages, useIntl, FormatDateOptions } from 'react-intl'; import Markup from 'soapbox/components/markup'; import { HStack, Icon } from 'soapbox/components/ui'; -import BundleContainer from 'soapbox/features/ui/containers/bundle-container'; -import { CryptoAddress } from 'soapbox/features/ui/util/async-components'; import type { Account } from 'soapbox/schemas'; -const getTicker = (value: string): string => (value.match(/\$([a-zA-Z]*)/i) || [])[1]; -const isTicker = (value: string): boolean => Boolean(getTicker(value)); - const messages = defineMessages({ linkVerifiedOn: { id: 'account.link_verified_on', defaultMessage: 'Ownership of this link was checked on {date}' }, }); @@ -33,19 +28,6 @@ interface IProfileField { const ProfileField: React.FC = ({ field }) => { const intl = useIntl(); - if (isTicker(field.name)) { - return ( - - {Component => ( - - )} - - ); - } - return (
diff --git a/app/soapbox/features/ui/index.tsx b/app/soapbox/features/ui/index.tsx index cb2da25d1..36e9fcce0 100644 --- a/app/soapbox/features/ui/index.tsx +++ b/app/soapbox/features/ui/index.tsx @@ -90,7 +90,6 @@ import { ServerInfo, Dashboard, ModerationLog, - CryptoDonate, ScheduledStatuses, UserIndex, FederationRestrictions, @@ -162,8 +161,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => const features = useFeatures(); const { search } = useLocation(); - const { authenticatedProfile, cryptoAddresses } = useSoapboxConfig(); - const hasCrypto = cryptoAddresses.size > 0; + const { authenticatedProfile } = useSoapboxConfig(); // NOTE: Mastodon and Pleroma route some basenames to the backend. // When adding new routes, use a basename that does NOT conflict @@ -345,7 +343,6 @@ const SwitchingColumnsArea: React.FC = ({ children }) => new Promise((_resolve, reject) => reject())} content={children} /> - {hasCrypto && } {features.federating && } diff --git a/app/soapbox/features/ui/util/async-components.ts b/app/soapbox/features/ui/util/async-components.ts index cfd736d78..23d4b77a3 100644 --- a/app/soapbox/features/ui/util/async-components.ts +++ b/app/soapbox/features/ui/util/async-components.ts @@ -386,22 +386,6 @@ export function StatusHoverCard() { return import(/* webpackChunkName: "features/ui" */'soapbox/components/status-hover-card'); } -export function CryptoDonate() { - return import(/* webpackChunkName: "features/crypto_donate" */'../../crypto-donate'); -} - -export function CryptoDonatePanel() { - return import(/* webpackChunkName: "features/crypto_donate" */'../../crypto-donate/components/crypto-donate-panel'); -} - -export function CryptoAddress() { - return import(/* webpackChunkName: "features/crypto_donate" */'../../crypto-donate/components/crypto-address'); -} - -export function CryptoDonateModal() { - return import(/* webpackChunkName: "features/crypto_donate" */'../components/modals/crypto-donate-modal'); -} - export function ScheduledStatuses() { return import(/* webpackChunkName: "features/scheduled_statuses" */'../../scheduled-statuses'); } diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json index 0c3729d8a..2e1e96fa7 100644 --- a/app/soapbox/locales/en.json +++ b/app/soapbox/locales/en.json @@ -312,7 +312,6 @@ "column.bookmarks": "Bookmarks", "column.chats": "Chats", "column.community": "Local timeline", - "column.crypto_donate": "Donate Cryptocurrency", "column.developers": "Developers", "column.developers.service_worker": "Service Worker", "column.direct": "Direct messages", @@ -535,11 +534,6 @@ "confirmations.scheduled_status_delete.message": "Are you sure you want to cancel this scheduled post?", "confirmations.unfollow.confirm": "Unfollow", "copy.success": "Copied to clipboard!", - "crypto_donate.explanation_box.message": "{siteTitle} accepts cryptocurrency donations. You may send a donation to any of the addresses below. Thank you for your support!", - "crypto_donate.explanation_box.title": "Sending cryptocurrency donations", - "crypto_donate_panel.actions.view": "Click to see {count, plural, one {# wallet} other {# wallets}}", - "crypto_donate_panel.heading": "Donate Cryptocurrency", - "crypto_donate_panel.intro.message": "{siteTitle} accepts cryptocurrency donations to fund our service. Thank you for your support!", "datepicker.day": "Day", "datepicker.hint": "Scheduled to post at…", "datepicker.month": "Month", @@ -1408,16 +1402,11 @@ "soapbox_config.authenticated_profile_hint": "Users must be logged-in to view replies and media on user profiles.", "soapbox_config.authenticated_profile_label": "Profiles require authentication", "soapbox_config.copyright_footer.meta_fields.label_placeholder": "Copyright footer", - "soapbox_config.crypto_address.meta_fields.address_placeholder": "Address", - "soapbox_config.crypto_address.meta_fields.note_placeholder": "Note (optional)", - "soapbox_config.crypto_address.meta_fields.ticker_placeholder": "Ticker", - "soapbox_config.crypto_donate_panel_limit.meta_fields.limit_placeholder": "Number of items to display in the crypto homepage widget", "soapbox_config.cta_label": "Display call to action panels if not authenticated", "soapbox_config.custom_css.meta_fields.url_placeholder": "URL", "soapbox_config.display_fqn_label": "Display domain (eg @user@domain) for local accounts.", "soapbox_config.feed_injection_hint": "Inject the feed with additional content, such as suggested profiles.", "soapbox_config.feed_injection_label": "Feed injection", - "soapbox_config.fields.crypto_addresses_label": "Cryptocurrency addresses", "soapbox_config.fields.edit_theme_label": "Edit theme", "soapbox_config.fields.home_footer_fields_label": "Home footer items", "soapbox_config.fields.logo_label": "Logo", @@ -1425,12 +1414,10 @@ "soapbox_config.fields.theme_label": "Default theme", "soapbox_config.greentext_label": "Enable greentext support", "soapbox_config.headings.advanced": "Advanced", - "soapbox_config.headings.cryptocurrency": "Cryptocurrency", "soapbox_config.headings.events": "Events", "soapbox_config.headings.navigation": "Navigation", "soapbox_config.headings.options": "Options", "soapbox_config.headings.theme": "Theme", - "soapbox_config.hints.crypto_addresses": "Add cryptocurrency addresses so users of your site can donate to you. Order matters, and you must use lowercase ticker values.", "soapbox_config.hints.home_footer_fields": "You can have custom defined links displayed on the footer of your static pages", "soapbox_config.hints.logo": "SVG. At most 2 MB. Will be displayed to 50px height, maintaining aspect ratio", "soapbox_config.hints.promo_panel_fields": "You can have custom defined links displayed on the right panel of the timelines page.", diff --git a/app/soapbox/locales/id.json b/app/soapbox/locales/id.json index c76a27db7..00823fde5 100644 --- a/app/soapbox/locales/id.json +++ b/app/soapbox/locales/id.json @@ -206,7 +206,6 @@ "column.bookmarks": "Bookmarks", "column.chats": "Chats", "column.community": "Linimasa Lokal", - "column.crypto_donate": "Donate Cryptocurrency", "column.developers": "Developers", "column.developers.service_worker": "Service Worker", "column.direct": "Pesan langsung", @@ -355,11 +354,6 @@ "confirmations.scheduled_status_delete.heading": "Cancel scheduled post", "confirmations.scheduled_status_delete.message": "Are you sure you want to cancel this scheduled post?", "confirmations.unfollow.confirm": "Berhenti mengikuti", - "crypto_donate.explanation_box.message": "{siteTitle} accepts cryptocurrency donations. You may send a donation to any of the addresses below. Thank you for your support!", - "crypto_donate.explanation_box.title": "Sending cryptocurrency donations", - "crypto_donate_panel.actions.view": "Click to see {count} {count, plural, one {wallet} other {wallets}}", - "crypto_donate_panel.heading": "Donate Cryptocurrency", - "crypto_donate_panel.intro.message": "{siteTitle} accepts cryptocurrency donations to fund our service. Thank you for your support!", "datepicker.day": "Day", "datepicker.hint": "Scheduled to post at…", "datepicker.month": "Month", @@ -990,27 +984,20 @@ "soapbox_config.authenticated_profile_hint": "Users must be logged-in to view replies and media on user profiles.", "soapbox_config.authenticated_profile_label": "Profiles require authentication", "soapbox_config.copyright_footer.meta_fields.label_placeholder": "Copyright footer", - "soapbox_config.crypto_address.meta_fields.address_placeholder": "Address", - "soapbox_config.crypto_address.meta_fields.note_placeholder": "Note (optional)", - "soapbox_config.crypto_address.meta_fields.ticker_placeholder": "Ticker", - "soapbox_config.crypto_donate_panel_limit.meta_fields.limit_placeholder": "Number of items to display in the crypto homepage widget", "soapbox_config.cta_label": "Display call to action panels if not authenticated", "soapbox_config.custom_css.meta_fields.url_placeholder": "URL", "soapbox_config.display_fqn_label": "Display domain (eg @user@domain) for local accounts.", "soapbox_config.feed_injection_hint": "Inject the feed with additional content, such as suggested profiles.", "soapbox_config.feed_injection_label": "Feed injection", - "soapbox_config.fields.crypto_addresses_label": "Cryptocurrency addresses", "soapbox_config.fields.home_footer_fields_label": "Home footer items", "soapbox_config.fields.logo_label": "Logo", "soapbox_config.fields.promo_panel_fields_label": "Promo panel items", "soapbox_config.fields.theme_label": "Default theme", "soapbox_config.greentext_label": "Enable greentext support", "soapbox_config.headings.advanced": "Advanced", - "soapbox_config.headings.cryptocurrency": "Cryptocurrency", "soapbox_config.headings.navigation": "Navigation", "soapbox_config.headings.options": "Options", "soapbox_config.headings.theme": "Theme", - "soapbox_config.hints.crypto_addresses": "Add cryptocurrency addresses so users of your site can donate to you. Order matters, and you must use lowercase ticker values.", "soapbox_config.hints.home_footer_fields": "You can have custom defined links displayed on the footer of your static pages", "soapbox_config.hints.logo": "SVG. At most 2 MB. Will be displayed to 50px height, maintaining aspect ratio", "soapbox_config.hints.promo_panel_fields": "You can have custom defined links displayed on the right panel of the timelines page.", diff --git a/app/soapbox/locales/ja.json b/app/soapbox/locales/ja.json index 1cac72e10..39d91a715 100644 --- a/app/soapbox/locales/ja.json +++ b/app/soapbox/locales/ja.json @@ -265,7 +265,6 @@ "column.bookmarks": "ブックマーク", "column.chats": "チャット", "column.community": "公開タイムライン", - "column.crypto_donate": "Donate Cryptocurrency", "column.developers": "Developers", "column.developers.service_worker": "Service Worker", "column.direct": "ダイレクトメッセージ", @@ -414,11 +413,6 @@ "confirmations.scheduled_status_delete.heading": "Cancel scheduled post", "confirmations.scheduled_status_delete.message": "Are you sure you want to cancel this scheduled post?", "confirmations.unfollow.confirm": "フォロー解除", - "crypto_donate.explanation_box.message": "{siteTitle} accepts cryptocurrency donations. You may send a donation to any of the addresses below. Thank you for your support!", - "crypto_donate.explanation_box.title": "Sending cryptocurrency donations", - "crypto_donate_panel.actions.view": "Click to see {count} {count, plural, one {wallet} other {wallets}}", - "crypto_donate_panel.heading": "Donate Cryptocurrency", - "crypto_donate_panel.intro.message": "{siteTitle} accepts cryptocurrency donations to fund our service. Thank you for your support!", "datepicker.day": "Day", "datepicker.hint": "Scheduled to post at…", "datepicker.month": "Month", @@ -1049,27 +1043,20 @@ "soapbox_config.authenticated_profile_hint": "Users must be logged-in to view replies and media on user profiles.", "soapbox_config.authenticated_profile_label": "Profiles require authentication", "soapbox_config.copyright_footer.meta_fields.label_placeholder": "Copyright footer", - "soapbox_config.crypto_address.meta_fields.address_placeholder": "Address", - "soapbox_config.crypto_address.meta_fields.note_placeholder": "Note (optional)", - "soapbox_config.crypto_address.meta_fields.ticker_placeholder": "Ticker", - "soapbox_config.crypto_donate_panel_limit.meta_fields.limit_placeholder": "Number of items to display in the crypto homepage widget", "soapbox_config.cta_label": "Display call to action panels if not authenticated", "soapbox_config.custom_css.meta_fields.url_placeholder": "URL", "soapbox_config.display_fqn_label": "Display domain (eg @user@domain) for local accounts.", "soapbox_config.feed_injection_hint": "Inject the feed with additional content, such as suggested profiles.", "soapbox_config.feed_injection_label": "Feed injection", - "soapbox_config.fields.crypto_addresses_label": "Cryptocurrency addresses", "soapbox_config.fields.home_footer_fields_label": "Home footer items", "soapbox_config.fields.logo_label": "Logo", "soapbox_config.fields.promo_panel_fields_label": "Promo panel items", "soapbox_config.fields.theme_label": "Default theme", "soapbox_config.greentext_label": "Enable greentext support", "soapbox_config.headings.advanced": "Advanced", - "soapbox_config.headings.cryptocurrency": "Cryptocurrency", "soapbox_config.headings.navigation": "Navigation", "soapbox_config.headings.options": "Options", "soapbox_config.headings.theme": "Theme", - "soapbox_config.hints.crypto_addresses": "Add cryptocurrency addresses so users of your site can donate to you. Order matters, and you must use lowercase ticker values.", "soapbox_config.hints.home_footer_fields": "You can have custom defined links displayed on the footer of your static pages", "soapbox_config.hints.logo": "SVG. At most 2 MB. Will be displayed to 50px height, maintaining aspect ratio", "soapbox_config.hints.promo_panel_fields": "You can have custom defined links displayed on the right panel of the timelines page.", diff --git a/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts b/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts index 9142a3356..2b46fb770 100644 --- a/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts +++ b/app/soapbox/normalizers/soapbox/__tests__/soapbox-config.test.ts @@ -9,25 +9,6 @@ describe('normalizeSoapboxConfig()', () => { expect(ImmutableRecord.isRecord(result)).toBe(true); }); - it('normalizes cryptoAddresses', () => { - const soapboxConfig = { - cryptoAddresses: [ - { ticker: '$BTC', address: 'bc1q9cx35adpm73aq2fw40ye6ts8hfxqzjr5unwg0n' }, - ], - }; - - const expected = { - cryptoAddresses: [ - { ticker: 'btc', address: 'bc1q9cx35adpm73aq2fw40ye6ts8hfxqzjr5unwg0n', note: '' }, - ], - }; - - const result = normalizeSoapboxConfig(soapboxConfig); - expect(result.cryptoAddresses.size).toBe(1); - expect(ImmutableRecord.isRecord(result.cryptoAddresses.get(0))).toBe(true); - expect(result.toJS()).toMatchObject(expected); - }); - it('normalizes promoPanel', () => { const result = normalizeSoapboxConfig(require('soapbox/__fixtures__/spinster-soapbox.json')); expect(ImmutableRecord.isRecord(result.promoPanel)).toBe(true); diff --git a/app/soapbox/normalizers/soapbox/soapbox-config.ts b/app/soapbox/normalizers/soapbox/soapbox-config.ts index 165165865..0bc0ed1bd 100644 --- a/app/soapbox/normalizers/soapbox/soapbox-config.ts +++ b/app/soapbox/normalizers/soapbox/soapbox-config.ts @@ -4,7 +4,6 @@ import { Record as ImmutableRecord, fromJS, } from 'immutable'; -import trimStart from 'lodash/trimStart'; import { adSchema } from 'soapbox/schemas'; import { filteredArray } from 'soapbox/schemas/utils'; @@ -16,7 +15,6 @@ import type { Ad, PromoPanelItem, FooterItem, - CryptoAddress, } from 'soapbox/types/soapbox'; const DEFAULT_COLORS = ImmutableMap({ @@ -63,12 +61,6 @@ export const FooterItemRecord = ImmutableRecord({ url: '', }); -export const CryptoAddressRecord = ImmutableRecord({ - address: '', - note: '', - ticker: '', -}); - export const SoapboxConfigRecord = ImmutableRecord({ ads: ImmutableList(), appleAppId: null, @@ -101,10 +93,6 @@ export const SoapboxConfigRecord = ImmutableRecord({ verifiedIcon: '', verifiedCanEditName: false, displayFqn: true, - cryptoAddresses: ImmutableList(), - cryptoDonatePanel: ImmutableMap({ - limit: 1, - }), aboutPages: ImmutableMap>(), authenticatedProfile: true, linkFooterMessage: '', @@ -133,17 +121,6 @@ const normalizeAds = (soapboxConfig: SoapboxConfigMap): SoapboxConfigMap => { } }; -const normalizeCryptoAddress = (address: unknown): CryptoAddress => { - return CryptoAddressRecord(ImmutableMap(fromJS(address))).update('ticker', ticker => { - return trimStart(ticker, '$').toLowerCase(); - }); -}; - -const normalizeCryptoAddresses = (soapboxConfig: SoapboxConfigMap): SoapboxConfigMap => { - const addresses = ImmutableList(soapboxConfig.get('cryptoAddresses')); - return soapboxConfig.set('cryptoAddresses', addresses.map(normalizeCryptoAddress)); -}; - const normalizeBrandColor = (soapboxConfig: SoapboxConfigMap): SoapboxConfigMap => { const brandColor = soapboxConfig.get('brandColor') || soapboxConfig.getIn(['colors', 'primary', '500']) || ''; return soapboxConfig.set('brandColor', brandColor); @@ -249,7 +226,6 @@ export const normalizeSoapboxConfig = (soapboxConfig: Record) => { normalizePromoPanel(soapboxConfig); normalizeFooterLinks(soapboxConfig); maybeAddMissingColors(soapboxConfig); - normalizeCryptoAddresses(soapboxConfig); normalizeAds(soapboxConfig); normalizeAdsAlgorithm(soapboxConfig); upgradeSingleUserMode(soapboxConfig); diff --git a/app/soapbox/pages/home-page.tsx b/app/soapbox/pages/home-page.tsx index 6ed7b8eea..9193d4e54 100644 --- a/app/soapbox/pages/home-page.tsx +++ b/app/soapbox/pages/home-page.tsx @@ -12,7 +12,6 @@ import { SignUpPanel, PromoPanel, FundingPanel, - CryptoDonatePanel, BirthdayPanel, CtaBanner, AnnouncementsPanel, @@ -40,8 +39,6 @@ const HomePage: React.FC = ({ children }) => { const composeBlock = useRef(null); const hasPatron = soapboxConfig.extensions.getIn(['patron', 'enabled']) === true; - const hasCrypto = typeof soapboxConfig.cryptoAddresses.getIn([0, 'ticker']) === 'string'; - const cryptoLimit = soapboxConfig.cryptoDonatePanel.get('limit', 0); const { isDragging, isDraggedOver } = useDraggedFiles(composeBlock, (files) => { dispatch(uploadCompose(composeId, files, intl)); @@ -113,11 +110,6 @@ const HomePage: React.FC = ({ children }) => { {Component => } )} - {hasCrypto && cryptoLimit > 0 && ( - - {Component => } - - )} {Component => } diff --git a/app/soapbox/types/soapbox.ts b/app/soapbox/types/soapbox.ts index e9baff635..b088c28d8 100644 --- a/app/soapbox/types/soapbox.ts +++ b/app/soapbox/types/soapbox.ts @@ -1,7 +1,6 @@ import { PromoPanelItemRecord, FooterItemRecord, - CryptoAddressRecord, SoapboxConfigRecord, } from 'soapbox/normalizers/soapbox/soapbox-config'; @@ -9,17 +8,15 @@ type Me = string | null | false | undefined; type PromoPanelItem = ReturnType; type FooterItem = ReturnType; -type CryptoAddress = ReturnType; type SoapboxConfig = ReturnType; export { Me, PromoPanelItem, FooterItem, - CryptoAddress, SoapboxConfig, }; export type { Ad, -} from 'soapbox/schemas'; \ No newline at end of file +} from 'soapbox/schemas'; diff --git a/app/styles/application.scss b/app/styles/application.scss index f0a17c975..bed165334 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -23,7 +23,6 @@ @import 'components/search'; @import 'components/video-player'; @import 'components/audio-player'; -@import 'components/crypto-donate'; @import 'components/aliases'; @import 'components/icon'; @import 'forms'; diff --git a/app/styles/components/crypto-donate.scss b/app/styles/components/crypto-donate.scss deleted file mode 100644 index 08a1a8a09..000000000 --- a/app/styles/components/crypto-donate.scss +++ /dev/null @@ -1,47 +0,0 @@ -.crypto-address { - @apply flex flex-col p-5; - - &__head { - @apply flex items-center mb-1.5; - } - - &__title { - @apply font-bold; - } - - &__icon { - @apply flex items-start justify-center w-6 mr-2.5; - - img { - @apply w-full; - } - } - - &__actions { - @apply flex ml-auto; - - a { - @apply text-gray-400 ml-2; - } - - .svg-icon { - @apply h-4.5 w-4.5; - } - } - - &__note { - @apply mb-2.5; - } - - &__qrcode { - @apply flex items-center justify-center mb-3 p-2.5; - } - - &__address { - @apply mt-auto; - } -} - -.crypto-donate-modal .crypto-address { - @apply p-0; -} diff --git a/package.json b/package.json index d881a87cc..477dfd654 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,6 @@ "clsx": "^1.2.1", "copy-webpack-plugin": "^11.0.0", "core-js": "^3.27.2", - "cryptocurrency-icons": "^0.18.1", "css-loader": "^6.7.1", "cssnano": "^5.1.10", "detect-passive-events": "^2.0.0", diff --git a/webpack/production.ts b/webpack/production.ts index 119c2b92c..978d933f6 100644 --- a/webpack/production.ts +++ b/webpack/production.ts @@ -90,7 +90,6 @@ const configuration: Configuration = { '404.html', 'assets-manifest.json', // It would be nice to serve these, but they bloat up sw.js - 'packs/images/crypto/**/*', 'packs/emoji/**/*', ], ServiceWorker: { diff --git a/webpack/rules/assets.ts b/webpack/rules/assets.ts index 7df5aba9a..b5d2cd739 100644 --- a/webpack/rules/assets.ts +++ b/webpack/rules/assets.ts @@ -68,13 +68,6 @@ const rules: RuleSetRule[] = [{ generator: { filename: 'packs/icons/[name]-[contenthash:8][ext]', }, -}, { - test: /\.svg$/, - type: 'asset/resource', - include: resolve('node_modules', 'cryptocurrency-icons'), - generator: { - filename: 'packs/images/crypto/[name]-[contenthash:8][ext]', - }, }]; export default rules; diff --git a/yarn.lock b/yarn.lock index c58f38bc0..39e559b34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4580,11 +4580,6 @@ crypto-random-string@^2.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== -cryptocurrency-icons@^0.18.1: - version "0.18.1" - resolved "https://registry.yarnpkg.com/cryptocurrency-icons/-/cryptocurrency-icons-0.18.1.tgz#b1bdbfb4b78996ec003e63dbd7ec0b830d23b89c" - integrity sha512-dvR5O8JOmav3559Yb0Igpkia+3vpt/aeNvMu5ZIVUG2Bzpq9wNcOJRIQas49XJrPjtZ98GAEn3aDQO+w7uhS2w== - css-declaration-sorter@^6.3.1: version "6.4.1" resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-6.4.1.tgz#28beac7c20bad7f1775be3a7129d7eae409a3a71"