fix: allow zap comments #229
@ -77,6 +77,8 @@ export default function LNURLTip(props: LNURLTipProps) {
|
|||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
const publisher = useEventPublisher();
|
const publisher = useEventPublisher();
|
||||||
const horizontalScroll = useHorizontalScroll();
|
const horizontalScroll = useHorizontalScroll();
|
||||||
|
const canComment =
|
||||||
|
(payService?.commentAllowed ?? 0) > 0 || payService?.nostrPubkey;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (show && !props.invoice) {
|
if (show && !props.invoice) {
|
||||||
@ -150,7 +152,8 @@ export default function LNURLTip(props: LNURLTipProps) {
|
|||||||
if (!amount || !payService) return null;
|
if (!amount || !payService) return null;
|
||||||
let url = "";
|
let url = "";
|
||||||
const amountParam = `amount=${Math.floor(amount * 1000)}`;
|
const amountParam = `amount=${Math.floor(amount * 1000)}`;
|
||||||
const commentParam = comment
|
const commentParam =
|
||||||
|
comment && payService?.commentAllowed
|
||||||
? `&comment=${encodeURIComponent(comment)}`
|
? `&comment=${encodeURIComponent(comment)}`
|
||||||
: "";
|
: "";
|
||||||
if (payService.nostrPubkey && author) {
|
if (payService.nostrPubkey && author) {
|
||||||
@ -241,8 +244,7 @@ export default function LNURLTip(props: LNURLTipProps) {
|
|||||||
</div>
|
</div>
|
||||||
{payService && custom()}
|
{payService && custom()}
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
{(payService?.commentAllowed ?? 0) > 0 ||
|
{canComment && (
|
||||||
(payService?.nostrPubkey && (
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={formatMessage(messages.Comment)}
|
placeholder={formatMessage(messages.Comment)}
|
||||||
@ -250,7 +252,7 @@ export default function LNURLTip(props: LNURLTipProps) {
|
|||||||
maxLength={payService?.commentAllowed || 120}
|
maxLength={payService?.commentAllowed || 120}
|
||||||
onChange={(e) => setComment(e.target.value)}
|
onChange={(e) => setComment(e.target.value)}
|
||||||
/>
|
/>
|
||||||
))}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{(amount ?? 0) > 0 && (
|
{(amount ?? 0) > 0 && (
|
||||||
<button
|
<button
|
||||||
|
15
src/Util.ts
15
src/Util.ts
@ -108,24 +108,13 @@ export const Reaction = {
|
|||||||
*/
|
*/
|
||||||
export function normalizeReaction(content: string) {
|
export function normalizeReaction(content: string) {
|
||||||
switch (content) {
|
switch (content) {
|
||||||
case "":
|
|
||||||
return Reaction.Positive;
|
|
||||||
case "🤙":
|
|
||||||
return Reaction.Positive;
|
|
||||||
case "❤️":
|
|
||||||
return Reaction.Positive;
|
|
||||||
case "👍":
|
|
||||||
return Reaction.Positive;
|
|
||||||
case "💯":
|
|
||||||
return Reaction.Positive;
|
|
||||||
case "+":
|
|
||||||
return Reaction.Positive;
|
|
||||||
case "-":
|
case "-":
|
||||||
return Reaction.Negative;
|
return Reaction.Negative;
|
||||||
case "👎":
|
case "👎":
|
||||||
return Reaction.Negative;
|
return Reaction.Negative;
|
||||||
|
default:
|
||||||
|
return Reaction.Positive;
|
||||||
}
|
}
|
||||||
return content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user