feat: profile only-zaps

This commit is contained in:
Kieran 2023-04-20 22:05:11 +01:00
parent ed878f57f4
commit 1f0d17112c
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
7 changed files with 46 additions and 5 deletions

View File

@ -264,7 +264,7 @@ export default function NoteFooter(props: NoteFooterProps) {
}
function reactionIcons() {
if (!prefs.enableReactions) {
if (!prefs.enableReactions || author?.reactions === false) {
return null;
}
return (
@ -275,7 +275,6 @@ export default function NoteFooter(props: NoteFooterProps) {
<Icon name="heart" />
<div className="reaction-pill-number">{formatShort(positive.length)}</div>
</div>
{repostIcon()}
</>
);
}
@ -426,6 +425,7 @@ export default function NoteFooter(props: NoteFooterProps) {
<div className="footer-reactions">
{tipButton()}
{reactionIcons()}
{repostIcon()}
<div className={`reaction-pill ${showNoteCreatorModal ? "reacted" : ""}`} onClick={handleReplyButtonClick}>
<Icon name="reply" size={17} />
</div>

View File

@ -22,7 +22,7 @@ export default function useThreadFeed(link: NostrLink) {
.kinds(
pref.enableReactions
? [EventKind.Reaction, EventKind.TextNote, EventKind.Repost, EventKind.ZapReceipt]
: [EventKind.TextNote, EventKind.ZapReceipt]
: [EventKind.TextNote, EventKind.ZapReceipt, EventKind.Repost]
)
.tag("e", allEvents);

View File

@ -128,7 +128,9 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
if (trackingEvents.length > 0) {
rb.withFilter()
.kinds(
pref.enableReactions ? [EventKind.Reaction, EventKind.Repost, EventKind.ZapReceipt] : [EventKind.ZapReceipt]
pref.enableReactions
? [EventKind.Reaction, EventKind.Repost, EventKind.ZapReceipt]
: [EventKind.ZapReceipt, EventKind.Repost]
)
.tag("e", trackingEvents);
}

View File

@ -36,6 +36,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
const [website, setWebsite] = useState<string>();
const [nip05, setNip05] = useState<string>();
const [lud16, setLud16] = useState<string>();
const [reactions, setReactions] = useState<boolean>();
const avatarPicture = (picture?.length ?? 0) === 0 ? Nostrich : picture;
@ -49,6 +50,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
setWebsite(user.website);
setNip05(user.nip05);
setLud16(user.lud16);
setReactions(user.reactions);
}
}, [user]);
@ -64,6 +66,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
website,
nip05,
lud16,
reactions,
} as Record<string, string | number | undefined>;
delete userCopy["loaded"];
delete userCopy["created"];
@ -166,6 +169,17 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
<input type="text" value={lud16} onChange={e => setLud16(e.target.value)} />
</div>
</div>
<div className="form-group card">
<div className="flex f-col">
<FormattedMessage defaultMessage="OnlyZaps" />:
<small>
<FormattedMessage defaultMessage="Some clients will only allow zaps on your notes" />
</small>
</div>
<div>
<input type="checkbox" checked={!reactions} onChange={e => setReactions(!e.target.checked)} />
</div>
</div>
<div className="form-group card">
<div></div>
<div>

View File

@ -5,6 +5,9 @@
"+aZY2h": {
"defaultMessage": "Zap Type"
},
"+vA//S": {
"defaultMessage": "Logins"
},
"+vIQlC": {
"defaultMessage": "Please make sure to save the following password in order to manage your handle in the future"
},
@ -304,12 +307,18 @@
"EnCOBJ": {
"defaultMessage": "Buy"
},
"EqRgFp": {
"defaultMessage": "Some clients will only allow zaps on your notes"
},
"Eqjl5K": {
"defaultMessage": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too."
},
"F+B3x1": {
"defaultMessage": "We have also partnered with nostrplebs.com to give you more options"
},
"F3l7xL": {
"defaultMessage": "Add Account"
},
"FDguSC": {
"defaultMessage": "{n} Zaps"
},
@ -334,6 +343,9 @@
"FpxElY": {
"defaultMessage": "Verification"
},
"FvanT6": {
"defaultMessage": "Accounts"
},
"G/yZLu": {
"defaultMessage": "Remove"
},
@ -913,6 +925,9 @@
"mfe8RW": {
"defaultMessage": "Option: {n}"
},
"n1Whvj": {
"defaultMessage": "Switch"
},
"nDejmx": {
"defaultMessage": "Unblock"
},
@ -1053,6 +1068,9 @@
"ut+2Cd": {
"defaultMessage": "Get a partner identifier"
},
"v48Uwm": {
"defaultMessage": "OnlyZaps"
},
"vOKedj": {
"defaultMessage": "{n,plural,=1{& {n} other} other{& {n} others}}"
},

View File

@ -1,6 +1,7 @@
{
"+D82kt": "Are you sure you want to repost: {id}",
"+aZY2h": "Zap Type",
"+vA//S": "Logins",
"+vIQlC": "Please make sure to save the following password in order to manage your handle in the future",
"+vVZ/G": "Connect",
"/4tOwT": "Skip",
@ -99,8 +100,10 @@
"Ebl/B2": "Translate to {lang}",
"EcglP9": "Key",
"EnCOBJ": "Buy",
"EqRgFp": "Some clients will only allow zaps on your notes",
"Eqjl5K": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too.",
"F+B3x1": "We have also partnered with nostrplebs.com to give you more options",
"F3l7xL": "Add Account",
"FDguSC": "{n} Zaps",
"FP+D3H": "LNURL to forward zaps to",
"FS3b54": "Done!",
@ -109,6 +112,7 @@
"FfYsOb": "An error has occured!",
"FmXUJg": "follows you",
"FpxElY": "Verification",
"FvanT6": "Accounts",
"G/yZLu": "Remove",
"G1BGCg": "Select Wallet",
"GFOoEE": "Salt",
@ -299,6 +303,7 @@
"mKhgP9": "{n,plural,=0{} =1{zapped} other{zapped}}",
"mLcajD": "Snort Subscription",
"mfe8RW": "Option: {n}",
"n1Whvj": "Switch",
"nDejmx": "Unblock",
"nGBrvw": "Bookmarks",
"nN9XTz": "Share your thoughts with {link}",
@ -345,6 +350,7 @@
"uSV4Ti": "Reposts need to be manually confirmed",
"usAvMr": "Edit Profile",
"ut+2Cd": "Get a partner identifier",
"v48Uwm": "OnlyZaps",
"vOKedj": "{n,plural,=1{& {n} other} other{& {n} others}}",
"vU71Ez": "Paying with {wallet}",
"vZ4quW": "NIP-05 is a DNS based verification spec which helps to validate you as a real user.",
@ -377,4 +383,4 @@
"zjJZBd": "You're ready!",
"zonsdq": "Failed to load LNURL service",
"zvCDao": "Automatically show latest notes"
}
}

View File

@ -70,6 +70,7 @@ export type UserMetadata = {
nip05?: string;
lud06?: string;
lud16?: string;
reactions?: boolean;
};
/**