@@ -35,6 +118,16 @@ const DetailsView = ({ images, activeImageIdx, setActiveImageIdx }: DetailsViewP
>
{uniq(currentImage?.tags).map(t => (
<>
diff --git a/src/components/Icons/IconBolt.tsx b/src/components/Icons/IconBolt.tsx
new file mode 100644
index 0000000..8f9b5cc
--- /dev/null
+++ b/src/components/Icons/IconBolt.tsx
@@ -0,0 +1,7 @@
+const IconBolt = () => (
+
+);
+
+export default IconBolt;
diff --git a/src/components/Icons/IconHeart.tsx b/src/components/Icons/IconHeart.tsx
new file mode 100644
index 0000000..2f504da
--- /dev/null
+++ b/src/components/Icons/IconHeart.tsx
@@ -0,0 +1,16 @@
+const IconHeart = ({ filled }: { filled: boolean }) => {
+ if (filled)
+ return (
+
+ );
+ else
+ return (
+
+ );
+};
+
+export default IconHeart;
\ No newline at end of file
diff --git a/src/components/SlideShow.tsx b/src/components/SlideShow.tsx
index c9358e2..a28c319 100644
--- a/src/components/SlideShow.tsx
+++ b/src/components/SlideShow.tsx
@@ -2,7 +2,6 @@ import { useNDK } from '@nostr-dev-kit/ndk-react';
import './SlideShow.css';
import React, { useEffect, useRef, useState } from 'react';
import {
- NostrEvent,
NostrImage,
buildFilter,
extractImageUrls,
@@ -24,6 +23,7 @@ import IconSettings from './Icons/IconSettings';
import IconPlay from './Icons/IconPlay';
import IconGrid from './Icons/IconGrid';
import useNav from '../utils/useNav';
+import { NDKEvent } from '@nostr-dev-kit/ndk';
/*
FEATURES:
@@ -53,7 +53,7 @@ FEATURES:
const SlideShow = () => {
const { ndk } = useNDK();
- const [posts, setPosts] = useState
([]);
+ const [posts, setPosts] = useState([]);
const images = useRef([]);
const fetchTimeoutHandle = useRef(0);
const [showGrid, setShowGrid] = useState(false);
@@ -68,9 +68,9 @@ const SlideShow = () => {
const postSubscription = ndk.subscribe(buildFilter(settings.tags, settings.npubs, settings.showReposts));
- postSubscription.on('event', (event: NostrEvent) => {
+ postSubscription.on('event', (event: NDKEvent) => {
setPosts(oldPosts => {
- event.isReply = isReply(event);
+ //event.isReply = isReply(event);
if (event.kind === 1063) {
const urlTag = event?.tags?.find(t => t[0]=='url')
@@ -84,7 +84,7 @@ const SlideShow = () => {
const repostedEvent = JSON.parse(event.content);
if (repostedEvent) {
event = repostedEvent;
- event.isRepost = true;
+ //event.isRepost = true;
}
} catch (e) {
// ingore, the content is no valid json
@@ -93,7 +93,7 @@ const SlideShow = () => {
if (
!blockedPublicKeys.includes(event.pubkey.toLowerCase()) && // remove blocked authors
- (settings.showReplies || !event.isReply) &&
+ (settings.showReplies || !isReply(event)) &&
oldPosts.findIndex(p => p.id === event.id) === -1 && // not duplicate
(settings.showAdult || !isAdultRelated(event))
) {
@@ -128,12 +128,14 @@ const SlideShow = () => {
return extractImageUrls(p.content)
.filter(url => isImage(url) || isVideo(url))
.map(url => ({
+ event: p,
url,
author: nip19.npubEncode(p.pubkey),
+ authorId: p.pubkey,
content: prepareContent(p.content),
type: isVideo(url) ? 'video' : 'image',
timestamp: p.created_at,
- noteId: p.id ? nip19.noteEncode(p.id) : '',
+ noteId: p.id || '',
tags: p.tags?.filter((t: string[]) => t[0] === 't').map((t: string[]) => t[1].toLowerCase()) || [],
}));
}),
diff --git a/src/components/env.ts b/src/components/env.ts
index e7d49f4..2f21c26 100644
--- a/src/components/env.ts
+++ b/src/components/env.ts
@@ -146,6 +146,7 @@ export const adultNPubs = [
'npub1z0xv9t5w6evrcg860kmgqq5tfj55mz84ta40uszjnfp9uhw2clkq63yrak', // ???
'npub1hpxzg0p4hrmfvqmrusa4lkyx0ay53k2gwkjr50qe2cedj3vkufhs030ff0', // Spankingbot
'npub1p4j4zfxvdgjrs26wx5dh9uvsvqfv8xa7ew89vv60nxang8cn0sxshyj28r', // Porn search bot
+ 'npub1tsrs6ptjnq5hluxawfme5sfxalfscapequm3ej0yfw65scwu8lys8q7y7l', // 💜 🔞EUPHORIA 🔞💜
];
export const adultPublicKeys = adultNPubs.map(npub => (nip19.decode(npub).data as string).toLowerCase());
@@ -171,6 +172,5 @@ export const defaultRelays = [
'wss://nostr.wine',
// "wss://nostr1.current.fyi/",
'wss://purplepag.es/', // needed for user profiles
- 'wss://n-word.sharivegas.com/', // needed for mostr.pub profiles
//"wss://feeds.nostr.band/pics",
];
diff --git a/src/components/nostrImageDownload.ts b/src/components/nostrImageDownload.ts
index 3d47e0f..6fb16c1 100644
--- a/src/components/nostrImageDownload.ts
+++ b/src/components/nostrImageDownload.ts
@@ -1,28 +1,20 @@
-import { NDKFilter, NDKKind, NDKTag } from '@nostr-dev-kit/ndk';
+import { NDKEvent, NDKFilter, NDKTag } from '@nostr-dev-kit/ndk';
import { Kind, nip19 } from 'nostr-tools';
import { adultContentTags, adultPublicKeys } from './env';
export type NostrImage = {
url: string;
author: string;
+ authorId: string; // PubKey
tags: string[];
content?: string;
timestamp?: number;
noteId: string;
type: 'image' | 'video';
+ event: NDKEvent;
};
-export interface NostrEvent {
- created_at: number;
- content: string;
- tags?: NDKTag[];
- kind?: NDKKind | number;
- pubkey: string;
- id?: string;
- sig?: string;
- isRepost: boolean;
- isReply: boolean;
-}
+
export const buildFilter = (tags: string[], npubs: string[], withReposts = false) => {
const filter: NDKFilter = {
diff --git a/src/main.tsx b/src/main.tsx
index 3180adc..101dfea 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -3,8 +3,9 @@ import ReactDOM from 'react-dom/client';
import { NDKProvider } from '@nostr-dev-kit/ndk-react';
import App from './App';
import './index.css';
-import {defaultRelays} from './components/env'
+import { defaultRelays } from './components/env';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
+import GlobalState from './utils/globalState';
const router = createBrowserRouter([
{
@@ -35,6 +36,8 @@ const router = createBrowserRouter([
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
-
+
+
+
);
diff --git a/src/utils/globalState.tsx b/src/utils/globalState.tsx
new file mode 100644
index 0000000..aa4e9db
--- /dev/null
+++ b/src/utils/globalState.tsx
@@ -0,0 +1,29 @@
+import React, { createContext, useContext, useReducer } from 'react';
+
+// Interface for our state
+interface GlobalState {
+ userNPub?: string;
+}
+const initialState: GlobalState = {
+ userNPub: undefined,
+};
+
+type GlobalStateType = [GlobalState, React.Dispatch>];
+
+export const GlobalStateContext = createContext([initialState, () => {}]);
+
+const GlobalState = ({ children }: { children: React.ReactElement }) => {
+ const [state, setState] = useReducer(
+ (state: GlobalState, newState: Partial) => ({
+ ...state,
+ ...newState,
+ }),
+ initialState
+ );
+
+ return {children};
+};
+
+export default GlobalState;
+
+export const useGlobalState = () => useContext(GlobalStateContext);
diff --git a/src/webln-types.d.ts b/src/webln-types.d.ts
new file mode 100644
index 0000000..6c1c34b
--- /dev/null
+++ b/src/webln-types.d.ts
@@ -0,0 +1 @@
+///