From 4520c9117943ebe3370b621639eae4a9b0efe42c Mon Sep 17 00:00:00 2001
From: Keyan <34140557+huumn@users.noreply.github.com>
Date: Sun, 12 Jan 2025 15:15:53 -0600
Subject: [PATCH] cowboy credit modal explainers wherever they are referenced
(#1815)
---
components/info/cc.js | 26 ++++++++++++++++++++
components/{info.js => info/index.js} | 8 +++---
components/info/reward-sats.js | 18 ++++++++++++++
components/notifications.js | 23 ++++++++++++------
pages/credits.js | 35 +++++++++++++++++++--------
5 files changed, 89 insertions(+), 21 deletions(-)
create mode 100644 components/info/cc.js
rename components/{info.js => info/index.js} (56%)
create mode 100644 components/info/reward-sats.js
diff --git a/components/info/cc.js b/components/info/cc.js
new file mode 100644
index 00000000..864b6c3b
--- /dev/null
+++ b/components/info/cc.js
@@ -0,0 +1,26 @@
+import Link from 'next/link'
+import Info from '.'
+
+export default function CCInfo (props) {
+ return (
+
+ Why am I getting cowboy credits?
+
+ - to receive sats, you must attach an external receiving wallet
+ - zappers may have chosen to send you CCs instead of sats
+ - if the zaps are split on post, recepients will receive CCs regardless of their configured receiving wallet
+ - there could be an issue paying your receiving wallet
+
+ - check your wallet logs for clues
+ - if you have questions about the errors in your wallet logs, mention the error in the saloon
+
+
+ - some zaps might be smaller than your configured receiving dust limit
+
+ - you can configure your dust limit in your settings
+
+
+
+
+ )
+}
diff --git a/components/info.js b/components/info/index.js
similarity index 56%
rename from components/info.js
rename to components/info/index.js
index acd6ed13..7d296487 100644
--- a/components/info.js
+++ b/components/info/index.js
@@ -1,8 +1,8 @@
import React from 'react'
import InfoIcon from '@/svgs/information-fill.svg'
-import { useShowModal } from './modal'
+import { useShowModal } from '../modal'
-export default function Info ({ children, label, iconClassName = 'fill-theme-color' }) {
+export default function Info ({ children, size = 18, label, iconClassName = 'fill-theme-color' }) {
const showModal = useShowModal()
return (
@@ -11,10 +11,10 @@ export default function Info ({ children, label, iconClassName = 'fill-theme-col
e.preventDefault()
showModal(onClose => children)
}}
- className='d-flex align-items-center pointer'
+ className='pointer d-flex align-items-center'
>
{label && {label}}
diff --git a/components/info/reward-sats.js b/components/info/reward-sats.js
new file mode 100644
index 00000000..49e21c39
--- /dev/null
+++ b/components/info/reward-sats.js
@@ -0,0 +1,18 @@
+import Link from 'next/link'
+import Info from '.'
+
+export default function RewardSatsInfo (props) {
+ return (
+
+ Where did my sats come from?
+
+ - you may have sats from before SN went not-custodial
+ - sats also come from daily rewards and territory revenue
+
+ - you can configure these sats to autowithdraw by attaching an external receiving wallet
+
+
+
+
+ )
+}
diff --git a/components/notifications.js b/components/notifications.js
index d159c74d..5d4c0419 100644
--- a/components/notifications.js
+++ b/components/notifications.js
@@ -43,6 +43,7 @@ import { useToast } from './toast'
import classNames from 'classnames'
import HolsterIcon from '@/svgs/holster.svg'
import SaddleIcon from '@/svgs/saddle.svg'
+import CCInfo from './info/cc'
function Notification ({ n, fresh }) {
const type = n.__typename
@@ -573,12 +574,17 @@ function Votification ({ n }) {
return (
<>
- your {n.item.title ? 'post' : 'reply'} stacked {stackedTextString}
- {n.item.forwards?.length > 0 &&
- <>
- {' '}and forwarded {forwardedTextString} to{' '}
-
- >}
+
+
+ your {n.item.title ? 'post' : 'reply'} stacked {stackedTextString}
+ {n.item.forwards?.length > 0 &&
+ <>
+ {' '}and forwarded {forwardedTextString} to{' '}
+
+ >}
+
+ {n.item.credits > 0 && }
+
>
@@ -589,7 +595,10 @@ function ForwardedVotification ({ n }) {
return (
<>
- you were forwarded {numWithUnits(n.earnedSats, { abbreviate: false, unitSingular: 'CC', unitPlural: 'CCs' })} from
+
+ you were forwarded {numWithUnits(n.earnedSats, { abbreviate: false, unitSingular: 'CC', unitPlural: 'CCs' })}
+
+
>
diff --git a/pages/credits.js b/pages/credits.js
index 0351f9cb..5f68da04 100644
--- a/pages/credits.js
+++ b/pages/credits.js
@@ -1,4 +1,5 @@
import { getGetServerSideProps } from '@/api/ssrApollo'
+import CCInfo from '@/components/info/cc'
import { Form, Input, SubmitButton } from '@/components/form'
import { CenterLayout } from '@/components/layout'
import { useLightning } from '@/components/lightning'
@@ -7,7 +8,9 @@ import { useShowModal } from '@/components/modal'
import { usePaidMutation } from '@/components/use-paid-mutation'
import { BUY_CREDITS } from '@/fragments/paidAction'
import { amountSchema } from '@/lib/validate'
+import classNames from 'classnames'
import { Button, Col, InputGroup, Row } from 'react-bootstrap'
+import RewardSatsInfo from '@/components/info/reward-sats'
export const getServerSideProps = getGetServerSideProps({ authRequired: true })
@@ -21,8 +24,8 @@ export default function Credits () {
{me?.privates?.credits}
- cowboy credits
-
+ cowboy credits
+
@@ -30,8 +33,8 @@ export default function Credits () {
{me?.privates?.sats - me?.privates?.credits}
- sats
-
+ sats
+
@@ -41,8 +44,8 @@ export default function Credits () {
{me?.privates?.credits}
- cowboy credits
-
+ cowboy credits
+
@@ -50,8 +53,8 @@ export default function Credits () {
{me?.privates?.sats - me?.privates?.credits}
- sats
-
+ sats
+
@@ -59,7 +62,19 @@ export default function Credits () {
)
}
-export function BuyCreditsButton () {
+function WithdrawButton ({ className }) {
+ return (
+
+ )
+}
+
+export function BuyCreditsButton ({ className }) {
const showModal = useShowModal()
const strike = useLightning()
const [buyCredits] = usePaidMutation(BUY_CREDITS)
@@ -99,7 +114,7 @@ export function BuyCreditsButton () {
))}
- className='mt-3'
+ className={classNames('mt-3 d-block', className)}
variant='secondary'
>buy credits