+
))}
@@ -65,7 +68,11 @@ export const HomePage = () => {
{LANDING_PAGE_DATA.featuredGames.map((game) => (
-
+
))}
diff --git a/src/pages/mod/internal/comment/index.tsx b/src/pages/mod/internal/comment/index.tsx
index 2e9fc71..93ea146 100644
--- a/src/pages/mod/internal/comment/index.tsx
+++ b/src/pages/mod/internal/comment/index.tsx
@@ -13,7 +13,7 @@ import {
Filter as NostrEventFilter,
UnsignedEvent
} from 'nostr-tools'
-import React, { useMemo } from 'react'
+import React, { useEffect, useMemo } from 'react'
import { Dispatch, SetStateAction, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { toast } from 'react-toastify'
@@ -58,6 +58,10 @@ export const Comments = ({ modDetails, setCommentCount }: Props) => {
author: AuthorFilterEnum.All_Comments
})
+ useEffect(() => {
+ setCommentCount(commentEvents.length)
+ }, [commentEvents, setCommentCount])
+
const userState = useAppSelector((state) => state.user)
useDidMount(async () => {
@@ -202,8 +206,6 @@ export const Comments = ({ modDetails, setCommentCount }: Props) => {
return true
}
- setCommentCount(commentEvents.length)
-
const comments = useMemo(() => {
let filteredComments = commentEvents
if (filterOptions.author === AuthorFilterEnum.Creator_Comments) {
@@ -588,6 +590,7 @@ const Zap = (props: Event) => {
eventId={props.id}
handleClose={() => setIsOpen(false)}
setTotalZapAmount={setTotalZappedAmount}
+ setHasZapped={setHasZapped}
/>
)}
>
diff --git a/src/pages/mod/internal/zap/index.tsx b/src/pages/mod/internal/zap/index.tsx
index a2ba08b..ba6d8e9 100644
--- a/src/pages/mod/internal/zap/index.tsx
+++ b/src/pages/mod/internal/zap/index.tsx
@@ -74,6 +74,7 @@ export const Zap = ({ modDetails }: ZapProps) => {
lastNode={}
notCloseAfterZap
setTotalZapAmount={setTotalZappedAmount}
+ setHasZapped={setHasZapped}
/>
)}
>
diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts
index ef03678..234c69d 100644
--- a/src/utils/nostr.ts
+++ b/src/utils/nostr.ts
@@ -104,31 +104,13 @@ export const npubToHex = (pubKey: string): string | null => {
* @returns The zap amount in the form of a number, converted from the extracted data, or 0 if the amount cannot be determined.
*/
export const extractZapAmount = (event: Event): number => {
- // Find the 'description' tag within the event's tags
- const description = event.tags.find(
- (tag) => tag[0] === 'description' && typeof tag[1] === 'string'
+ // Find the 'amount' tag within the parsed description's tags
+ const amountTag = event.tags.find(
+ (tag) => tag[0] === 'amount' && typeof tag[1] === 'string'
)
- // If the 'description' tag is found and it has a valid value
- if (description && description[1]) {
- try {
- // Parse the description as JSON to get additional details
- const parsedDescription: Event = JSON.parse(description[1])
-
- // Find the 'amount' tag within the parsed description's tags
- const amountTag = parsedDescription.tags.find(
- (tag) => tag[0] === 'amount' && typeof tag[1] === 'string'
- )
-
- // If the 'amount' tag is found and it has a valid value, convert it to an integer and return
- if (amountTag && amountTag[1]) return parseInt(amountTag[1]) / 1000
- } catch (error) {
- // Log an error message if JSON parsing fails
- console.log(
- `An error occurred while parsing description of zap event: ${error}`
- )
- }
- }
+ // If the 'amount' tag is found and it has a valid value, convert it to an integer and return
+ if (amountTag && amountTag[1]) return parseInt(amountTag[1]) / 1000
// Return 0 if the zap amount cannot be determined
return 0