@@ -254,31 +254,40 @@ export default function NavMobile() {
Donate
+ {curUser &&
+
+ toggleDrawerOpen(false)}
+ className='text-body4 font-bold hover:text-primary-600'>
+ Logout 👋
+
+ }
diff --git a/src/Components/Navbar/Navbar.tsx b/src/Components/Navbar/Navbar.tsx
index 9125eef..e871110 100644
--- a/src/Components/Navbar/Navbar.tsx
+++ b/src/Components/Navbar/Navbar.tsx
@@ -1,7 +1,8 @@
+
import NavMobile from "./NavMobile";
import { MdComment, MdHomeFilled, MdLocalFireDepartment } from "react-icons/md";
-import { useEffect, } from "react";
-import { useAppDispatch, useMediaQuery } from "src/utils/hooks";
+import { useCallback, useEffect, } from "react";
+import { useAppDispatch, useMediaQuery, useResizeListener } from "src/utils/hooks";
import { setNavHeight } from "src/redux/features/ui.slice";
import NavDesktop from "./NavDesktop";
import { MEDIA_QUERIES } from "src/utils/theme/media_queries";
@@ -43,18 +44,24 @@ export default function Navbar() {
const isLargeScreen = useMediaQuery(MEDIA_QUERIES.isLarge)
-
- useEffect(() => {
+ const updateNavHeight = useCallback(() => {
const nav = document.querySelector("nav");
if (nav) {
const navStyles = getComputedStyle(nav);
if (navStyles.display !== "none") {
dispatch(setNavHeight(nav.clientHeight));
+ document.documentElement.style.setProperty('--navHeight', nav.clientHeight + 'px')
}
}
-
}, [dispatch])
+ useEffect(() => {
+ updateNavHeight();
+ }, [updateNavHeight]);
+
+ useResizeListener(updateNavHeight)
+
+
return (
diff --git a/src/Components/VoteButton/VoteButton.tsx b/src/Components/VoteButton/VoteButton.tsx
index 7d49c20..7defb67 100644
--- a/src/Components/VoteButton/VoteButton.tsx
+++ b/src/Components/VoteButton/VoteButton.tsx
@@ -55,7 +55,7 @@ type BtnState = 'ready' | 'voting' | 'loading' | "success" | "fail";
export default function VoteButton({
votes,
onVote = () => { },
- fillType = 'leftRight',
+ fillType = 'background',
direction = 'horizontal',
disableCounter = false,
disableShake = true,
diff --git a/src/features/Donations/components/DonateCard/useDonate.tsx b/src/features/Donations/components/DonateCard/useDonate.tsx
index c69dfd7..5598619 100644
--- a/src/features/Donations/components/DonateCard/useDonate.tsx
+++ b/src/features/Donations/components/DonateCard/useDonate.tsx
@@ -17,56 +17,65 @@ export const useDonate = () => {
onError: (error: any) => void,
onSetteled: () => void
}>) => {
- setPaymentStatus(PaymentStatus.FETCHING_PAYMENT_DETAILS)
- donateMutation({
- variables: {
- amountInSat: amount
- },
- onCompleted: async (donationData) => {
- try {
- setPaymentStatus(PaymentStatus.AWAITING_PAYMENT);
- const webln = await Wallet_Service.getWebln()
- const paymentResponse = await webln.sendPayment(donationData.donate.payment_request);
- setPaymentStatus(PaymentStatus.PAID);
-
- //Confirm Voting payment
- confirmDonation({
- variables: {
- paymentRequest: donationData.donate.payment_request,
- preimage: paymentResponse.preimage
- },
- onCompleted: () => {
- setPaymentStatus(PaymentStatus.PAYMENT_CONFIRMED);
- config?.onSuccess?.();
- config?.onSetteled?.()
- },
- onError: (error) => {
- console.log(error)
- setPaymentStatus(PaymentStatus.NETWORK_ERROR);
- config?.onError?.(error);
- config?.onSetteled?.();
- alert("A network error happened while confirming the payment...")
- },
- refetchQueries: [
- 'DonationsStats'
- ]
- })
- } catch (error) {
- setPaymentStatus(PaymentStatus.CANCELED);
- config?.onError?.(error);
- config?.onSetteled?.();
- alert("Payment rejected by user")
+ Wallet_Service.getWebln()
+ .then(webln => {
+ if (!webln) {
+ config?.onError?.(new Error('No WebLN Detetcted'))
+ config?.onSetteled?.()
+ return
}
- },
- onError: (error) => {
- console.log(error);
- setPaymentStatus(PaymentStatus.NETWORK_ERROR);
- config?.onError?.(error);
- config?.onSetteled?.();
- alert("A network error happened...")
- }
- })
+ setPaymentStatus(PaymentStatus.FETCHING_PAYMENT_DETAILS)
+ donateMutation({
+ variables: {
+ amountInSat: amount
+ },
+ onCompleted: async (donationData) => {
+ try {
+ setPaymentStatus(PaymentStatus.AWAITING_PAYMENT);
+ const paymentResponse = await webln.sendPayment(donationData.donate.payment_request);
+ setPaymentStatus(PaymentStatus.PAID);
+
+ //Confirm Voting payment
+ confirmDonation({
+ variables: {
+ paymentRequest: donationData.donate.payment_request,
+ preimage: paymentResponse.preimage
+ },
+ onCompleted: () => {
+ setPaymentStatus(PaymentStatus.PAYMENT_CONFIRMED);
+ config?.onSuccess?.();
+ config?.onSetteled?.()
+ },
+ onError: (error) => {
+ console.log(error)
+ setPaymentStatus(PaymentStatus.NETWORK_ERROR);
+ config?.onError?.(error);
+ config?.onSetteled?.();
+ alert("A network error happened while confirming the payment...")
+ },
+ refetchQueries: [
+ 'DonationsStats'
+ ]
+ })
+ } catch (error) {
+ setPaymentStatus(PaymentStatus.CANCELED);
+ config?.onError?.(error);
+ config?.onSetteled?.();
+ alert("Payment rejected by user")
+ }
+
+ },
+ onError: (error) => {
+ console.log(error);
+ setPaymentStatus(PaymentStatus.NETWORK_ERROR);
+ config?.onError?.(error);
+ config?.onSetteled?.();
+ alert("A network error happened...")
+ }
+ })
+ })
+
}, [confirmDonation, donateMutation]);
const isLoading = paymentStatus !== PaymentStatus.DEFAULT && paymentStatus !== PaymentStatus.PAYMENT_CONFIRMED && paymentStatus !== PaymentStatus.NOT_PAID && paymentStatus !== PaymentStatus.NETWORK_ERROR && paymentStatus !== PaymentStatus.CANCELED
diff --git a/src/features/Hackathons/pages/HackathonsPage/HackathonsPage.tsx b/src/features/Hackathons/pages/HackathonsPage/HackathonsPage.tsx
index d097d0e..83b99f0 100644
--- a/src/features/Hackathons/pages/HackathonsPage/HackathonsPage.tsx
+++ b/src/features/Hackathons/pages/HackathonsPage/HackathonsPage.tsx
@@ -2,7 +2,6 @@
import { useState } from 'react'
import Button from 'src/Components/Button/Button'
import { useGetHackathonsQuery } from 'src/graphql'
-import { useAppSelector } from 'src/utils/hooks'
import HackathonsList from '../../Components/HackathonsList/HackathonsList'
import SortByFilter from '../../Components/SortByFilter/SortByFilter'
import styles from './styles.module.scss'
@@ -21,9 +20,6 @@ export default function HackathonsPage() {
tag: Number(tagFilter)
},
})
- const { navHeight } = useAppSelector((state) => ({
- navHeight: state.ui.navHeight
- }));
return (
<>
@@ -35,11 +31,7 @@ export default function HackathonsPage() {
className={`page-container pt-16 w-full ${styles.grid}`}
>
-
+
Hackathons 🏆
+
-
Reply
}
-
+
)
}
diff --git a/src/features/Posts/Components/Comments/CommentsSection/CommentsSection.tsx b/src/features/Posts/Components/Comments/CommentsSection/CommentsSection.tsx
index 4fab907..f35d36b 100644
--- a/src/features/Posts/Components/Comments/CommentsSection/CommentsSection.tsx
+++ b/src/features/Posts/Components/Comments/CommentsSection/CommentsSection.tsx
@@ -1,18 +1,16 @@
-import React, { useEffect, useMemo, useState } from 'react'
+import { useState } from 'react'
import CommentRoot from '../Comment/Comment'
import AddComment from '../AddComment/AddComment'
-import { Comment, } from '../types'
-import { createWorkerFactory, useWorker } from '@shopify/react-web-worker'
import { useAppSelector } from "src/utils/hooks";
-import * as CommentsWorker from './comments.worker'
import { Post_Type } from 'src/graphql'
import useComments from './useComments'
import IconButton from 'src/Components/IconButton/IconButton'
import { AiOutlineClose } from 'react-icons/ai'
-import { Link } from 'react-router-dom'
-import { createRoute } from 'src/utils/routing'
+import { Link, useLocation } from 'react-router-dom'
+import { createRoute, PAGES_ROUTES } from 'src/utils/routing'
import Preferences from 'src/services/preferences.service'
+import Card from 'src/Components/Card/Card';
// const createWorker = createWorkerFactory(() => import('./comments.worker'));
@@ -24,24 +22,11 @@ interface Props {
export default function CommentsSection({ type, id }: Props) {
- // const worker = useWorker(createWorker);
- // const commentsTree = useMemo(() => convertCommentsToTree(comments), [comments])
- // const [commentsTree, setCommentsTree] = useState
([])
const user = useAppSelector(state => state.user.me);
- const [showTooltip, setShowTooltip] = useState(Preferences.get('showNostrCommentsTooltip'))
- // const filter = useMemo(() => `boltfun ${type}_comment ${id}` + (process.env.NODE_ENV === 'development' ? ' dev' : ""), [id, type])
+ const [showTooltip, setShowTooltip] = useState(Preferences.get('showNostrCommentsTooltip'));
+ const location = useLocation()
- // useEffect(() => {
- // CommentsWorker.connect();
- // const unsub = CommentsWorker.sub(filter, (newComments) => {
- // setCommentsTree(newComments)
- // })
-
- // return () => {
- // unsub();
- // }
- // }, [filter]);
const { commentsTree, postComment, connectionStatus } = useComments({ type, id })
const handleNewComment = async (content: string, parentId?: string) => {
@@ -60,8 +45,7 @@ export default function CommentsSection({ type, id }: Props) {
return (
-
-
+
Discussion
{connectionStatus.status === 'Connected' &&
• Connected to {connectionStatus.connectedRelaysCount} relays 📡
}
@@ -75,12 +59,23 @@ export default function CommentsSection({ type, id }: Props) {
}
- {!!user &&
-
handleNewComment(content)}
- avatar={user.avatar}
- />
+ {
+
+
handleNewComment(content)}
+ avatar={user?.avatar ?? 'https://avatars.dicebear.com/api/bottts/Default.svg'}
+ />
+
+ {!user &&
+ Connect with ⚡ to comment
+
}
}
@@ -93,6 +88,6 @@ export default function CommentsSection({ type, id }: Props) {
onReply={content => handleNewComment(content, comment.nostr_id.toString())}
/>)}
-
+
)
}
diff --git a/src/features/Posts/Components/Comments/CommentsSection/useComments.tsx b/src/features/Posts/Components/Comments/CommentsSection/useComments.tsx
index 73eb220..6988a94 100644
--- a/src/features/Posts/Components/Comments/CommentsSection/useComments.tsx
+++ b/src/features/Posts/Components/Comments/CommentsSection/useComments.tsx
@@ -166,7 +166,7 @@ async function signEvent(event: any) {
}
async function confirmPublishingEvent(event: any) {
- const res = await fetch(CONSTS.apiEndpoint + '/nostr-confirm-event', {
+ await fetch(CONSTS.apiEndpoint + '/nostr-confirm-event', {
method: "post",
body: JSON.stringify({ event }),
credentials: 'include',
@@ -174,8 +174,8 @@ async function confirmPublishingEvent(event: any) {
'Content-Type': 'application/json'
},
});
- const data = await res.json()
- return data.event;
+
+
}
diff --git a/src/features/Posts/Components/Comments/index.tsx b/src/features/Posts/Components/Comments/index.tsx
index d7f4694..2c748fc 100644
--- a/src/features/Posts/Components/Comments/index.tsx
+++ b/src/features/Posts/Components/Comments/index.tsx
@@ -1 +1 @@
-export { default as CommentsSection } from './CommentsSection/CommentsSection'
\ No newline at end of file
+export { default } from './CommentsSection/CommentsSection'
\ No newline at end of file
diff --git a/src/features/Posts/Components/PostCard/StoryCard/StoryCard.tsx b/src/features/Posts/Components/PostCard/StoryCard/StoryCard.tsx
index fb5813a..286a316 100644
--- a/src/features/Posts/Components/PostCard/StoryCard/StoryCard.tsx
+++ b/src/features/Posts/Components/PostCard/StoryCard/StoryCard.tsx
@@ -7,6 +7,7 @@ import { Author, Tag, Vote_Item_Type } from 'src/graphql';
import Badge from "src/Components/Badge/Badge"
import { createRoute } from "src/utils/routing"
import { BiComment } from "react-icons/bi"
+import Card from "src/Components/Card/Card"
export type StoryCardType = Pick
+
{story.cover_image && }
@@ -56,6 +57,7 @@ export default function StoryCard({ story }: Props) {
-
+
+
)
}
diff --git a/src/features/Posts/Components/TrendingCard/TrendingCard.tsx b/src/features/Posts/Components/TrendingCard/TrendingCard.tsx
index c1f19e6..99f5cfd 100644
--- a/src/features/Posts/Components/TrendingCard/TrendingCard.tsx
+++ b/src/features/Posts/Components/TrendingCard/TrendingCard.tsx
@@ -1,5 +1,6 @@
import Skeleton from 'react-loading-skeleton'
import { Link } from 'react-router-dom'
+import Card from 'src/Components/Card/Card'
import Avatar from 'src/features/Profiles/Components/Avatar/Avatar'
import { useTrendingPostsQuery } from 'src/graphql'
import { random } from 'src/utils/helperFunctions'
@@ -12,7 +13,7 @@ export default function TrendingCard() {
return (
-
+
Trending on BOLT.FUN
{
@@ -34,6 +35,6 @@ export default function TrendingCard() {
}
)}
-
+
)
}
diff --git a/src/features/Posts/pages/CreatePostPage/Components/ContentEditor/Toolbar.tsx b/src/features/Posts/pages/CreatePostPage/Components/ContentEditor/Toolbar.tsx
index c29e678..d0f2e53 100644
--- a/src/features/Posts/pages/CreatePostPage/Components/ContentEditor/Toolbar.tsx
+++ b/src/features/Posts/pages/CreatePostPage/Components/ContentEditor/Toolbar.tsx
@@ -17,9 +17,10 @@ export default function Toolbar() {
{/*
*/}
-
+
+
diff --git a/src/features/Posts/pages/FeedPage/FeedPage.tsx b/src/features/Posts/pages/FeedPage/FeedPage.tsx
index 79a6f35..a4257cb 100644
--- a/src/features/Posts/pages/FeedPage/FeedPage.tsx
+++ b/src/features/Posts/pages/FeedPage/FeedPage.tsx
@@ -2,7 +2,7 @@
import { useUpdateEffect } from '@react-hookz/web'
import { useState } from 'react'
import { useFeedQuery } from 'src/graphql'
-import { useAppSelector, useInfiniteQuery, usePreload } from 'src/utils/hooks'
+import { useInfiniteQuery, usePreload } from 'src/utils/hooks'
import PostsList from '../../Components/PostsList/PostsList'
import TrendingCard from '../../Components/TrendingCard/TrendingCard'
import PopularTagsFilter, { FilterTag } from './PopularTagsFilter/PopularTagsFilter'
@@ -34,10 +34,6 @@ export default function FeedPage() {
usePreload('PostPage');
- const { navHeight, isLoggedIn } = useAppSelector((state) => ({
- navHeight: state.ui.navHeight,
- isLoggedIn: Boolean(state.user.me),
- }));
return (
@@ -76,11 +72,7 @@ export default function FeedPage() {
/>