feat: rizful
This commit is contained in:
@@ -28,6 +28,7 @@ import { NotificationProvider } from './providers/NotificationProvider'
|
||||
import { useScreenSize } from './providers/ScreenSizeProvider'
|
||||
import { routes } from './routes'
|
||||
import modalManager from './services/modal-manager.service'
|
||||
import CreateWalletGuideToast from './components/CreateWalletGuideToast'
|
||||
|
||||
export type TPrimaryPageName = keyof typeof PRIMARY_PAGE_MAP
|
||||
|
||||
@@ -321,6 +322,7 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
|
||||
))}
|
||||
<BottomNavigationBar />
|
||||
<TooManyRelaysAlertDialog />
|
||||
<CreateWalletGuideToast />
|
||||
</NotificationProvider>
|
||||
</CurrentRelaysProvider>
|
||||
</SecondaryPageContext.Provider>
|
||||
@@ -382,6 +384,7 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
|
||||
</div>
|
||||
</div>
|
||||
<TooManyRelaysAlertDialog />
|
||||
<CreateWalletGuideToast />
|
||||
</NotificationProvider>
|
||||
</CurrentRelaysProvider>
|
||||
</SecondaryPageContext.Provider>
|
||||
|
||||
31
src/components/CreateWalletGuideToast/index.tsx
Normal file
31
src/components/CreateWalletGuideToast/index.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { toWallet } from '@/lib/link'
|
||||
import { useSecondaryPage } from '@/PageManager'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import storage from '@/services/local-storage.service'
|
||||
import { useEffect } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
export default function CreateWalletGuideToast() {
|
||||
const { t } = useTranslation()
|
||||
const { push } = useSecondaryPage()
|
||||
const { profile } = useNostr()
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
profile &&
|
||||
!profile.lightningAddress &&
|
||||
!storage.hasShownCreateWalletGuideToast(profile.pubkey)
|
||||
) {
|
||||
toast(t('Set up your wallet to send and receive sats!'), {
|
||||
action: {
|
||||
label: t('Set up'),
|
||||
onClick: () => push(toWallet())
|
||||
}
|
||||
})
|
||||
storage.markCreateWalletGuideToastAsShown(profile.pubkey)
|
||||
}
|
||||
}, [profile])
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -17,7 +17,7 @@ const buttonVariants = cva(
|
||||
'secondary-2': 'bg-secondary text-secondary-foreground hover:bg-primary',
|
||||
ghost: 'clickable hover:text-accent-foreground',
|
||||
'ghost-destructive': 'cursor-pointer hover:bg-destructive/20 text-destructive',
|
||||
link: 'text-primary underline-offset-4 hover:underline'
|
||||
link: 'text-foreground underline-offset-4 hover:underline'
|
||||
},
|
||||
size: {
|
||||
default: 'h-9 px-4 py-2',
|
||||
|
||||
@@ -47,6 +47,7 @@ export const StorageKey = {
|
||||
HIDE_CONTENT_MENTIONING_MUTED_USERS: 'hideContentMentioningMutedUsers',
|
||||
NOTIFICATION_LIST_STYLE: 'notificationListStyle',
|
||||
MEDIA_AUTO_LOAD_POLICY: 'mediaAutoLoadPolicy',
|
||||
SHOWN_CREATE_WALLET_GUIDE_TOAST_PUBKEYS: 'shownCreateWalletGuideToastPubkeys',
|
||||
MEDIA_UPLOAD_SERVICE: 'mediaUploadService', // deprecated
|
||||
HIDE_UNTRUSTED_EVENTS: 'hideUntrustedEvents', // deprecated
|
||||
ACCOUNT_RELAY_LIST_EVENT_MAP: 'accountRelayListEventMap', // deprecated
|
||||
|
||||
@@ -421,6 +421,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'مرحلات الكتابة و {{count}} مرحل آخر',
|
||||
'{{count}} relays': '{{count}} ريلايات',
|
||||
'Republishing...': 'جارٍ إعادة النشر...',
|
||||
'Trending Notes': 'الملاحظات الرائجة'
|
||||
'Trending Notes': 'الملاحظات الرائجة',
|
||||
'Connected to': 'متصل بـ',
|
||||
'Disconnect Wallet': 'قطع الاتصال بالمحفظة',
|
||||
'Are you absolutely sure?': 'هل أنت متأكد تماماً؟',
|
||||
'You will not be able to send zaps to others.': 'لن تتمكن من إرسال zaps للآخرين.',
|
||||
Disconnect: 'قطع الاتصال',
|
||||
'Start with a Rizful Vault': 'ابدأ بمحفظة Rizful',
|
||||
'or other wallets': 'أو محافظ أخرى',
|
||||
'Rizful Vault': 'محفظة Rizful',
|
||||
'Rizful Vault connected!': 'تم توصيل محفظة Rizful!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'يمكنك الآن استخدام محفظة Rizful الخاصة بك لإرسال zap إلى ملاحظاتك والمبدعين المفضلين لديك.',
|
||||
'Your Lightning Address': 'عنوان Lightning الخاص بك',
|
||||
'New to Rizful?': 'جديد في Rizful؟',
|
||||
'Sign up for Rizful': 'سجل في Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'إذا كان لديك حساب Rizful بالفعل، يمكنك تخطي هذه الخطوة.',
|
||||
'Get your one-time code': 'احصل على رمز الاستخدام مرة واحدة',
|
||||
'Get code': 'احصل على الرمز',
|
||||
'Connect to your Rizful Vault': 'الاتصال بمحفظة Rizful الخاصة بك',
|
||||
'Paste your one-time code here': 'الصق رمز الاستخدام مرة واحدة هنا',
|
||||
Connect: 'اتصال'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,6 +433,28 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Schreib-Relays und {{count}} andere Relays',
|
||||
'{{count}} relays': '{{count}} Relays',
|
||||
'Republishing...': 'Wird erneut veröffentlicht...',
|
||||
'Trending Notes': 'Trendende Notizen'
|
||||
'Trending Notes': 'Trendende Notizen',
|
||||
'Connected to': 'Verbunden mit',
|
||||
'Disconnect Wallet': 'Wallet trennen',
|
||||
'Are you absolutely sure?': 'Bist du dir absolut sicher?',
|
||||
'You will not be able to send zaps to others.':
|
||||
'Du wirst keine Zaps mehr an andere senden können.',
|
||||
Disconnect: 'Trennen',
|
||||
'Start with a Rizful Vault': 'Starte mit einem Rizful Vault',
|
||||
'or other wallets': 'oder andere Wallets',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault verbunden!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Du kannst jetzt dein Rizful Vault verwenden, um deine Lieblingsnotizen und -ersteller zu zapen.',
|
||||
'Your Lightning Address': 'Deine Lightning-Adresse',
|
||||
'New to Rizful?': 'Neu bei Rizful?',
|
||||
'Sign up for Rizful': 'Registriere dich bei Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Wenn du bereits ein Rizful-Konto hast, kannst du diesen Schritt überspringen.',
|
||||
'Get your one-time code': 'Hole dir deinen Einmal-Code',
|
||||
'Get code': 'Code holen',
|
||||
'Connect to your Rizful Vault': 'Verbinde dich mit deinem Rizful Vault',
|
||||
'Paste your one-time code here': 'Füge hier deinen Einmal-Code ein',
|
||||
Connect: 'Verbinden'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,6 +420,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Write relays and {{count}} other relays',
|
||||
'{{count}} relays': '{{count}} relays',
|
||||
'Republishing...': 'Republishing...',
|
||||
'Trending Notes': 'Trending Notes'
|
||||
'Trending Notes': 'Trending Notes',
|
||||
'Connected to': 'Connected to',
|
||||
'Disconnect Wallet': 'Disconnect Wallet',
|
||||
'Are you absolutely sure?': 'Are you absolutely sure?',
|
||||
'You will not be able to send zaps to others.': 'You will not be able to send zaps to others.',
|
||||
Disconnect: 'Disconnect',
|
||||
'Start with a Rizful Vault': 'Start with a Rizful Vault',
|
||||
'or other wallets': 'or other wallets',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault connected!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.',
|
||||
'Your Lightning Address': 'Your Lightning Address',
|
||||
'New to Rizful?': 'New to Rizful?',
|
||||
'Sign up for Rizful': 'Sign up for Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'If you already have a Rizful account, you can skip this step.',
|
||||
'Get your one-time code': 'Get your one-time code',
|
||||
'Get code': 'Get code',
|
||||
'Connect to your Rizful Vault': 'Connect to your Rizful Vault',
|
||||
'Paste your one-time code here': 'Paste your one-time code here',
|
||||
Connect: 'Connect'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +428,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Relés de escritura y {{count}} otros relés',
|
||||
'{{count}} relays': '{{count}} relés',
|
||||
'Republishing...': 'Republicando...',
|
||||
'Trending Notes': 'Notas de tendencia'
|
||||
'Trending Notes': 'Notas de tendencia',
|
||||
'Connected to': 'Conectado a',
|
||||
'Disconnect Wallet': 'Desconectar billetera',
|
||||
'Are you absolutely sure?': '¿Estás absolutamente seguro?',
|
||||
'You will not be able to send zaps to others.': 'No podrás enviar zaps a otros.',
|
||||
Disconnect: 'Desconectar',
|
||||
'Start with a Rizful Vault': 'Comienza con una Bóveda Rizful',
|
||||
'or other wallets': 'o otras billeteras',
|
||||
'Rizful Vault': 'Bóveda Rizful',
|
||||
'Rizful Vault connected!': '¡Bóveda Rizful conectada!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Ahora puedes usar tu Bóveda Rizful para zapear tus notas y creadores favoritos.',
|
||||
'Your Lightning Address': 'Tu Dirección Lightning',
|
||||
'New to Rizful?': '¿Nuevo en Rizful?',
|
||||
'Sign up for Rizful': 'Regístrate en Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Si ya tienes una cuenta de Rizful, puedes omitir este paso.',
|
||||
'Get your one-time code': 'Obtén tu código de un solo uso',
|
||||
'Get code': 'Obtener código',
|
||||
'Connect to your Rizful Vault': 'Conéctate a tu Bóveda Rizful',
|
||||
'Paste your one-time code here': 'Pega tu código de un solo uso aquí',
|
||||
Connect: 'Conectar'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,6 +423,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'رلههای نوشتن و {{count}} رله دیگر',
|
||||
'{{count}} relays': '{{count}} رله',
|
||||
'Republishing...': 'در حال بازنشر...',
|
||||
'Trending Notes': 'یادداشتهای محبوب'
|
||||
'Trending Notes': 'یادداشتهای محبوب',
|
||||
'Connected to': 'متصل به',
|
||||
'Disconnect Wallet': 'قطع اتصال کیف پول',
|
||||
'Are you absolutely sure?': 'آیا کاملاً مطمئن هستید؟',
|
||||
'You will not be able to send zaps to others.': 'شما قادر نخواهید بود به دیگران زپ ارسال کنید.',
|
||||
Disconnect: 'قطع اتصال',
|
||||
'Start with a Rizful Vault': 'شروع با Rizful Vault',
|
||||
'or other wallets': 'یا کیف پولهای دیگر',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault متصل شد!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'اکنون میتوانید از Rizful Vault خود برای زپ کردن یادداشتها و سازندگان مورد علاقه خود استفاده کنید.',
|
||||
'Your Lightning Address': 'آدرس لایتنینگ شما',
|
||||
'New to Rizful?': 'جدید در Rizful؟',
|
||||
'Sign up for Rizful': 'برای Rizful ثبت نام کنید',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'اگر قبلاً حساب Rizful دارید، میتوانید این مرحله را رد کنید.',
|
||||
'Get your one-time code': 'کد یکبار مصرف خود را دریافت کنید',
|
||||
'Get code': 'دریافت کد',
|
||||
'Connect to your Rizful Vault': 'اتصال به Rizful Vault خود',
|
||||
'Paste your one-time code here': 'کد یکبار مصرف خود را اینجا بچسبانید',
|
||||
Connect: 'اتصال'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,6 +432,28 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Relais d’écriture et {{count}} autres relais',
|
||||
'{{count}} relays': '{{count}} relais',
|
||||
'Republishing...': 'Republication en cours...',
|
||||
'Trending Notes': 'Notes tendance'
|
||||
'Trending Notes': 'Notes tendance',
|
||||
'Connected to': 'Connecté à',
|
||||
'Disconnect Wallet': 'Déconnecter le portefeuille',
|
||||
'Are you absolutely sure?': 'Êtes-vous absolument sûr ?',
|
||||
'You will not be able to send zaps to others.':
|
||||
'Vous ne pourrez plus envoyer de zaps aux autres.',
|
||||
Disconnect: 'Déconnecter',
|
||||
'Start with a Rizful Vault': 'Démarrer avec un coffre Rizful',
|
||||
'or other wallets': 'ou d’autres portefeuilles',
|
||||
'Rizful Vault': 'Coffre Rizful',
|
||||
'Rizful Vault connected!': 'Coffre Rizful connecté !',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Vous pouvez maintenant utiliser votre coffre Rizful pour zapper vos notes et créateurs préférés.',
|
||||
'Your Lightning Address': 'Votre adresse Lightning',
|
||||
'New to Rizful?': 'Nouveau sur Rizful ?',
|
||||
'Sign up for Rizful': 'Inscrivez-vous sur Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Si vous avez déjà un compte Rizful, vous pouvez passer cette étape.',
|
||||
'Get your one-time code': 'Obtenez votre code à usage unique',
|
||||
'Get code': 'Obtenir le code',
|
||||
'Connect to your Rizful Vault': 'Connectez-vous à votre coffre Rizful',
|
||||
'Paste your one-time code here': 'Collez votre code à usage unique ici',
|
||||
Connect: 'Connecter'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +425,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'राइट रिले और {{count}} अन्य रिले',
|
||||
'{{count}} relays': '{{count}} रिले',
|
||||
'Republishing...': 'पुनः प्रकाशित कर रहे हैं...',
|
||||
'Trending Notes': 'ट्रेंडिंग नोट्स'
|
||||
'Trending Notes': 'ट्रेंडिंग नोट्स',
|
||||
'Connected to': 'से कनेक्टेड',
|
||||
'Disconnect Wallet': 'वॉलेट डिस्कनेक्ट करें',
|
||||
'Are you absolutely sure?': 'क्या आप पूरी तरह से सुनिश्चित हैं?',
|
||||
'You will not be able to send zaps to others.': 'आप दूसरों को जैप नहीं भेज पाएंगे।',
|
||||
Disconnect: 'डिस्कनेक्ट करें',
|
||||
'Start with a Rizful Vault': 'Rizful वॉल्ट के साथ शुरू करें',
|
||||
'or other wallets': 'या अन्य वॉलेट',
|
||||
'Rizful Vault': 'Rizful वॉल्ट',
|
||||
'Rizful Vault connected!': 'Rizful वॉल्ट कनेक्टेड!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'अब आप अपने Rizful वॉल्ट का उपयोग अपने पसंदीदा नोट्स और क्रिएटर्स को जैप करने के लिए कर सकते हैं।',
|
||||
'Your Lightning Address': 'आपका लाइटनिंग पता',
|
||||
'New to Rizful?': 'Rizful में नया?',
|
||||
'Sign up for Rizful': 'Rizful के लिए साइन अप करें',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'यदि आपके पास पहले से ही एक Rizful अकाउंट है, तो आप इस चरण को छोड़ सकते हैं।',
|
||||
'Get your one-time code': 'अपना वन-टाइम कोड प्राप्त करें',
|
||||
'Get code': 'कोड प्राप्त करें',
|
||||
'Connect to your Rizful Vault': 'अपने Rizful वॉल्ट से कनेक्ट करें',
|
||||
'Paste your one-time code here': 'अपना वन-टाइम कोड यहां पेस्ट करें',
|
||||
Connect: 'कनेक्ट करें'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +428,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Relay di scrittura e {{count}} altri relay',
|
||||
'{{count}} relays': '{{count}} relay',
|
||||
'Republishing...': 'Ricondivisione in corso...',
|
||||
'Trending Notes': 'Note di tendenza'
|
||||
'Trending Notes': 'Note di tendenza',
|
||||
'Connected to': 'Connesso a',
|
||||
'Disconnect Wallet': 'Disconnetti Wallet',
|
||||
'Are you absolutely sure?': 'Sei assolutamente sicuro?',
|
||||
'You will not be able to send zaps to others.': 'Non sarai in grado di inviare zaps ad altri.',
|
||||
Disconnect: 'Disconnetti',
|
||||
'Start with a Rizful Vault': 'Inizia con un Rizful Vault',
|
||||
'or other wallets': 'o altri wallet',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault connesso!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Puoi ora usare il tuo Rizful Vault per zappare le tue note e creatori preferiti.',
|
||||
'Your Lightning Address': 'Il tuo Indirizzo Lightning',
|
||||
'New to Rizful?': 'Nuovo a Rizful?',
|
||||
'Sign up for Rizful': 'Iscriviti a Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Se hai già un account Rizful, puoi saltare questo passaggio.',
|
||||
'Get your one-time code': 'Ottieni il tuo codice monouso',
|
||||
'Get code': 'Ottieni codice',
|
||||
'Connect to your Rizful Vault': 'Connettiti al tuo Rizful Vault',
|
||||
'Paste your one-time code here': 'Incolla qui il tuo codice monouso',
|
||||
Connect: 'Connetti'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,6 +424,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': '書き込みリレーと他の {{count}} 個のリレー',
|
||||
'{{count}} relays': '{{count}} 個のリレー',
|
||||
'Republishing...': '再公開中...',
|
||||
'Trending Notes': '注目のノート'
|
||||
'Trending Notes': '注目のノート',
|
||||
'Connected to': '接続先',
|
||||
'Disconnect Wallet': 'ウォレットの接続を解除',
|
||||
'Are you absolutely sure?': '本当に確かですか?',
|
||||
'You will not be able to send zaps to others.': '他の人にZapを送信できなくなります。',
|
||||
Disconnect: '接続解除',
|
||||
'Start with a Rizful Vault': 'Rizful Vaultで始める',
|
||||
'or other wallets': 'または他のウォレット',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vaultが接続されました!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'これで、Rizful Vaultを使用してお気に入りのノートやクリエイターにZapを送信できます。',
|
||||
'Your Lightning Address': 'あなたのライトニングアドレス',
|
||||
'New to Rizful?': 'Rizfulを初めて利用しますか?',
|
||||
'Sign up for Rizful': 'Rizfulにサインアップ',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'すでにRizfulアカウントをお持ちの場合は、このステップをスキップできます。',
|
||||
'Get your one-time code': 'ワンタイムコードを取得',
|
||||
'Get code': 'コードを取得',
|
||||
'Connect to your Rizful Vault': 'Rizful Vaultに接続',
|
||||
'Paste your one-time code here': 'ここにワンタイムコードを貼り付けてください',
|
||||
Connect: '接続'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,6 +424,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': '쓰기 릴레이 및 기타 {{count}}개 릴레이',
|
||||
'{{count}} relays': '{{count}}개 릴레이',
|
||||
'Republishing...': '다시 게시 중...',
|
||||
'Trending Notes': '트렌딩 노트'
|
||||
'Trending Notes': '트렌딩 노트',
|
||||
'Connected to': '연결됨',
|
||||
'Disconnect Wallet': '지갑 연결 해제',
|
||||
'Are you absolutely sure?': '정말 확실합니까?',
|
||||
'You will not be able to send zaps to others.': '다른 사람에게 잽을 보낼 수 없습니다.',
|
||||
Disconnect: '연결 해제',
|
||||
'Start with a Rizful Vault': 'Rizful Vault로 시작하기',
|
||||
'or other wallets': '또는 다른 지갑',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault 연결됨!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'이제 Rizful Vault를 사용하여 좋아하는 노트와 크리에이터에게 잽을 보낼 수 있습니다.',
|
||||
'Your Lightning Address': '귀하의 라이트닝 주소',
|
||||
'New to Rizful?': 'Rizful이 처음이신가요?',
|
||||
'Sign up for Rizful': 'Rizful에 가입하기',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'이미 Rizful 계정이 있다면 이 단계를 건너뛸 수 있습니다.',
|
||||
'Get your one-time code': '일회용 코드 받기',
|
||||
'Get code': '코드 받기',
|
||||
'Connect to your Rizful Vault': 'Rizful Vault에 연결',
|
||||
'Paste your one-time code here': '여기에 일회용 코드를 붙여넣기',
|
||||
Connect: '연결'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +428,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Przekaźniki zapisu i {{count}} innych przekaźników',
|
||||
'{{count}} relays': '{{count}} przekaźników',
|
||||
'Republishing...': 'Ponowne publikowanie...',
|
||||
'Trending Notes': 'Popularne wpisy'
|
||||
'Trending Notes': 'Popularne wpisy',
|
||||
'Connected to': 'Połączono z',
|
||||
'Disconnect Wallet': 'Odłącz portfel',
|
||||
'Are you absolutely sure?': 'Czy jesteś całkowicie pewien?',
|
||||
'You will not be able to send zaps to others.': 'Nie będziesz mógł wysyłać zapów innym.',
|
||||
Disconnect: 'Odłącz',
|
||||
'Start with a Rizful Vault': 'Zacznij od Rizful Vault',
|
||||
'or other wallets': 'Lub inne portfele',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault połączony!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Możesz teraz używać swojego Rizful Vault, aby zapować swoje ulubione notatki i twórców.',
|
||||
'Your Lightning Address': 'Twój Lightning Adres',
|
||||
'New to Rizful?': 'Nowy w Rizful?',
|
||||
'Sign up for Rizful': 'Zarejestruj się w Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Jeśli masz już konto Rizful, możesz pominąć ten krok.',
|
||||
'Get your one-time code': 'Uzyskaj swój jednorazowy kod',
|
||||
'Get code': 'Uzyskaj kod',
|
||||
'Connect to your Rizful Vault': 'Połącz się ze swoim Rizful Vault',
|
||||
'Paste your one-time code here': 'Wklej tutaj swój jednorazowy kod',
|
||||
Connect: 'Połącz'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +425,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Relays de escrita e {{count}} outros relays',
|
||||
'{{count}} relays': '{{count}} relays',
|
||||
'Republishing...': 'Republicando...',
|
||||
'Trending Notes': 'Notas em tendência'
|
||||
'Trending Notes': 'Notas em tendência',
|
||||
'Connected to': 'Conectado a',
|
||||
'Disconnect Wallet': 'Desconectar carteira',
|
||||
'Are you absolutely sure?': 'Você tem certeza absoluta?',
|
||||
'You will not be able to send zaps to others.': 'Você não poderá enviar zaps para outros.',
|
||||
Disconnect: 'Desconectar',
|
||||
'Start with a Rizful Vault': 'Comece com um Cofre Rizful',
|
||||
'or other wallets': 'ou outras carteiras',
|
||||
'Rizful Vault': 'Cofre Rizful',
|
||||
'Rizful Vault connected!': 'Cofre Rizful conectado!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Você pode agora usar seu Cofre Rizful para zapear suas notas e criadores favoritos.',
|
||||
'Your Lightning Address': 'Seu Endereço Lightning',
|
||||
'New to Rizful?': 'Novo no Rizful?',
|
||||
'Sign up for Rizful': 'Inscreva-se no Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Se você já tem uma conta Rizful, pode pular esta etapa.',
|
||||
'Get your one-time code': 'Obtenha seu código único',
|
||||
'Get code': 'Obter código',
|
||||
'Connect to your Rizful Vault': 'Conecte-se ao seu Cofre Rizful',
|
||||
'Paste your one-time code here': 'Cole seu código único aqui',
|
||||
Connect: 'Conectar'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +428,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'Relays de escrita e {{count}} outros relays',
|
||||
'{{count}} relays': '{{count}} relays',
|
||||
'Republishing...': 'Republicando...',
|
||||
'Trending Notes': 'Notas em Tendência'
|
||||
'Trending Notes': 'Notas em Tendência',
|
||||
'Connected to': 'Conectado a',
|
||||
'Disconnect Wallet': 'Desconectar Carteira',
|
||||
'Are you absolutely sure?': 'Tem certeza absoluta?',
|
||||
'You will not be able to send zaps to others.': 'Você não poderá enviar zaps para outros.',
|
||||
Disconnect: 'Desconectar',
|
||||
'Start with a Rizful Vault': 'Comece com um Cofre Rizful',
|
||||
'or other wallets': 'outras carteiras',
|
||||
'Rizful Vault': 'Cofre Rizful',
|
||||
'Rizful Vault connected!': 'Cofre Rizful conectado!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Agora você pode usar seu Cofre Rizful para zapear suas notas e criadores favoritos.',
|
||||
'Your Lightning Address': 'Seu Endereço Lightning',
|
||||
'New to Rizful?': 'Novo no Rizful?',
|
||||
'Sign up for Rizful': 'Inscreva-se no Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Se você já tem uma conta Rizful, pode pular esta etapa.',
|
||||
'Get your one-time code': 'Obtenha seu código único',
|
||||
'Get code': 'Obter código',
|
||||
'Connect to your Rizful Vault': 'Conecte-se ao seu Cofre Rizful',
|
||||
'Paste your one-time code here': 'Cole seu código único aqui',
|
||||
Connect: 'Conectar'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,6 +430,27 @@ export default {
|
||||
'Ретрансляторы записи и {{count}} других ретрансляторов',
|
||||
'{{count}} relays': '{{count}} ретрансляторов',
|
||||
'Republishing...': 'Ретрансляция...',
|
||||
'Trending Notes': 'Популярные заметки'
|
||||
'Trending Notes': 'Популярные заметки',
|
||||
'Connected to': 'Подключено к',
|
||||
'Disconnect Wallet': 'Отключить кошелёк',
|
||||
'Are you absolutely sure?': 'Вы абсолютно уверены?',
|
||||
'You will not be able to send zaps to others.': 'Вы не сможете отправлять запы другим.',
|
||||
Disconnect: 'Отключить',
|
||||
'Start with a Rizful Vault': 'Начать с Rizful Vault',
|
||||
'or other wallets': 'или другие кошельки',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault подключён!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'Теперь вы можете использовать свой Rizful Vault, чтобы заппить ваши любимые заметки и создателей.',
|
||||
'Your Lightning Address': 'Ваш Lightning-адрес',
|
||||
'New to Rizful?': 'Новичок в Rizful?',
|
||||
'Sign up for Rizful': 'Зарегистрируйтесь на Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'Если у вас уже есть аккаунт Rizful, вы можете пропустить этот шаг.',
|
||||
'Get your one-time code': 'Получите ваш одноразовый код',
|
||||
'Get code': 'Получить код',
|
||||
'Connect to your Rizful Vault': 'Подключитесь к вашему Rizful Vault',
|
||||
'Paste your one-time code here': 'Вставьте ваш одноразовый код здесь',
|
||||
Connect: 'Подключить'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +419,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': 'รีเลย์เขียนและรีเลย์อื่น ๆ {{count}} ตัว',
|
||||
'{{count}} relays': 'รีเลย์ {{count}} ตัว',
|
||||
'Republishing...': 'กำลังเผยแพร่ซ้ำ...',
|
||||
'Trending Notes': 'โน้ตยอดนิยม'
|
||||
'Trending Notes': 'โน้ตยอดนิยม',
|
||||
'Connected to': 'เชื่อมต่อกับ',
|
||||
'Disconnect Wallet': 'ตัดการเชื่อมต่อกระเป๋าสตางค์',
|
||||
'Are you absolutely sure?': 'คุณแน่ใจอย่างยิ่งหรือไม่?',
|
||||
'You will not be able to send zaps to others.': 'คุณจะไม่สามารถส่งซาตส์ไปยังผู้อื่นได้',
|
||||
Disconnect: 'ตัดการเชื่อมต่อ',
|
||||
'Start with a Rizful Vault': 'เริ่มต้นด้วย Rizful Vault',
|
||||
'or other wallets': 'หรือกระเป๋าสตางค์อื่นๆ',
|
||||
'Rizful Vault': 'Rizful Vault',
|
||||
'Rizful Vault connected!': 'Rizful Vault เชื่อมต่อแล้ว!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'คุณสามารถใช้ Rizful Vault ของคุณเพื่อส่งซาตส์ไปยังโน้ตและผู้สร้างที่คุณชื่นชอบได้แล้ว',
|
||||
'Your Lightning Address': 'ที่อยู่ Lightning ของคุณ',
|
||||
'New to Rizful?': 'ใหม่กับ Rizful?',
|
||||
'Sign up for Rizful': 'สมัครสมาชิก Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'หากคุณมีบัญชี Rizful อยู่แล้ว คุณสามารถข้ามขั้นตอนนี้ได้',
|
||||
'Get your one-time code': 'รับรหัสใช้ครั้งเดียวของคุณ',
|
||||
'Get code': 'รับรหัส',
|
||||
'Connect to your Rizful Vault': 'เชื่อมต่อกับ Rizful Vault ของคุณ',
|
||||
'Paste your one-time code here': 'วางรหัสใช้ครั้งเดียวของคุณที่นี่',
|
||||
Connect: 'เชื่อมต่อ'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,6 +417,27 @@ export default {
|
||||
'Write relays and {{count}} other relays': '写服务器和其他 {{count}} 个服务器',
|
||||
'{{count}} relays': '{{count}} 个服务器',
|
||||
'Republishing...': '正在重新发布...',
|
||||
'Trending Notes': '热门笔记'
|
||||
'Trending Notes': '热门笔记',
|
||||
'Connected to': '已连接到',
|
||||
'Disconnect Wallet': '断开钱包连接',
|
||||
'Are you absolutely sure?': '您确定吗?',
|
||||
'You will not be able to send zaps to others.': '您将无法向他人发送打闪。',
|
||||
Disconnect: '断开连接',
|
||||
'Start with a Rizful Vault': '从 Rizful 钱包开始',
|
||||
'or other wallets': '或其他钱包',
|
||||
'Rizful Vault': 'Rizful 钱包',
|
||||
'Rizful Vault connected!': 'Rizful 钱包已连接!',
|
||||
'You can now use your Rizful Vault to zap your favorite notes and creators.':
|
||||
'您现在可以使用您的 Rizful 钱包为您喜欢的笔记和创作者打闪。',
|
||||
'Your Lightning Address': '您的闪电地址',
|
||||
'New to Rizful?': '第一次使用 Rizful?',
|
||||
'Sign up for Rizful': '注册 Rizful',
|
||||
'If you already have a Rizful account, you can skip this step.':
|
||||
'如果您已经有一个 Rizful 账户,可以跳过此步骤。',
|
||||
'Get your one-time code': '获取一次性代码',
|
||||
'Get code': '获取代码',
|
||||
'Connect to your Rizful Vault': '连接到您的 Rizful 钱包',
|
||||
'Paste your one-time code here': '将您的一次性代码粘贴到此处',
|
||||
Connect: '连接'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ export const toProfileEditor = () => '/profile-editor'
|
||||
export const toRelay = (url: string) => `/relays/${encodeURIComponent(url)}`
|
||||
export const toRelayReviews = (url: string) => `/relays/${encodeURIComponent(url)}/reviews`
|
||||
export const toMuteList = () => '/mutes'
|
||||
export const toRizful = () => '/rizful'
|
||||
|
||||
export const toChachiChat = (relay: string, d: string) => {
|
||||
return `https://chachi.chat/${relay.replace(/^wss?:\/\//, '').replace(/\/$/, '')}/${d}`
|
||||
|
||||
@@ -65,21 +65,6 @@ const ProfileEditorPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
return
|
||||
}
|
||||
|
||||
let lud06 = profile.lud06
|
||||
let lud16 = profile.lud16
|
||||
if (lightningAddress) {
|
||||
if (isEmail(lightningAddress)) {
|
||||
lud16 = lightningAddress
|
||||
} else if (lightningAddress.startsWith('lnurl')) {
|
||||
lud06 = lightningAddress
|
||||
} else {
|
||||
setLightningAddressError(t('Invalid Lightning Address'))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
setSaving(true)
|
||||
setHasChanged(false)
|
||||
const oldProfileContent = profileEvent ? JSON.parse(profileEvent.content) : {}
|
||||
const newProfileContent = {
|
||||
...oldProfileContent,
|
||||
@@ -90,10 +75,24 @@ const ProfileEditorPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
website,
|
||||
nip05,
|
||||
banner,
|
||||
picture: avatar,
|
||||
lud06,
|
||||
lud16
|
||||
picture: avatar
|
||||
}
|
||||
|
||||
if (lightningAddress) {
|
||||
if (isEmail(lightningAddress)) {
|
||||
newProfileContent.lud16 = lightningAddress
|
||||
} else if (lightningAddress.startsWith('lnurl')) {
|
||||
newProfileContent.lud06 = lightningAddress
|
||||
} else {
|
||||
setLightningAddressError(t('Invalid Lightning Address'))
|
||||
return
|
||||
}
|
||||
} else {
|
||||
delete newProfileContent.lud16
|
||||
}
|
||||
|
||||
setSaving(true)
|
||||
setHasChanged(false)
|
||||
const profileDraftEvent = createProfileDraftEvent(
|
||||
JSON.stringify(newProfileContent),
|
||||
profileEvent?.tags
|
||||
|
||||
203
src/pages/secondary/RizfulPage/index.tsx
Normal file
203
src/pages/secondary/RizfulPage/index.tsx
Normal file
@@ -0,0 +1,203 @@
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { createProfileDraftEvent } from '@/lib/draft-event'
|
||||
import { isEmail } from '@/lib/utils'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useZap } from '@/providers/ZapProvider'
|
||||
import { connectNWC, WebLNProviders } from '@getalby/bitcoin-connect'
|
||||
import { Check, CheckCircle2, Copy, ExternalLink, Loader2 } from 'lucide-react'
|
||||
import { forwardRef, useEffect, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { toast } from 'sonner'
|
||||
|
||||
const RIZFUL_URL = 'https://rizful.com'
|
||||
const RIZFUL_SIGNUP_URL = `${RIZFUL_URL}/create-account`
|
||||
const RIZFUL_GET_TOKEN_URL = `${RIZFUL_URL}/nostr_onboarding_auth_token/get_token`
|
||||
const RIZFUL_TOKEN_EXCHANGE_URL = `${RIZFUL_URL}/nostr_onboarding_auth_token/post_for_secrets`
|
||||
|
||||
const RizfulPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
const { t } = useTranslation()
|
||||
const { pubkey, profile, profileEvent, publish, updateProfileEvent } = useNostr()
|
||||
const { provider } = useZap()
|
||||
const [token, setToken] = useState('')
|
||||
const [connecting, setConnecting] = useState(false)
|
||||
const [connected, setConnected] = useState(false)
|
||||
const [copiedLightningAddress, setCopiedLightningAddress] = useState(false)
|
||||
const [lightningAddress, setLightningAddress] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
if (provider instanceof WebLNProviders.NostrWebLNProvider) {
|
||||
const lud16 = provider.client.lud16
|
||||
const domain = lud16?.split('@')[1]
|
||||
if (domain !== 'rizful.com') return
|
||||
|
||||
if (lud16) {
|
||||
setConnected(true)
|
||||
setLightningAddress(lud16)
|
||||
}
|
||||
}
|
||||
}, [provider])
|
||||
|
||||
const updateUserProfile = async (address: string) => {
|
||||
try {
|
||||
if (address === profile?.lightningAddress) {
|
||||
return
|
||||
}
|
||||
|
||||
const profileContent = profileEvent ? JSON.parse(profileEvent.content) : {}
|
||||
if (isEmail(address)) {
|
||||
profileContent.lud16 = address
|
||||
} else if (address.startsWith('lnurl')) {
|
||||
profileContent.lud06 = address
|
||||
} else {
|
||||
throw new Error(t('Invalid Lightning Address'))
|
||||
}
|
||||
|
||||
if (!profileContent.nip05) {
|
||||
profileContent.nip05 = address
|
||||
}
|
||||
|
||||
const profileDraftEvent = createProfileDraftEvent(
|
||||
JSON.stringify(profileContent),
|
||||
profileEvent?.tags
|
||||
)
|
||||
const newProfileEvent = await publish(profileDraftEvent)
|
||||
await updateProfileEvent(newProfileEvent)
|
||||
} catch (e: unknown) {
|
||||
toast.error(e instanceof Error ? e.message : String(e))
|
||||
}
|
||||
}
|
||||
|
||||
const connectRizful = async () => {
|
||||
setConnecting(true)
|
||||
try {
|
||||
const r = await fetch(RIZFUL_TOKEN_EXCHANGE_URL, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
credentials: 'omit',
|
||||
body: JSON.stringify({
|
||||
secret_code: token.trim(),
|
||||
nostr_public_key: pubkey
|
||||
})
|
||||
})
|
||||
|
||||
if (!r.ok) {
|
||||
const errorText = await r.text()
|
||||
throw new Error(errorText || 'Exchange failed')
|
||||
}
|
||||
|
||||
const j = (await r.json()) as {
|
||||
nwc_uri?: string
|
||||
lightning_address?: string
|
||||
}
|
||||
|
||||
if (j.nwc_uri) {
|
||||
connectNWC(j.nwc_uri)
|
||||
}
|
||||
if (j.lightning_address) {
|
||||
updateUserProfile(j.lightning_address)
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
toast.error(e instanceof Error ? e.message : String(e))
|
||||
} finally {
|
||||
setConnecting(false)
|
||||
}
|
||||
}
|
||||
|
||||
if (connected) {
|
||||
return (
|
||||
<SecondaryPageLayout ref={ref} index={index} title={t('Rizful Vault')}>
|
||||
<div className="px-4 pt-3 space-y-6 flex flex-col items-center">
|
||||
<CheckCircle2 className="size-40 fill-green-400 text-background" />
|
||||
<div className="font-semibold text-2xl">{t('Rizful Vault connected!')}</div>
|
||||
<div className="text-center text-sm text-muted-foreground">
|
||||
{t('You can now use your Rizful Vault to zap your favorite notes and creators.')}
|
||||
</div>
|
||||
{lightningAddress && (
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<div>{t('Your Lightning Address')}:</div>
|
||||
<div
|
||||
className="font-semibold text-lg rounded-lg px-4 py-1 flex justify-center items-center gap-2 cursor-pointer hover:bg-accent/80"
|
||||
onClick={() => {
|
||||
navigator.clipboard.writeText(lightningAddress)
|
||||
setCopiedLightningAddress(true)
|
||||
setTimeout(() => setCopiedLightningAddress(false), 2000)
|
||||
}}
|
||||
>
|
||||
{lightningAddress}{' '}
|
||||
{copiedLightningAddress ? (
|
||||
<Check className="size-4" />
|
||||
) : (
|
||||
<Copy className="size-4" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</SecondaryPageLayout>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<SecondaryPageLayout ref={ref} index={index} title={t('Rizful Vault')}>
|
||||
<div className="px-4 pt-3 space-y-6">
|
||||
<div className="space-y-2">
|
||||
<div className="font-semibold">1. {t('New to Rizful?')}</div>
|
||||
<Button
|
||||
className="bg-lime-500 hover:bg-lime-500/90 w-64"
|
||||
onClick={() => window.open(RIZFUL_SIGNUP_URL, '_blank')}
|
||||
>
|
||||
{t('Sign up for Rizful')} <ExternalLink />
|
||||
</Button>
|
||||
<div className="text-sm text-muted-foreground">
|
||||
{t('If you already have a Rizful account, you can skip this step.')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="font-semibold">2. {t('Get your one-time code')}</div>
|
||||
<Button
|
||||
className="bg-orange-500 hover:bg-orange-500/90 w-64"
|
||||
onClick={() => openPopup(RIZFUL_GET_TOKEN_URL, 'rizful_codes')}
|
||||
>
|
||||
{t('Get code')}
|
||||
<ExternalLink />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="font-semibold">3. {t('Connect to your Rizful Vault')}</div>
|
||||
<Input
|
||||
placeholder={t('Paste your one-time code here')}
|
||||
value={token}
|
||||
onChange={(e) => {
|
||||
setToken(e.target.value.trim())
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
className="bg-sky-500 hover:bg-sky-500/90 w-64"
|
||||
disabled={!token || connecting}
|
||||
onClick={() => connectRizful()}
|
||||
>
|
||||
{connecting && <Loader2 className="animate-spin" />}
|
||||
{t('Connect')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</SecondaryPageLayout>
|
||||
)
|
||||
})
|
||||
RizfulPage.displayName = 'RizfulPage'
|
||||
export default RizfulPage
|
||||
|
||||
function openPopup(url: string, name: string, width = 520, height = 700) {
|
||||
const left = Math.max((window.screenX || 0) + (window.innerWidth - width) / 2, 0)
|
||||
const top = Math.max((window.screenY || 0) + (window.innerHeight - height) / 2, 0)
|
||||
|
||||
return window.open(
|
||||
url,
|
||||
name,
|
||||
`width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no`
|
||||
)
|
||||
}
|
||||
@@ -49,20 +49,24 @@ const SettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
<SettingItem className="clickable" onClick={() => push(toTranslation())}>
|
||||
<div className="flex items-center gap-4">
|
||||
<Languages />
|
||||
<div>{t('Translation')}</div>
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
<SettingItem className="clickable" onClick={() => push(toWallet())}>
|
||||
<div className="flex items-center gap-4">
|
||||
<Wallet />
|
||||
<div>{t('Wallet')}</div>
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
{!!pubkey && (
|
||||
<SettingItem className="clickable" onClick={() => push(toTranslation())}>
|
||||
<div className="flex items-center gap-4">
|
||||
<Languages />
|
||||
<div>{t('Translation')}</div>
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
)}
|
||||
{!!pubkey && (
|
||||
<SettingItem className="clickable" onClick={() => push(toWallet())}>
|
||||
<div className="flex items-center gap-4">
|
||||
<Wallet />
|
||||
<div>{t('Wallet')}</div>
|
||||
</div>
|
||||
<ChevronRight />
|
||||
</SettingItem>
|
||||
)}
|
||||
{!!pubkey && (
|
||||
<SettingItem className="clickable" onClick={() => push(toPostSettings())}>
|
||||
<div className="flex items-center gap-4">
|
||||
|
||||
@@ -28,26 +28,21 @@ export default function LightningAddressInput() {
|
||||
|
||||
const handleSave = async () => {
|
||||
setSaving(true)
|
||||
let lud06 = profile.lud06
|
||||
let lud16 = profile.lud16
|
||||
const profileContent = profileEvent ? JSON.parse(profileEvent.content) : {}
|
||||
if (lightningAddress.startsWith('lnurl')) {
|
||||
lud06 = lightningAddress
|
||||
profileContent.lud06 = lightningAddress
|
||||
} else if (isEmail(lightningAddress)) {
|
||||
lud16 = lightningAddress
|
||||
} else {
|
||||
profileContent.lud16 = lightningAddress
|
||||
} else if (lightningAddress) {
|
||||
toast.error(t('Invalid Lightning Address. Please enter a valid Lightning Address or LNURL.'))
|
||||
setSaving(false)
|
||||
return
|
||||
} else {
|
||||
delete profileContent.lud16
|
||||
}
|
||||
|
||||
const oldProfileContent = profileEvent ? JSON.parse(profileEvent.content) : {}
|
||||
const newProfileContent = {
|
||||
...oldProfileContent,
|
||||
lud06,
|
||||
lud16
|
||||
}
|
||||
const profileDraftEvent = createProfileDraftEvent(
|
||||
JSON.stringify(newProfileContent),
|
||||
JSON.stringify(profileContent),
|
||||
profileEvent?.tags
|
||||
)
|
||||
const newProfileEvent = await publish(profileDraftEvent)
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
import { useSecondaryPage } from '@/PageManager'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger
|
||||
} from '@/components/ui/alert-dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
|
||||
import { Button as BcButton } from '@getalby/bitcoin-connect-react'
|
||||
import { toRizful } from '@/lib/link'
|
||||
import { useZap } from '@/providers/ZapProvider'
|
||||
import { disconnect, launchModal } from '@getalby/bitcoin-connect-react'
|
||||
import { forwardRef } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import DefaultZapAmountInput from './DefaultZapAmountInput'
|
||||
@@ -9,16 +24,60 @@ import QuickZapSwitch from './QuickZapSwitch'
|
||||
|
||||
const WalletPage = forwardRef(({ index }: { index?: number }, ref) => {
|
||||
const { t } = useTranslation()
|
||||
const { push } = useSecondaryPage()
|
||||
const { isWalletConnected, walletInfo } = useZap()
|
||||
|
||||
return (
|
||||
<SecondaryPageLayout ref={ref} index={index} title={t('Wallet')}>
|
||||
<div className="px-4 pt-3 space-y-4">
|
||||
<BcButton />
|
||||
<LightningAddressInput />
|
||||
<DefaultZapAmountInput />
|
||||
<DefaultZapCommentInput />
|
||||
<QuickZapSwitch />
|
||||
</div>
|
||||
{isWalletConnected ? (
|
||||
<div className="px-4 pt-3 space-y-4">
|
||||
<div>
|
||||
{walletInfo?.node.alias && (
|
||||
<div className="mb-2">
|
||||
{t('Connected to')} <strong>{walletInfo.node.alias}</strong>
|
||||
</div>
|
||||
)}
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button variant="destructive">{t('Disconnect Wallet')}</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>{t('Are you absolutely sure?')}</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{t('You will not be able to send zaps to others.')}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>{t('Cancel')}</AlertDialogCancel>
|
||||
<AlertDialogAction variant="destructive" onClick={() => disconnect()}>
|
||||
{t('Disconnect')}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
<DefaultZapAmountInput />
|
||||
<DefaultZapCommentInput />
|
||||
<QuickZapSwitch />
|
||||
<LightningAddressInput />
|
||||
</div>
|
||||
) : (
|
||||
<div className="px-4 pt-3 flex items-center gap-2">
|
||||
<Button className="bg-foreground hover:bg-foreground/90" onClick={() => push(toRizful())}>
|
||||
{t('Start with a Rizful Vault')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="link"
|
||||
className="text-muted-foreground hover:text-foreground px-0"
|
||||
onClick={() => {
|
||||
launchModal()
|
||||
}}
|
||||
>
|
||||
{t('or other wallets')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</SecondaryPageLayout>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import lightningService from '@/services/lightning.service'
|
||||
import storage from '@/services/local-storage.service'
|
||||
import { createContext, useContext, useState } from 'react'
|
||||
import { onConnected, onDisconnected } from '@getalby/bitcoin-connect-react'
|
||||
import { GetInfoResponse, WebLNProvider } from '@webbtc/webln-types'
|
||||
import { createContext, useContext, useEffect, useState } from 'react'
|
||||
|
||||
type TZapContext = {
|
||||
isWalletConnected: boolean
|
||||
provider: WebLNProvider | null
|
||||
walletInfo: GetInfoResponse | null
|
||||
defaultZapSats: number
|
||||
updateDefaultSats: (sats: number) => void
|
||||
defaultZapComment: string
|
||||
@@ -24,6 +30,29 @@ export function ZapProvider({ children }: { children: React.ReactNode }) {
|
||||
const [defaultZapSats, setDefaultZapSats] = useState<number>(storage.getDefaultZapSats())
|
||||
const [defaultZapComment, setDefaultZapComment] = useState<string>(storage.getDefaultZapComment())
|
||||
const [quickZap, setQuickZap] = useState<boolean>(storage.getQuickZap())
|
||||
const [isWalletConnected, setIsWalletConnected] = useState(false)
|
||||
const [provider, setProvider] = useState<WebLNProvider | null>(null)
|
||||
const [walletInfo, setWalletInfo] = useState<GetInfoResponse | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const unSubOnConnected = onConnected((provider) => {
|
||||
setIsWalletConnected(true)
|
||||
setWalletInfo(null)
|
||||
setProvider(provider)
|
||||
lightningService.provider = provider
|
||||
provider.getInfo().then(setWalletInfo)
|
||||
})
|
||||
const unSubOnDisconnected = onDisconnected(() => {
|
||||
setIsWalletConnected(false)
|
||||
setProvider(null)
|
||||
lightningService.provider = null
|
||||
})
|
||||
|
||||
return () => {
|
||||
unSubOnConnected()
|
||||
unSubOnDisconnected()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const updateDefaultSats = (sats: number) => {
|
||||
storage.setDefaultZapSats(sats)
|
||||
@@ -43,6 +72,9 @@ export function ZapProvider({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<ZapContext.Provider
|
||||
value={{
|
||||
isWalletConnected,
|
||||
provider,
|
||||
walletInfo,
|
||||
defaultZapSats,
|
||||
updateDefaultSats,
|
||||
defaultZapComment,
|
||||
|
||||
@@ -13,6 +13,7 @@ import ProfilePage from './pages/secondary/ProfilePage'
|
||||
import RelayPage from './pages/secondary/RelayPage'
|
||||
import RelayReviewsPage from './pages/secondary/RelayReviewsPage'
|
||||
import RelaySettingsPage from './pages/secondary/RelaySettingsPage'
|
||||
import RizfulPage from './pages/secondary/RizfulPage'
|
||||
import SearchPage from './pages/secondary/SearchPage'
|
||||
import SettingsPage from './pages/secondary/SettingsPage'
|
||||
import TranslationPage from './pages/secondary/TranslationPage'
|
||||
@@ -35,7 +36,8 @@ const ROUTES = [
|
||||
{ path: '/settings/general', element: <GeneralSettingsPage /> },
|
||||
{ path: '/settings/translation', element: <TranslationPage /> },
|
||||
{ path: '/profile-editor', element: <ProfileEditorPage /> },
|
||||
{ path: '/mutes', element: <MuteListPage /> }
|
||||
{ path: '/mutes', element: <MuteListPage /> },
|
||||
{ path: '/rizful', element: <RizfulPage /> }
|
||||
]
|
||||
|
||||
export const routes = ROUTES.map(({ path, element }) => ({
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import { BIG_RELAY_URLS, CODY_PUBKEY, JUMBLE_PUBKEY } from '@/constants'
|
||||
import { getZapInfoFromEvent } from '@/lib/event-metadata'
|
||||
import { TProfile } from '@/types'
|
||||
import {
|
||||
init,
|
||||
launchPaymentModal,
|
||||
onConnected,
|
||||
onDisconnected
|
||||
} from '@getalby/bitcoin-connect-react'
|
||||
import { init, launchPaymentModal } from '@getalby/bitcoin-connect-react'
|
||||
import { Invoice } from '@getalby/lightning-tools'
|
||||
import { bech32 } from '@scure/base'
|
||||
import { WebLNProvider } from '@webbtc/webln-types'
|
||||
@@ -23,7 +18,7 @@ const OFFICIAL_PUBKEYS = [JUMBLE_PUBKEY, CODY_PUBKEY]
|
||||
|
||||
class LightningService {
|
||||
static instance: LightningService
|
||||
private provider: WebLNProvider | null = null
|
||||
provider: WebLNProvider | null = null
|
||||
private recentSupportersCache: TRecentSupporter[] | null = null
|
||||
|
||||
constructor() {
|
||||
@@ -33,12 +28,6 @@ class LightningService {
|
||||
appName: 'Jumble',
|
||||
showBalance: false
|
||||
})
|
||||
onConnected((provider) => {
|
||||
this.provider = provider
|
||||
})
|
||||
onDisconnected(() => {
|
||||
this.provider = null
|
||||
})
|
||||
}
|
||||
return LightningService.instance
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ class LocalStorageService {
|
||||
private hideContentMentioningMutedUsers: boolean = false
|
||||
private notificationListStyle: TNotificationStyle = NOTIFICATION_LIST_STYLE.DETAILED
|
||||
private mediaAutoLoadPolicy: TMediaAutoLoadPolicy = MEDIA_AUTO_LOAD_POLICY.ALWAYS
|
||||
private shownCreateWalletGuideToastPubkeys: Set<string> = new Set()
|
||||
|
||||
constructor() {
|
||||
if (!LocalStorageService.instance) {
|
||||
@@ -185,6 +186,13 @@ class LocalStorageService {
|
||||
this.mediaAutoLoadPolicy = mediaAutoLoadPolicy as TMediaAutoLoadPolicy
|
||||
}
|
||||
|
||||
const shownCreateWalletGuideToastPubkeysStr = window.localStorage.getItem(
|
||||
StorageKey.SHOWN_CREATE_WALLET_GUIDE_TOAST_PUBKEYS
|
||||
)
|
||||
this.shownCreateWalletGuideToastPubkeys = shownCreateWalletGuideToastPubkeysStr
|
||||
? new Set(JSON.parse(shownCreateWalletGuideToastPubkeysStr))
|
||||
: new Set()
|
||||
|
||||
// Clean up deprecated data
|
||||
window.localStorage.removeItem(StorageKey.ACCOUNT_PROFILE_EVENT_MAP)
|
||||
window.localStorage.removeItem(StorageKey.ACCOUNT_FOLLOW_LIST_EVENT_MAP)
|
||||
@@ -453,6 +461,21 @@ class LocalStorageService {
|
||||
this.mediaAutoLoadPolicy = policy
|
||||
window.localStorage.setItem(StorageKey.MEDIA_AUTO_LOAD_POLICY, policy)
|
||||
}
|
||||
|
||||
hasShownCreateWalletGuideToast(pubkey: string) {
|
||||
return this.shownCreateWalletGuideToastPubkeys.has(pubkey)
|
||||
}
|
||||
|
||||
markCreateWalletGuideToastAsShown(pubkey: string) {
|
||||
if (this.shownCreateWalletGuideToastPubkeys.has(pubkey)) {
|
||||
return
|
||||
}
|
||||
this.shownCreateWalletGuideToastPubkeys.add(pubkey)
|
||||
window.localStorage.setItem(
|
||||
StorageKey.SHOWN_CREATE_WALLET_GUIDE_TOAST_PUBKEYS,
|
||||
JSON.stringify(Array.from(this.shownCreateWalletGuideToastPubkeys))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new LocalStorageService()
|
||||
|
||||
Reference in New Issue
Block a user