Topics
@@ -74,7 +80,11 @@ const Home = () => {
nav({
...currentSettings,
diff --git a/src/ngine/hooks/useEvents.ts b/src/ngine/hooks/useEvents.ts
index be02f93..d1c501b 100644
--- a/src/ngine/hooks/useEvents.ts
+++ b/src/ngine/hooks/useEvents.ts
@@ -15,7 +15,7 @@ export default function useEvents(filter: NDKFilter | NDKFilter[], opts?: Subscr
const [eose, setEose] = useState(false);
const [events, setEvents] = useState([]);
const id = useMemo(() => {
- console.warn('new ID!!!');
+ // console.warn('new ID!!!');
return hashSha256(filter);
}, [filter]);
diff --git a/src/utils/useProfile.ts b/src/utils/useProfile.ts
index 56af083..50c1059 100644
--- a/src/utils/useProfile.ts
+++ b/src/utils/useProfile.ts
@@ -1,32 +1,37 @@
-import { appName } from '../components/env';
+import { appName, topics } from '../components/env';
import { useEffect, useState } from 'react';
import { Settings } from './useNav';
import { NostrImage } from '../components/nostrImageDownload';
import useProfileNgine from '../ngine/hooks/useProfile';
import { nip19 } from 'nostr-tools';
import { NDKSubscriptionCacheUsage } from '@nostr-dev-kit/ndk';
+import { useLocation, useParams } from 'react-router-dom';
// TODO maybe remove profile and only build title here?? useTitle?
const useProfile = (settings: Settings, activeImage?: NostrImage) => {
const [title, setTitle] = useState(appName);
+ const location = useLocation();
+ const { topic } = useParams();
const profileNpub = settings.npubs.length == 1 ? settings.npubs[0] : activeImage && activeImage?.author;
const pubKeyHex = profileNpub ? (nip19.decode(profileNpub).data as string) : '';
const activeProfile = useProfileNgine(pubKeyHex, NDKSubscriptionCacheUsage.ONLY_RELAY);
- // console.log({profileNpub, pubKeyHex, activeProfile})
-
useEffect(() => {
if (settings.npubs.length > 0 && activeProfile && (activeProfile.displayName || activeProfile.name)) {
setTitle((activeProfile.displayName || activeProfile.name) + ` | ${appName}`);
} else if (settings.tags && settings.tags.length > 0) {
setTitle('#' + settings.tags.join(' #') + ` | ${appName}`);
- } else {
- setTitle(`Random photos from popular hashtags | ${appName}`);
+ } else if (topic) {
+ setTitle(`${topics[topic].name} | ${appName}`);
+ } else if (location.pathname == '/global') {
+ setTitle(`Global | ${appName}`);
+ } else if (location.pathname == '/') {
+ setTitle(`Home | ${appName}`);
}
- }, [activeProfile, settings.npubs, settings.tags]);
+ }, [activeProfile, settings.npubs, settings.tags, topic, location]);
return {
activeProfile,