diff --git a/src/App.tsx b/src/App.tsx index 0952280..ed04b17 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,15 +5,10 @@ import useDisclaimerState from './utils/useDisclaimerState'; import useNav from './utils/useNav'; import { useEffect } from 'react'; import { defaultHashTags } from './components/env'; -import { useNDK } from '@nostr-dev-kit/ndk-react'; -import { useGlobalState } from './utils/globalState'; const App = () => { const { disclaimerAccepted, setDisclaimerAccepted } = useDisclaimerState(); const { nav, currentSettings } = useNav(); - const { loginWithNip07, ndk } = useNDK(); - - const [state, setState] = useGlobalState(); useEffect(() => { if (currentSettings.npubs.length == 0 && currentSettings.tags.length == 0) { @@ -21,16 +16,8 @@ const App = () => { } }, []); - const onLogin = async () => { - const result = await loginWithNip07(); - console.log(result); - result && setState({ userNPub: result.npub }); - }; return ( <> - {JSON.stringify(ndk?.signer)} - {state.userNPub } - {disclaimerAccepted ? ( ) : ( diff --git a/src/components/AdultContentInfo.tsx b/src/components/AdultContentInfo.tsx index 9513828..5c1303a 100644 --- a/src/components/AdultContentInfo.tsx +++ b/src/components/AdultContentInfo.tsx @@ -11,7 +11,7 @@ const AdultContentInfo = () => { }; const goBack = (e: MouseEvent) => { e.preventDefault(); - nav({...currentSettings, npubs: [], tags: [], showAdult: false }); + nav({ ...currentSettings, npubs: [], tags: [], showAdult: false }); }; return ( diff --git a/src/components/Disclaimer.tsx b/src/components/Disclaimer.tsx index a604ed1..85c3757 100644 --- a/src/components/Disclaimer.tsx +++ b/src/components/Disclaimer.tsx @@ -23,9 +23,9 @@ const Disclaimer = ({ disclaimerAccepted, setDisclaimerAccepted }: DisclaimerPro
The content presented on this site is entirely user-generated and remains unmoderated. Images and videos are sourced from the NOSTR platform and are not hosted on this site. Content filtering efforts are made - to avoid adult content, but we cannot guarantee complete safety. Please use discretion and be - responsible while engaging with the material on this platform. By using this site, you agree not to hold the - site owners, operators, and affiliates liable for any content-related experiences. + to avoid adult content, but we cannot guarantee complete safety. Please use discretion and be responsible while + engaging with the material on this platform. By using this site, you agree not to hold the site owners, + operators, and affiliates liable for any content-related experiences.
)} -
+ {state.userNPub && currentUserProfile ? ( + + ) : ( + + )} + {showGrid ? ( ) : ( diff --git a/src/components/SlideView/index.tsx b/src/components/SlideView/index.tsx index bb39058..a63ed6f 100644 --- a/src/components/SlideView/index.tsx +++ b/src/components/SlideView/index.tsx @@ -119,6 +119,7 @@ const SlideView = ({ settings, images, setShowGrid }: SlideViewProps) => { } if (event.key === 'p' || event.key === ' ' || event.key === 'P') { setPaused(p => !p); + event.stopPropagation(); } }; diff --git a/src/components/env.ts b/src/components/env.ts index 2f21c26..912a0b3 100644 --- a/src/components/env.ts +++ b/src/components/env.ts @@ -51,7 +51,6 @@ export const visibleHashTags = [ 'travel', ]; - /* All posts with the following hashtags are flagged as adult / NSFW are not shown by default. Users can enable this content through the adult content flag in the UI or through a URL parameter. diff --git a/src/components/nostrImageDownload.ts b/src/components/nostrImageDownload.ts index 6fb16c1..a5c0655 100644 --- a/src/components/nostrImageDownload.ts +++ b/src/components/nostrImageDownload.ts @@ -2,6 +2,12 @@ import { NDKEvent, NDKFilter, NDKTag } from '@nostr-dev-kit/ndk'; import { Kind, nip19 } from 'nostr-tools'; import { adultContentTags, adultPublicKeys } from './env'; +export type Post = { + event: NDKEvent; + wasZapped?: boolean; + wasLiked?: boolean; +}; + export type NostrImage = { url: string; author: string; @@ -11,11 +17,9 @@ export type NostrImage = { timestamp?: number; noteId: string; type: 'image' | 'video'; - event: NDKEvent; + post: Post; }; - - export const buildFilter = (tags: string[], npubs: string[], withReposts = false) => { const filter: NDKFilter = { kinds: [1, 1063] as Kind[], diff --git a/src/utils/globalState.tsx b/src/utils/globalState.tsx index aa4e9db..3fe7d93 100644 --- a/src/utils/globalState.tsx +++ b/src/utils/globalState.tsx @@ -1,8 +1,10 @@ +import { NDKUserProfile } from '@nostr-dev-kit/ndk'; import React, { createContext, useContext, useReducer } from 'react'; // Interface for our state interface GlobalState { userNPub?: string; + profile?: NDKUserProfile; } const initialState: GlobalState = { userNPub: undefined,