From 07a5a40d9d386ce919eaa1a8130f403ec30ec648 Mon Sep 17 00:00:00 2001 From: nicktytarenko Date: Sat, 1 Aug 2026 16:36:37 +0300 Subject: [PATCH 1/2] Update primary nav and publish menu for the homepage hub. Point Home at the activity hub, rename Fund/Earn to Your Funding and Peer Review, and simplify the Post menu around funding actions. Co-authored-by: Cursor --- app/layouts/MobileBottomNav.tsx | 32 +++++++++++++--------- app/layouts/Navigation.tsx | 38 ++++++++++++++------------ app/layouts/PublishMenu.tsx | 48 +++++++++------------------------ 3 files changed, 52 insertions(+), 66 deletions(-) diff --git a/app/layouts/MobileBottomNav.tsx b/app/layouts/MobileBottomNav.tsx index 31650c990..d292fe7b5 100644 --- a/app/layouts/MobileBottomNav.tsx +++ b/app/layouts/MobileBottomNav.tsx @@ -13,7 +13,7 @@ import { faBars, } from '@fortawesome/pro-light-svg-icons'; import { faXTwitter, faDiscord, faGithub, faLinkedin } from '@fortawesome/free-brands-svg-icons'; -import { Sprout } from 'lucide-react'; +import { Sprout, Star } from 'lucide-react'; import { ChangelogLink } from '@/components/changelog/ChangelogLink'; import { Icon } from '@/components/ui/icons'; import { IconName } from '@/components/ui/icons/Icon'; @@ -22,7 +22,7 @@ import { SwipeableDrawer } from '@/components/ui/SwipeableDrawer'; import { useAuthenticatedAction } from '@/contexts/AuthModalContext'; import { useCurrencyPreference } from '@/contexts/CurrencyPreferenceContext'; import { useScrollContainer } from '@/contexts/ScrollContainerContext'; -import { useUser } from '@/contexts/UserContext'; +import { isHomeTabPath } from '@/hooks/useFundTabs'; interface NavItem { label: string; @@ -43,11 +43,12 @@ const moreNavItems: NavItem[] = [ // Check if a path is active const isPathActive = (path: string, currentPath: string): boolean => { - if (path === '/for-you' || path === '/popular') { - return ['/popular', '/for-you', '/latest', '/following', '/'].includes(currentPath); + // Activity, Fund and Proposals are tabs of the same homepage hub. + if (path === '/') { + return isHomeTabPath(currentPath); } - if (path === '/fund') { - return currentPath.startsWith('/fund'); + if (path === '/fund/dashboard') { + return currentPath === '/fund/dashboard' || currentPath.startsWith('/fund/dashboard/'); } if (path === '/notebook') { return currentPath.startsWith('/notebook'); @@ -73,15 +74,11 @@ export const MobileBottomNav: React.FC = () => { const { executeAuthenticatedAction } = useAuthenticatedAction(); const { showUSD, toggleCurrency } = useCurrencyPreference(); const scrollContainerRef = useScrollContainer(); - const { user } = useUser(); - - // Home href depends on auth state: logged in -> /for-you, logged out -> /popular - const homeHref = user ? '/for-you' : '/popular'; const mainNavItems: NavItem[] = [ - { label: 'Home', href: homeHref, iconKey: 'home', isDynamicHome: true }, - { label: 'Earn', href: '/earn', iconKey: 'earn' }, - { label: 'Fund', href: '/fund', iconKey: 'fund' }, + { label: 'Home', href: '/', iconKey: 'home', isDynamicHome: true }, + { label: 'Peer Review', href: '/earn', iconKey: 'peer-review' }, + { label: 'Your Funding', href: '/fund/dashboard', iconKey: 'fund' }, { label: 'Wallet', href: '/researchcoin', iconKey: 'wallet' }, { label: 'More', isMore: true, iconKey: 'more' }, ]; @@ -142,6 +139,15 @@ export const MobileBottomNav: React.FC = () => { color={iconColor} /> ); + case 'peer-review': + return ( + + ); case 'earn': return ( = ({ }) => { const { executeAuthenticatedAction } = useAuthenticatedAction(); const router = useRouter(); - const { user } = useUser(); // Dismissable "New" badge for the Endowment nav item. Lifted to the parent // so the click handler in NavLink can call dismissFeature() without each @@ -99,27 +99,24 @@ export const Navigation: React.FC = ({ [router] ); - // Home href depends on auth state: logged in -> /for-you, logged out -> /popular - const homeHref = user ? '/for-you' : '/popular'; - const navigationItems: NavigationItem[] = [ { label: 'Home', - href: homeHref, + href: '/', iconKey: 'home', isFontAwesome: true, description: 'Navigate to the home page', }, { - label: 'Fund', - href: '/fund', + label: 'Your Funding', + href: '/fund/dashboard', iconKey: 'fund', - description: 'Browse grants and fundraising opportunities', + description: 'Track the impact of the research you fund', }, { - label: 'Earn', + label: 'Peer Review', href: '/earn', - iconKey: 'earn', + isLucideStar: true, description: 'Earn RSC for completing peer reviews', }, { @@ -152,13 +149,13 @@ export const Navigation: React.FC = ({ }; const isPathActive = (path: string) => { - // Special case for home page - if (path === '/for-you' || path === '/popular') { - return ['/popular', '/for-you', '/latest', '/following'].includes(currentPath); + // Activity, Fund and Proposals are tabs of the same homepage hub. + if (path === '/') { + return isHomeTabPath(currentPath); } - if (path === '/fund') { - return currentPath.startsWith('/fund'); + if (path === '/fund/dashboard') { + return currentPath === '/fund/dashboard' || currentPath.startsWith('/fund/dashboard/'); } if (path === '/earn') { @@ -243,6 +240,13 @@ export const Navigation: React.FC = ({ /> ) : item.isLucideSprout ? ( + ) : item.isLucideStar ? ( + ) : item.iconKey ? ( ) : ( diff --git a/app/layouts/PublishMenu.tsx b/app/layouts/PublishMenu.tsx index a9358ee0d..624679491 100644 --- a/app/layouts/PublishMenu.tsx +++ b/app/layouts/PublishMenu.tsx @@ -6,8 +6,6 @@ import { BaseMenu, BaseMenuItem } from '@/components/ui/form/BaseMenu'; import { FundingIcon } from '@/components/ui/icons/FundingIcon'; import { useAuthenticatedAction } from '@/contexts/AuthModalContext'; import Icon from '@/components/ui/icons/Icon'; -import { useUser } from '@/contexts/UserContext'; -import { navigateToAuthorProfile } from '@/utils/navigation'; import { SwipeableDrawer } from '@/components/ui/SwipeableDrawer'; import { OpenFundingOpportunityModal, @@ -27,15 +25,14 @@ interface PublishMenuProps { const PUBLISH_MENU_SECTIONS = [ { - title: 'Publish on ResearchHub', + title: 'Post on ResearchHub', items: [ { id: 'give-funding', title: 'Funding Opportunity', description: 'Fund specific research you care about', icon: , - action: 'function', - handler: 'handleOpenGrant', + handler: 'handleOpenGrant' as const, requiresAuth: true, }, { @@ -43,17 +40,7 @@ const PUBLISH_MENU_SECTIONS = [ title: 'Proposal', description: 'Raise money for your research', icon: , - action: 'function', - handler: 'handleFundResearch', - requiresAuth: true, - }, - { - id: 'submit-paper', - title: 'Preprint', - description: 'Publish your research as a preprint', - icon: , - action: 'navigate', - path: '/notebook?newResearch=true', + handler: 'handleFundResearch' as const, requiresAuth: true, }, ], @@ -86,7 +73,6 @@ const MenuItemContent: React.FC = ({ icon, title, descript export const PublishMenu: React.FC = ({ children, forceMinimize = false }) => { const router = useRouter(); const { executeAuthenticatedAction } = useAuthenticatedAction(); - const { user } = useUser(); const { smAndDown } = useScreenSize(); const [isMobileDrawerOpen, setIsMobileDrawerOpen] = useState(false); const [isFundingOpportunityModalOpen, setIsFundingOpportunityModalOpen] = useState(false); @@ -110,28 +96,18 @@ export const PublishMenu: React.FC = ({ children, forceMinimiz router.push(`/notebook?newGrant=true&grantSource=${method}`); }; - const handleViewProfile = () => { - navigateToAuthorProfile(user?.id, false); - }; - const handleMenuItemClick = (item: (typeof PUBLISH_MENU_SECTIONS)[number]['items'][number]) => { if (item.requiresAuth) { executeAuthenticatedAction(() => { - if (item.action === 'navigate') { - router.push(item.path); - } else if (item.action === 'function') { - switch (item.handler) { - case 'handleFundResearch': - handleFundResearch(); - break; - case 'handleOpenGrant': - handleOpenGrant(); - break; - } + switch (item.handler) { + case 'handleFundResearch': + handleFundResearch(); + break; + case 'handleOpenGrant': + handleOpenGrant(); + break; } }); - } else if (item.action === 'navigate') { - router.push(item.path); } // Close mobile drawer after action @@ -154,7 +130,7 @@ export const PublishMenu: React.FC = ({ children, forceMinimiz }} > - Publish + Post ); @@ -248,7 +224,7 @@ export const PublishMenu: React.FC = ({ children, forceMinimiz }} role="button" tabIndex={0} - aria-label="Open publish menu" + aria-label="Open post menu" > {standardTrigger} {compactTrigger} From 1a80b65a9d594f76dd7de5337f9b67b41cdbd8ca Mon Sep 17 00:00:00 2001 From: nicktytarenko Date: Sun, 2 Aug 2026 17:46:38 +0300 Subject: [PATCH 2/2] Update MobileBottomNav and Navigation components to require authentication for 'Your Funding' tab and remove outdated comments. --- app/layouts/MobileBottomNav.tsx | 3 +-- app/layouts/Navigation.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/layouts/MobileBottomNav.tsx b/app/layouts/MobileBottomNav.tsx index d292fe7b5..e376ccc11 100644 --- a/app/layouts/MobileBottomNav.tsx +++ b/app/layouts/MobileBottomNav.tsx @@ -43,7 +43,6 @@ const moreNavItems: NavItem[] = [ // Check if a path is active const isPathActive = (path: string, currentPath: string): boolean => { - // Activity, Fund and Proposals are tabs of the same homepage hub. if (path === '/') { return isHomeTabPath(currentPath); } @@ -78,7 +77,7 @@ export const MobileBottomNav: React.FC = () => { const mainNavItems: NavItem[] = [ { label: 'Home', href: '/', iconKey: 'home', isDynamicHome: true }, { label: 'Peer Review', href: '/earn', iconKey: 'peer-review' }, - { label: 'Your Funding', href: '/fund/dashboard', iconKey: 'fund' }, + { label: 'Your Funding', href: '/fund/dashboard', iconKey: 'fund', requiresAuth: true }, { label: 'Wallet', href: '/researchcoin', iconKey: 'wallet' }, { label: 'More', isMore: true, iconKey: 'more' }, ]; diff --git a/app/layouts/Navigation.tsx b/app/layouts/Navigation.tsx index 28b28df5d..db6bbae2f 100644 --- a/app/layouts/Navigation.tsx +++ b/app/layouts/Navigation.tsx @@ -111,6 +111,7 @@ export const Navigation: React.FC = ({ label: 'Your Funding', href: '/fund/dashboard', iconKey: 'fund', + requiresAuth: true, description: 'Track the impact of the research you fund', }, { @@ -149,7 +150,6 @@ export const Navigation: React.FC = ({ }; const isPathActive = (path: string) => { - // Activity, Fund and Proposals are tabs of the same homepage hub. if (path === '/') { return isHomeTabPath(currentPath); }