feat: hide post
This commit is contained in:
@@ -18,6 +18,7 @@ import { useRouter, useSearchParams } from "next/navigation";
|
||||
import {
|
||||
AtSign,
|
||||
Bookmark,
|
||||
EyeOff,
|
||||
FolderClosed,
|
||||
LayoutGrid,
|
||||
} from "lucide-react";
|
||||
@@ -51,6 +52,7 @@ export default function MeLayout({ children }: { children: React.ReactNode }) {
|
||||
posts: number;
|
||||
followers: number;
|
||||
following: number;
|
||||
hidden: number;
|
||||
} | null>(null);
|
||||
const handle = user?.handle;
|
||||
useEffect(() => {
|
||||
@@ -64,6 +66,7 @@ export default function MeLayout({ children }: { children: React.ReactNode }) {
|
||||
posts: p.post_count,
|
||||
followers: p.follower_count,
|
||||
following: p.following_count,
|
||||
hidden: p.hidden_count ?? 0,
|
||||
});
|
||||
}
|
||||
})
|
||||
@@ -109,6 +112,15 @@ export default function MeLayout({ children }: { children: React.ReactNode }) {
|
||||
},
|
||||
];
|
||||
|
||||
// Surface the "Hidden" tab only when the user actually has hidden posts.
|
||||
if ((counts?.hidden ?? 0) > 0) {
|
||||
tabs.push({
|
||||
href: "/u/me/hidden",
|
||||
label: "Hidden",
|
||||
icon: <EyeOff className="size-5" />,
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="flex-1 max-w-3xl w-full mx-auto px-4 sm:px-6">
|
||||
<ProfileHeader
|
||||
|
||||
Reference in New Issue
Block a user