scroll to top on opening notifications & thread pages
This commit is contained in:
parent
ff5d2ee32d
commit
e2164800a9
@ -10,6 +10,7 @@ import BackButton from "@/Components/Button/BackButton";
|
||||
import Collapsed from "@/Components/Collapsed";
|
||||
import Note from "@/Components/Event/EventComponent";
|
||||
import NoteGhost from "@/Components/Event/Note/NoteGhost";
|
||||
import ScrollToTop from "@/Components/ScrollToTop";
|
||||
import { chainKey } from "@/Utils/Thread/ChainKey";
|
||||
import { ThreadContext } from "@/Utils/Thread/ThreadContext";
|
||||
import { ThreadContextWrapper } from "@/Utils/Thread/ThreadContextWrapper";
|
||||
@ -224,6 +225,7 @@ export function ThreadRoute({ id }: { id?: string }) {
|
||||
|
||||
return (
|
||||
<ThreadContextWrapper link={link}>
|
||||
<ScrollToTop />
|
||||
<Thread />
|
||||
</ThreadContextWrapper>
|
||||
);
|
||||
|
@ -35,7 +35,7 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
|
||||
discriminator: login.publicKey?.slice(0, 12),
|
||||
extra: rb => {
|
||||
if (login.tags.item.length > 0) {
|
||||
rb.withFilter().kinds([EventKind.TextNote]).tag("t", login.tags.item);
|
||||
rb.withFilter().kinds([EventKind.TextNote, EventKind.Repost]).tag("t", login.tags.item);
|
||||
}
|
||||
},
|
||||
}) as TimelineSubject,
|
||||
|
12
packages/app/src/Components/ScrollToTop.tsx
Normal file
12
packages/app/src/Components/ScrollToTop.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import { useEffect } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
|
||||
export default function ScrollToTop() {
|
||||
const { pathname } = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, [pathname]);
|
||||
|
||||
return null;
|
||||
}
|
@ -15,6 +15,8 @@ import { getNotificationContext } from "./getNotificationContext";
|
||||
import { NotificationGroup } from "./NotificationGroup";
|
||||
const NotificationGraph = lazy(() => import("@/Pages/Notifications/NotificationChart"));
|
||||
|
||||
import ScrollToTop from "@/Components/ScrollToTop";
|
||||
|
||||
export default function NotificationsPage({ onClick }: { onClick?: (link: NostrLink) => void }) {
|
||||
const login = useLogin();
|
||||
const { isMuted } = useModeration();
|
||||
@ -51,6 +53,7 @@ export default function NotificationsPage({ onClick }: { onClick?: (link: NostrL
|
||||
|
||||
return (
|
||||
<>
|
||||
<ScrollToTop />
|
||||
<div className="main-content">
|
||||
{CONFIG.features.notificationGraph && (
|
||||
<Suspense fallback={<PageSpinner />}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user