fix: ui fixes
This commit is contained in:
@@ -51,10 +51,16 @@ export default function PublicProfileLayout(props: {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isOwn) return;
|
if (!isOwn) return;
|
||||||
// Preserve whatever sub-path the visitor is on so /u/<own>/collections
|
// Preserve whatever sub-path the visitor is on so /u/<own>/collections
|
||||||
// jumps to /u/me/collections (and so on for /posts, /mentions).
|
// jumps to /u/me/collections (and so on for /posts, /mentions). Also
|
||||||
|
// carry over the query string and hash — the hash holds the post anchor
|
||||||
|
// (#post-<id>) from share links, and it's only readable on the client
|
||||||
|
// (the server never receives it), which is why we read window.location
|
||||||
|
// here rather than from pathname / useSearchParams.
|
||||||
const m = pathname.match(/^\/u\/[^/]+(\/.*)?$/);
|
const m = pathname.match(/^\/u\/[^/]+(\/.*)?$/);
|
||||||
const suffix = m?.[1] ?? "";
|
const suffix = m?.[1] ?? "";
|
||||||
router.replace(`/u/me${suffix}`);
|
const search = window.location.search;
|
||||||
|
const hash = window.location.hash;
|
||||||
|
router.replace(`/u/me${suffix}${search}${hash}`);
|
||||||
}, [isOwn, router, pathname]);
|
}, [isOwn, router, pathname]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Sparkles } from "lucide-react";
|
|
||||||
import type { UserSummary } from "@/lib/social";
|
import type { UserSummary } from "@/lib/social";
|
||||||
import { UserAvatar } from "@/components/ui/user-avatar";
|
import { UserAvatar } from "@/components/ui/user-avatar";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user