fix(stream): smooth scroll to linked post cards
Route resource card clicks to /browse?post=<id> instead of relying on hash anchors, then manually calculate the sticky filter offset when scrolling to the target bubble. Start from the top and smooth-scroll to the card for a clear transition, with delayed auto realignments after media above the target settles.
This commit is contained in:
@@ -19,9 +19,12 @@ export function PostRedirect() {
|
||||
|
||||
if (POST_STREAM_USES_MOCK) {
|
||||
const post = MOCK_POSTS.find((p) => p.id === id);
|
||||
navigate(post ? `/browse#post-${post.id}` : "/browse", {
|
||||
replace: true,
|
||||
});
|
||||
navigate(
|
||||
post ? `/browse?post=${encodeURIComponent(post.id)}` : "/browse",
|
||||
{
|
||||
replace: true,
|
||||
},
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +32,7 @@ export function PostRedirect() {
|
||||
`/api/posts/${id}?lang=${encodeURIComponent(langQuery(lang))}`,
|
||||
)
|
||||
.then((post) => {
|
||||
navigate(`/browse#post-${post.id}`, {
|
||||
navigate(`/browse?post=${encodeURIComponent(post.id)}`, {
|
||||
replace: true,
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user