Compare commits

...

2 Commits

Author SHA1 Message Date
ekzyis
41da95b125
Fix wallet double tap on mobile (#1467)
* Fix wallet double tap on mobile

* also add icon that card can be dragged

* Fix ugly drag image
2024-10-09 19:27:49 -05:00
Keyan
e48cd61721
remove unused fields from me fragment (#1466) 2024-10-09 11:56:29 -05:00
6 changed files with 53 additions and 45 deletions

View File

@ -4,8 +4,9 @@ import Plug from '@/svgs/plug.svg'
import Gear from '@/svgs/settings-5-fill.svg' import Gear from '@/svgs/settings-5-fill.svg'
import Link from 'next/link' import Link from 'next/link'
import { Status } from 'wallets' import { Status } from 'wallets'
import DraggableIcon from '@/svgs/draggable.svg'
export default function WalletCard ({ wallet }) { export default function WalletCard ({ wallet, draggable, onDragStart, onDragEnter, onDragEnd, onTouchStart, sourceIndex, targetIndex, index }) {
const { card: { title, badges } } = wallet const { card: { title, badges } } = wallet
let indicator = styles.disabled let indicator = styles.disabled
@ -27,9 +28,26 @@ export default function WalletCard ({ wallet }) {
} }
return ( return (
<Card className={styles.card}> <Card
className={styles.card}
// we attach the drag listeners to the whole card to have a proper drag image
draggable={draggable}
onDragStart={onDragStart}
onDragEnter={onDragEnter}
onDragEnd={onDragEnd}
>
<div className={styles.cardMeta}>
{wallet.status === Status.Enabled && <DraggableIcon className={styles.drag} width={16} height={16} />}
<div className={`${styles.indicator} ${indicator}`} /> <div className={`${styles.indicator} ${indicator}`} />
<Card.Body> </div>
<Card.Body
// we attach touch listener only to card body to not interfere with wallet link
onTouchStart={onTouchStart}
className={draggable
? (`${sourceIndex === index ? styles.drag : ''} ${draggable && targetIndex === index ? styles.drop : ''}`)
: ''}
style={{ cursor: draggable ? 'move' : 'default' }}
>
<Card.Title>{title}</Card.Title> <Card.Title>{title}</Card.Title>
<Card.Subtitle className='mt-2'> <Card.Subtitle className='mt-2'>
{badges?.map( {badges?.map(

View File

@ -15,31 +15,16 @@ export const ME = gql`
diagnostics diagnostics
noReferralLinks noReferralLinks
fiatCurrency fiatCurrency
autoWithdrawMaxFeePercent
autoWithdrawThreshold
withdrawMaxFeeDefault
satsFilter satsFilter
hideCowboyHat
hideFromTopUsers hideFromTopUsers
hideGithub
hideNostr
hideTwitter
hideInvoiceDesc
hideIsContributor
hideWalletBalance hideWalletBalance
hideWelcomeBanner hideWelcomeBanner
imgproxyOnly imgproxyOnly
showImagesAndVideos showImagesAndVideos
lastCheckedJobs
nostrCrossposting nostrCrossposting
noteAllDescendants
noteCowboyHat
noteDeposits
noteWithdrawals
noteEarning
noteForwardedSats
noteInvites
noteItemSats
noteJobIndicator
noteMentions
noteItemMentions
sats sats
tipDefault tipDefault
tipRandom tipRandom
@ -50,19 +35,12 @@ export const ME = gql`
zapUndos zapUndos
upvotePopover upvotePopover
wildWestMode wildWestMode
withdrawMaxFeeDefault
lnAddr
autoWithdrawMaxFeePercent
autoWithdrawThreshold
disableFreebies disableFreebies
} }
optional { optional {
isContributor isContributor
stacked stacked
streak streak
githubId
nostrAuthPubkey
twitterId
} }
} }
}` }`

View File

@ -385,14 +385,14 @@ export default function Settings ({ ssrData }) {
groupClassName='mb-0' groupClassName='mb-0'
/> />
<Checkbox <Checkbox
disabled={me.optional.githubId === null} disabled={!settings?.authMethods?.github}
label={ label={
<div className='d-flex align-items-center'>hide my linked github profile <div className='d-flex align-items-center'>hide my linked github profile
<Info> <Info>
<ul> <ul>
<li>Linked accounts are hidden from your profile by default</li> <li>Linked accounts are hidden from your profile by default</li>
<li>uncheck this to display your github on your profile</li> <li>uncheck this to display your github on your profile</li>
{me.optional.githubId === null && {!settings?.authMethods?.github &&
<div className='my-2'> <div className='my-2'>
<li><i>You don't seem to have a linked github account</i></li> <li><i>You don't seem to have a linked github account</i></li>
<ul><li>If this is wrong, try unlinking/relinking</li></ul> <ul><li>If this is wrong, try unlinking/relinking</li></ul>
@ -405,14 +405,14 @@ export default function Settings ({ ssrData }) {
groupClassName='mb-0' groupClassName='mb-0'
/> />
<Checkbox <Checkbox
disabled={me.optional.nostrAuthPubkey === null} disabled={!settings?.authMethods?.nostr}
label={ label={
<div className='d-flex align-items-center'>hide my linked nostr profile <div className='d-flex align-items-center'>hide my linked nostr profile
<Info> <Info>
<ul> <ul>
<li>Linked accounts are hidden from your profile by default</li> <li>Linked accounts are hidden from your profile by default</li>
<li>Uncheck this to display your npub on your profile</li> <li>Uncheck this to display your npub on your profile</li>
{me.optional.nostrAuthPubkey === null && {!settings?.authMethods?.nostr &&
<div className='my-2'> <div className='my-2'>
<li>You don't seem to have a linked nostr account</li> <li>You don't seem to have a linked nostr account</li>
<ul><li>If this is wrong, try unlinking/relinking</li></ul> <ul><li>If this is wrong, try unlinking/relinking</li></ul>
@ -425,14 +425,14 @@ export default function Settings ({ ssrData }) {
groupClassName='mb-0' groupClassName='mb-0'
/> />
<Checkbox <Checkbox
disabled={me.optional.twitterId === null} disabled={!settings?.authMethods?.twitter}
label={ label={
<div className='d-flex align-items-center'>hide my linked twitter profile <div className='d-flex align-items-center'>hide my linked twitter profile
<Info> <Info>
<ul> <ul>
<li>Linked accounts are hidden from your profile by default</li> <li>Linked accounts are hidden from your profile by default</li>
<li>Uncheck this to display your twitter on your profile</li> <li>Uncheck this to display your twitter on your profile</li>
{me.optional.twitterId === null && {!settings?.authMethods?.twitter &&
<div className='my-2'> <div className='my-2'>
<i>You don't seem to have a linked twitter account</i> <i>You don't seem to have a linked twitter account</i>
<ul><li>If this is wrong, try unlinking/relinking</li></ul> <ul><li>If this is wrong, try unlinking/relinking</li></ul>

View File

@ -93,11 +93,6 @@ export default function Wallet ({ ssrData }) {
return ( return (
<div <div
key={w.name} key={w.name}
draggable={draggable}
style={{ cursor: draggable ? 'move' : 'default' }}
onDragStart={draggable ? onDragStart(i) : undefined}
onTouchStart={draggable ? onTouchStart(i) : undefined}
onDragEnter={draggable ? onDragEnter(i) : undefined}
className={ className={
!draggable !draggable
? '' ? ''
@ -105,7 +100,16 @@ export default function Wallet ({ ssrData }) {
} }
suppressHydrationWarning suppressHydrationWarning
> >
<WalletCard wallet={w} /> <WalletCard
wallet={w}
draggable={draggable}
onDragStart={draggable ? onDragStart(i) : undefined}
onTouchStart={draggable ? onTouchStart(i) : undefined}
onDragEnter={draggable ? onDragEnter(i) : undefined}
sourceIndex={sourceIndex}
targetIndex={targetIndex}
index={i}
/>
</div> </div>
) )
} }

View File

@ -20,6 +20,17 @@
height: 180px; height: 180px;
} }
.cardMeta {
position: absolute;
width: 100%;
display: grid;
align-items: center;
justify-content: end;
padding: 10px 10px 0 10px;
grid-gap: 0.2rem;
grid-auto-flow: column;
}
.badge { .badge {
color: var(--theme-grey) !important; color: var(--theme-grey) !important;
background: var(--theme-clickToContextColor) !important; background: var(--theme-clickToContextColor) !important;
@ -42,11 +53,7 @@
.indicator { .indicator {
width: 10px; width: 10px;
height: 10px; height: 10px;
right: 10px;
top: 10px;
border-radius: 50%; border-radius: 50%;
display: inline-block;
position: absolute;
} }
.indicator.success { .indicator.success {

1
svgs/draggable.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M8.5 7C9.32843 7 10 6.32843 10 5.5C10 4.67157 9.32843 4 8.5 4C7.67157 4 7 4.67157 7 5.5C7 6.32843 7.67157 7 8.5 7ZM8.5 13.5C9.32843 13.5 10 12.8284 10 12C10 11.1716 9.32843 10.5 8.5 10.5C7.67157 10.5 7 11.1716 7 12C7 12.8284 7.67157 13.5 8.5 13.5ZM10 18.5C10 19.3284 9.32843 20 8.5 20C7.67157 20 7 19.3284 7 18.5C7 17.6716 7.67157 17 8.5 17C9.32843 17 10 17.6716 10 18.5ZM15.5 7C16.3284 7 17 6.32843 17 5.5C17 4.67157 16.3284 4 15.5 4C14.6716 4 14 4.67157 14 5.5C14 6.32843 14.6716 7 15.5 7ZM17 12C17 12.8284 16.3284 13.5 15.5 13.5C14.6716 13.5 14 12.8284 14 12C14 11.1716 14.6716 10.5 15.5 10.5C16.3284 10.5 17 11.1716 17 12ZM15.5 20C16.3284 20 17 19.3284 17 18.5C17 17.6716 16.3284 17 15.5 17C14.6716 17 14 17.6716 14 18.5C14 19.3284 14.6716 20 15.5 20Z"></path></svg>

After

Width:  |  Height:  |  Size: 859 B