diff --git a/app/layouts/MobileBottomNav.tsx b/app/layouts/MobileBottomNav.tsx
index 31650c990..e376ccc11 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,11 @@ 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);
+ 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 +73,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', requiresAuth: true },
{ label: 'Wallet', href: '/researchcoin', iconKey: 'wallet' },
{ label: 'More', isMore: true, iconKey: 'more' },
];
@@ -142,6 +138,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,25 @@ 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',
+ requiresAuth: true,
+ 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 +150,12 @@ 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);
+ 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}