diff --git a/package.json b/package.json index 8e32a3aa..5164b4c1 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@emoji-mart/react": "1.1.1", "@emotion/react": "11.10.0", "@emotion/styled": "11.10.0", + "@getalby/bitcoin-connect-react": "2.4.2", "@joyid/nostr": "0.1.0", "@noble/hashes": "1.1.5", "@noble/secp256k1": "1.7.0", diff --git a/src/components/BitcoinConnect/BitcoinButton.tsx b/src/components/BitcoinConnect/BitcoinButton.tsx new file mode 100644 index 00000000..3fa0723b --- /dev/null +++ b/src/components/BitcoinConnect/BitcoinButton.tsx @@ -0,0 +1,19 @@ +import React from 'react'; +import { Button } from '@getalby/bitcoin-connect-react'; + +interface BitcoinButtonProps {} + +const BitcoinButton: React.FC = () => { + const handleConnect = () => { + + }; + + return ( +
+
+ ); +}; + +export default BitcoinButton; + diff --git a/src/components/PostItems/PostReactions/index.tsx b/src/components/PostItems/PostReactions/index.tsx index 99c77a41..3e7ae1f0 100644 --- a/src/components/PostItems/PostReactions/index.tsx +++ b/src/components/PostItems/PostReactions/index.tsx @@ -2,7 +2,7 @@ import { Tooltip, message } from 'antd'; import { useTranslation } from 'next-i18next'; import { fetchPublicBookmarkListEvent } from 'components/PostItems/PostReactions/util'; import { useReadonlyMyPublicKey } from 'hooks/useMyPublicKey'; -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { EventSetMetadataContent, @@ -24,6 +24,8 @@ import { dexieDb } from 'core/db'; import Icon from 'components/Icon'; import styles from './index.module.scss'; + + interface PostReactionsProp { ownerEvent: Event; worker: CallWorker; @@ -35,6 +37,14 @@ const PostReactions: React.FC = ({ worker, seen, }) => { + + + + // load bitcoin connect for zaps + import('@getalby/bitcoin-connect-react'); + + + const { t } = useTranslation(); const router = useRouter(); @@ -61,6 +71,8 @@ const PostReactions: React.FC = ({ }; const zap = async () => { + + if (signEvent == null) return; let zapEndpoint: any = null; @@ -133,8 +145,12 @@ const PostReactions: React.FC = ({ const handler = worker.pubEvent(event); noticePubEventResult(worker.relays.length, handler); setIsBookMarking(false); + + }; + + return (
    {contextHolder} diff --git a/src/pages/_app.page.tsx b/src/pages/_app.page.tsx index 499d31a0..624594e1 100644 --- a/src/pages/_app.page.tsx +++ b/src/pages/_app.page.tsx @@ -14,6 +14,7 @@ import { joyIdConfig } from 'core/joyid/config'; import Head from 'next/head'; import theme from 'constants/theme'; + type NextPageWithLayout = NextPage & { getLayout?: (page: ReactNode) => ReactElement; }; diff --git a/src/pages/setting/index.module.scss b/src/pages/setting/index.module.scss index 8d0c90d5..d4bc4d00 100644 --- a/src/pages/setting/index.module.scss +++ b/src/pages/setting/index.module.scss @@ -11,3 +11,4 @@ .about { text-align: center; } + diff --git a/src/pages/setting/preference.tsx b/src/pages/setting/preference.tsx index 3d343771..01a02982 100644 --- a/src/pages/setting/preference.tsx +++ b/src/pages/setting/preference.tsx @@ -17,6 +17,9 @@ import { RelayGroup } from 'core/relay/group'; import { useReadonlyMyPublicKey } from 'hooks/useMyPublicKey'; import { useEffect, useState } from 'react'; import { exportDB } from 'dexie-export-import'; +import BitcoinButton from 'components/BitcoinConnect/BitcoinButton'; + + export default function Preference() { const myPublicKey = useReadonlyMyPublicKey(); @@ -98,7 +101,7 @@ export default function Preference() { duration: 0, }); - // Function to close the loading message when called + const closeLoadingMessage = () => { message.destroy(key); }; @@ -159,6 +162,16 @@ export default function Preference() { Zap Amount + + , + ]} + > + Bitcoin Connect + + Database