feat: share post to other apps
This commit is contained in:
+9
-5
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import { Suspense, useEffect } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||
import {
|
||||
AtSign,
|
||||
Bookmark,
|
||||
@@ -102,9 +102,13 @@ export default function MeLayout({ children }: { children: React.ReactNode }) {
|
||||
|
||||
function ConditionalTabs({ tabs }: { tabs: ProfileTab[] }) {
|
||||
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 pathname = usePathname();
|
||||
// Hide tabs when the user is in a focused subview:
|
||||
// • /u/me?edit=1 — the inline profile-edit form
|
||||
// • /u/me/settings — the reading-prefs page
|
||||
// In either case the strip is visual noise that distracts from the
|
||||
// task they navigated in to do.
|
||||
const editMode = searchParams.get("edit") === "1";
|
||||
return editMode ? null : <ProfileTabs tabs={tabs} />;
|
||||
const settingsMode = pathname.startsWith("/u/me/settings");
|
||||
return editMode || settingsMode ? null : <ProfileTabs tabs={tabs} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user