ui enhancements
This commit is contained in:
+7
-2
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import {
|
||||
AtSign,
|
||||
Bookmark,
|
||||
@@ -30,6 +30,11 @@ export default function MeLayout({ children }: { children: React.ReactNode }) {
|
||||
const { user, loading } = useAuth();
|
||||
const { requireAuth } = useAuthGate();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
// /u/me?edit=1 swaps the Posts grid for the inline edit form (see
|
||||
// app/u/me/page.tsx). The tab strip would just be in the way while the
|
||||
// user is editing — hide it for that one URL state.
|
||||
const editMode = searchParams.get("edit") === "1";
|
||||
|
||||
useEffect(() => {
|
||||
if (loading || user) return;
|
||||
@@ -86,7 +91,7 @@ export default function MeLayout({ children }: { children: React.ReactNode }) {
|
||||
joinedAt={user.created_at}
|
||||
editHref="/u/me?edit=1"
|
||||
/>
|
||||
<ProfileTabs tabs={tabs} />
|
||||
{editMode ? null : <ProfileTabs tabs={tabs} />}
|
||||
<div className="py-6">{children}</div>
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function MyPostsFeedPage() {
|
||||
if (!user) return null;
|
||||
|
||||
return (
|
||||
<main className="flex-1 max-w-xl w-full mx-auto px-3 sm:px-4 py-4 sm:py-6 space-y-6">
|
||||
<div className="max-w-xl w-full mx-auto space-y-6">
|
||||
{error ? (
|
||||
<p className="text-sm text-destructive">{error}</p>
|
||||
) : loading ? (
|
||||
@@ -103,6 +103,6 @@ export default function MyPostsFeedPage() {
|
||||
confirmLabel="Delete post"
|
||||
onConfirm={performDelete}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user