snort/src/Pages/Notifications.tsx

34 lines
792 B
TypeScript
Raw Normal View History

2023-01-22 11:17:50 +00:00
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
2023-01-22 11:17:50 +00:00
import { HexKey } from "Nostr";
2023-01-20 11:11:50 +00:00
import { markNotificationsRead } from "State/Login";
import { RootState } from "State/Store";
2023-01-22 11:17:50 +00:00
import Timeline from "Element/Timeline";
2023-01-02 11:15:13 +00:00
2022-12-30 23:35:02 +00:00
export default function NotificationsPage() {
const dispatch = useDispatch();
const pubkey = useSelector<RootState, HexKey | undefined>(
(s) => s.login.publicKey
);
2023-01-02 11:15:13 +00:00
useEffect(() => {
dispatch(markNotificationsRead());
}, []);
2023-01-02 11:15:13 +00:00
return (
<>
{pubkey && (
<Timeline
subject={{
type: "ptag",
2023-02-07 19:47:57 +00:00
items: [pubkey],
discriminator: pubkey.slice(0, 12),
}}
postsOnly={false}
method={"TIME_RANGE"}
/>
)}
</>
);
}