Skip to content

Commit

Permalink
Edit profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
moysa committed Jul 25, 2023
1 parent de8cec6 commit e00f091
Show file tree
Hide file tree
Showing 5 changed files with 1,052 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { useMessagesContext } from './contexts/MessagesContext';
import { useMediaContext } from './contexts/MediaContext';
import { useNotificationsContext } from './contexts/NotificationsContext';
import { useSearchContext } from './contexts/SearchContext';
import EditProfile from './pages/EditProfile';

const primalWindow = window as PrimalWindow;

Expand Down Expand Up @@ -78,6 +79,7 @@ const Router: Component = () => {
<Route path="/downloads" component={Downloads} />
<Route path="/download" element={<Navigate href='/downloads' />} />;
<Route path="/settings" component={Settings} />
<Route path="/settings/profile" component={EditProfile} />
<Route path="/profile/:npub?" component={Profile} />
<Route path="/p/:npub?" component={Profile} />
<Route path="/help" component={Help} />
Expand Down
15 changes: 14 additions & 1 deletion src/lib/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import { Relay, Event } from "nostr-tools";
import { Kind, minKnownProfiles } from "../constants";
import { sendMessage } from "../sockets";
import { NostrWindow, VanityProfiles } from "../types/primal";
import { NostrRelays, NostrWindow, VanityProfiles } from "../types/primal";
import { getStorage } from "./localStore";
import { sendEvent } from "./notes";

export const getUserProfiles = (pubkeys: string[], subid: string) => {
sendMessage(JSON.stringify([
Expand Down Expand Up @@ -138,3 +139,15 @@ export const fetchKnownProfiles: (vanityName: string) => Promise<VanityProfiles>
return { ...minKnownProfiles };
}
};


export const sendProfile = async (metaData: any, relays: Relay[], relaySettings?: NostrRelays) => {
const event = {
content: JSON.stringify(metaData),
kind: Kind.Metadata,
tags: [],
created_at: Math.floor((new Date()).getTime() / 1000),
};

return await sendEvent(event, relays, relaySettings);
};
Loading

0 comments on commit e00f091

Please sign in to comment.