@@ -92,7 +91,7 @@ export default function AppLayout({ children }: Props) {
) : (
{children}
)}
- {!isSingleDropOpen && !isStreamRoute && !isHomeFeedView && (
+ {!isSingleDropOpen && !isStreamRoute && (
)}
{!isSingleDropOpen && !isEditingOnMobile && (
diff --git a/components/layout/SmallScreenLayout.tsx b/components/layout/SmallScreenLayout.tsx
index dcba5c6e28..d24a2ffdca 100644
--- a/components/layout/SmallScreenLayout.tsx
+++ b/components/layout/SmallScreenLayout.tsx
@@ -1,8 +1,7 @@
"use client";
import { useHeaderContext } from "@/contexts/HeaderContext";
-import { useSearchParams } from "next/navigation";
-import type { ReactNode} from "react";
+import type { ReactNode } from "react";
import { useCallback, useEffect, useRef, useState } from "react";
import { SIDEBAR_WIDTHS } from "../../constants/sidebar";
import { SidebarProvider } from "../../hooks/useSidebarState";
@@ -20,9 +19,6 @@ export default function SmallScreenLayout({ children }: Props) {
const { setHeaderRef } = useHeaderContext();
const containerRef = useRef
(null);
- const searchParams = useSearchParams();
- const activeTab = searchParams?.get("tab") || "latest";
-
const headerWrapperRef = useCallback(
(node: HTMLDivElement | null) => {
registerRef("header", node);
@@ -38,15 +34,6 @@ export default function SmallScreenLayout({ children }: Props) {
};
}, [registerRef, setHeaderRef]);
- useEffect(() => {
- const container = containerRef.current;
- if (container && activeTab) {
- requestAnimationFrame(() => {
- container.scrollTop = 0;
- });
- }
- }, [activeTab]);
-
const toggleMenu = useCallback(() => {
setIsMenuOpen((prev) => !prev);
}, []);
@@ -59,9 +46,7 @@ export default function SmallScreenLayout({ children }: Props) {
+ className="tw-bg-black tw-overflow-auto">
= ({ hidden = false }) =
diff --git a/components/navigation/NavItem.tsx b/components/navigation/NavItem.tsx
index 371c3d2c7f..8ea4812c32 100644
--- a/components/navigation/NavItem.tsx
+++ b/components/navigation/NavItem.tsx
@@ -22,12 +22,12 @@ interface Props {
const NavItem = ({ item }: Props) => {
const pathname = usePathname();
const searchParams = useSearchParams();
- const { activeView, handleNavClick, homeActiveTab } = useViewContext();
+ const { activeView, handleNavClick } = useViewContext();
const { name } = item;
const { icon } = item;
- const isStream = name === "Stream";
+ const isLogoItem = name === "Home";
// Determine if the current wave (if any) is a DM
const waveIdFromQuery =
@@ -106,8 +106,7 @@ const NavItem = ({ item }: Props) => {
pathname ?? "",
searchParams ?? new URLSearchParams(),
activeView,
- isCurrentWaveDmValue,
- homeActiveTab ?? "latest"
+ isCurrentWaveDmValue
);
return (
@@ -123,7 +122,7 @@ const NavItem = ({ item }: Props) => {
)}
diff --git a/components/navigation/ViewContext.tsx b/components/navigation/ViewContext.tsx
index 07d05c5bbb..b36f0ed98d 100644
--- a/components/navigation/ViewContext.tsx
+++ b/components/navigation/ViewContext.tsx
@@ -16,24 +16,16 @@ import type { ApiWave } from "@/generated/models/ApiWave";
import { useSearchParams, useRouter } from "next/navigation";
import useDeviceInfo from "@/hooks/useDeviceInfo";
import {
- getHomeFeedRoute,
- getHomeLatestRoute,
+ getHomeRoute,
getMessagesBaseRoute,
getWaveRoute,
getWavesBaseRoute,
} from "@/helpers/navigation.helpers";
-import type { HomeTab } from "@/components/home/useHomeTabs";
-import {
- HOME_TAB_EVENT,
- getStoredHomeTab,
- setStoredHomeTab,
-} from "@/components/home/useHomeTabs";
interface ViewContextType {
activeView: ViewKey | null;
hardBack: (v: ViewKey) => void;
handleNavClick: (item: NavItem) => void;
- homeActiveTab: HomeTab;
clearLastVisited: (type: "wave" | "dm") => void;
}
@@ -47,14 +39,10 @@ export const ViewProvider: React.FC<{ readonly children: ReactNode }> = ({
const { isApp } = useDeviceInfo();
const [lastVisitedWave, setLastVisitedWave] = useState(null);
const [lastVisitedDm, setLastVisitedDm] = useState(null);
- const [homeActiveTab, setHomeActiveTab] = useState(() =>
- getStoredHomeTab()
- );
const waveParam = searchParams.get("wave");
const viewParam = searchParams.get("view");
const lastFetchedWaveIdRef = useRef(null);
- // Derived state: activeView is computed from URL params, not stored in state
const activeView = useMemo(() => {
if (waveParam) {
return null;
@@ -62,32 +50,6 @@ export const ViewProvider: React.FC<{ readonly children: ReactNode }> = ({
return viewParam ? (viewParam as ViewKey) : null;
}, [waveParam, viewParam]);
- useEffect(() => {
- const { window: browserWindow } = globalThis as typeof globalThis & {
- window?: Window | undefined;
- };
-
- const handleTabEvent = (event: Event) => {
- const detail = (event as CustomEvent<{ tab?: HomeTab | undefined }>)
- .detail;
- const tab = detail.tab;
- if (tab !== "feed" && tab !== "latest") return;
- setHomeActiveTab(tab);
- };
-
- browserWindow.addEventListener(
- HOME_TAB_EVENT,
- handleTabEvent as EventListener
- );
-
- return () => {
- browserWindow.removeEventListener(
- HOME_TAB_EVENT,
- handleTabEvent as EventListener
- );
- };
- }, []);
-
const fetchWaveDetails = useCallback((targetWaveId: string) => {
commonApiFetch({
endpoint: `/waves/${targetWaveId}`,
@@ -119,18 +81,8 @@ export const ViewProvider: React.FC<{ readonly children: ReactNode }> = ({
const handleNavClick = useCallback(
(item: NavItem) => {
if (item.kind === "route") {
- if (item.name === "Stream") {
- // activeView will become null automatically when URL changes (no wave/view params)
- setLastVisitedWave(null);
- setLastVisitedDm(null);
- setHomeActiveTab("feed");
- setStoredHomeTab("feed");
- router.push(getHomeFeedRoute());
- } else if (item.name === "Home") {
- // activeView will become null automatically when URL changes
- setHomeActiveTab("latest");
- setStoredHomeTab("latest");
- router.push(getHomeLatestRoute());
+ if (item.name === "Home") {
+ router.push(getHomeRoute());
} else {
router.push(item.href);
}
@@ -201,10 +153,9 @@ export const ViewProvider: React.FC<{ readonly children: ReactNode }> = ({
activeView,
handleNavClick,
hardBack,
- homeActiveTab,
clearLastVisited,
}),
- [activeView, handleNavClick, hardBack, homeActiveTab, clearLastVisited]
+ [activeView, handleNavClick, hardBack, clearLastVisited]
);
return (
diff --git a/components/navigation/isNavItemActive.ts b/components/navigation/isNavItemActive.ts
index af2f751fc3..f8d96c82ab 100644
--- a/components/navigation/isNavItemActive.ts
+++ b/components/navigation/isNavItemActive.ts
@@ -1,4 +1,3 @@
-import type { HomeTab } from "@/components/home/useHomeTabs";
import type { NavItem as NavItemData, ViewKey } from "./navTypes";
export const isNavItemActive = (
@@ -6,10 +5,8 @@ export const isNavItemActive = (
pathname: string,
searchParams: URLSearchParams,
activeView: ViewKey | null,
- isCurrentWaveDm: boolean,
- homeActiveTab: HomeTab
+ isCurrentWaveDm: boolean
): boolean => {
- // User profile pages and Network routes are active only when no in-app view is selected
if (item.name === "Network" && activeView === null) {
// Profile pages (/[user])
if (pathname.startsWith("/[user]")) {
@@ -43,29 +40,25 @@ export const isNavItemActive = (
const hasWaveParam = typeof waveParam === "string";
const isWavesPath = pathname === "/waves";
const isMessagesPath = pathname === "/messages";
- const tabParam = searchParams?.get("tab");
- const isFeedTab = homeActiveTab === "feed";
- const isHomeFeedPath = pathname === "/" && (tabParam === "feed" || isFeedTab);
const isWaveSubRoute =
- hasWaveParam && (isHomeFeedPath || isWavesPath || isMessagesPath);
+ hasWaveParam && (isWavesPath || isMessagesPath);
const viewParam = searchParams?.get("view");
const isWavesView = pathname === "/waves" || viewParam === "waves";
const isMessagesView = pathname === "/messages" || viewParam === "messages";
if (item.kind === "route") {
- if (item.name === "Stream") {
- return isHomeFeedPath && activeView === null;
- }
if (item.name === "Home") {
return (
pathname === "/" &&
activeView === null &&
- !isFeedTab &&
!hasWaveParam &&
!isWavesView &&
!isMessagesView
);
}
+ if (item.name === "Discover") {
+ return (pathname === "/discover" || pathname.startsWith("/discover/")) && activeView === null;
+ }
return pathname === item.href && activeView === null;
}
diff --git a/contexts/TitleContext.tsx b/contexts/TitleContext.tsx
index f538b7ef1f..16cf2d4f0e 100644
--- a/contexts/TitleContext.tsx
+++ b/contexts/TitleContext.tsx
@@ -18,7 +18,6 @@ type TitleContextType = {
notificationCount: number;
setNotificationCount: (count: number) => void;
setWaveData: (data: { name: string; newItemsCount: number } | null) => void;
- setStreamHasNewItems: (hasNewItems: boolean) => void;
};
const TitleContext = createContext(undefined);
@@ -80,17 +79,14 @@ export const TitleProvider: React.FC<{ children: React.ReactNode }> = ({
name: string;
newItemsCount: number;
} | null>(null);
- const [streamHasNewItems, setStreamHasNewItems] = useState(false);
const routeRef = useRef(pathname);
const queryRef = useRef(searchParams);
- const tabParam = searchParams?.get("tab");
const waveParam =
myStream?.activeWave.id ?? searchParams?.get("wave") ?? null;
const isWaveRoute =
pathname?.startsWith("/waves") ||
pathname?.startsWith("/messages") ||
(pathname === "/" && searchParams?.get("view") === "waves");
- const isHomeFeedTab = pathname === "/" && tabParam === "feed";
useEffect(() => {
if (routeRef.current === pathname) {
@@ -101,30 +97,15 @@ export const TitleProvider: React.FC<{ children: React.ReactNode }> = ({
setTitle(defaultTitle);
}, [pathname]);
- // Update title when route or query changes
useEffect(() => {
- const pathChanged = routeRef.current !== pathname;
- const queryChanged =
- queryRef.current?.toString() !== searchParams?.toString();
-
- if (pathChanged) {
+ if (routeRef.current !== pathname) {
routeRef.current = pathname;
queryRef.current = searchParams;
const defaultTitle = getDefaultTitleForRoute(pathname);
setTitle(defaultTitle);
- // Reset wave data when leaving the home feed tab
- if (!isHomeFeedTab) {
- setWaveData(null);
- setStreamHasNewItems(false);
- }
- } else if (queryChanged && isHomeFeedTab) {
- queryRef.current = searchParams;
- // Reset wave data when navigating between waves or back to stream
- if (!waveParam) {
- setWaveData(null);
- }
+ setWaveData(null);
}
- }, [pathname, searchParams, isHomeFeedTab, waveParam]);
+ }, [pathname, searchParams]);
const updateTitle = (newTitle: string) => {
if (routeRef.current === pathname) {
@@ -145,30 +126,12 @@ export const TitleProvider: React.FC<{ children: React.ReactNode }> = ({
return `${newItemsText}${waveData.name} | Brain`;
})();
- if (isHomeFeedTab) {
- if (waveTitle) return waveTitle;
-
- const prefix =
- streamHasNewItems && notificationCount === 0
- ? "(New messages) My Stream"
- : "My Stream";
- return `${prefix} | Brain`;
- }
-
if (isWaveRoute && waveTitle) {
return waveTitle;
}
return title;
- }, [
- isHomeFeedTab,
- isWaveRoute,
- waveParam,
- waveData,
- streamHasNewItems,
- title,
- notificationCount,
- ]);
+ }, [isWaveRoute, waveParam, waveData, title, notificationCount]);
// Memoize the context value to prevent unnecessary re-renders
const contextValue = useMemo(() => {
@@ -187,7 +150,6 @@ export const TitleProvider: React.FC<{ children: React.ReactNode }> = ({
notificationCount,
setNotificationCount,
setWaveData,
- setStreamHasNewItems,
};
}, [computedTitle, notificationCount]);
diff --git a/helpers/navigation.helpers.ts b/helpers/navigation.helpers.ts
index e49977bb4f..b7215122c5 100644
--- a/helpers/navigation.helpers.ts
+++ b/helpers/navigation.helpers.ts
@@ -6,9 +6,7 @@ export const mainSegment = (url: string): string => {
export const sameMainPath = (a: string, b: string): boolean => mainSegment(a) === mainSegment(b);
-export const getHomeLatestRoute = (): string => "/";
-
-export const getHomeFeedRoute = (): string => "/?tab=feed";
+export const getHomeRoute = (): string => "/";
export const getWavesBaseRoute = (_isApp: boolean): string => "/waves";
diff --git a/proxy.ts b/proxy.ts
index e72d2fc662..85e044b9bc 100644
--- a/proxy.ts
+++ b/proxy.ts
@@ -1,5 +1,5 @@
import {
- getHomeFeedRoute,
+ getHomeRoute,
getMessagesBaseRoute,
getNotificationsRoute,
getWaveRoute,
@@ -200,7 +200,7 @@ function resolveMyStreamHomeRedirect({
return `${getWavesBaseRoute(false)}?${params.toString()}`;
}
- return getHomeFeedRoute();
+ return getHomeRoute();
}
function resolveMyStreamRedirect(