Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/(home)/fund/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { FeedItemSkeleton } from '@/components/Feed/FeedItemSkeleton';

export default function FundLoading() {
return (
<div>
<div className="flex items-center justify-end mt-2 sm:mt-4 mb-2">
<div className="h-5 w-24 rounded bg-gray-200 animate-pulse" />
</div>
<div className="mt-4 space-y-8">
{Array.from({ length: 3 }, (_, i) => (
<FeedItemSkeleton key={i} variant="grant" />
))}
</div>
</div>
);
}
38 changes: 5 additions & 33 deletions app/fund/page.tsx → app/(home)/fund/page.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,16 @@
import { Suspense } from 'react';
import { Metadata } from 'next';
import { buildOpenGraphMetadata } from '@/lib/metadata';
import { PageLayout } from '@/app/layouts/PageLayout';
import { FundingSidebarServer } from '@/components/Funding/FundingSidebarServer';
import { ActivitySidebarSkeleton } from '@/components/Funding/ActivitySidebarSkeleton';
import { HeroHeader } from '@/components/ui/HeroHeader';
import { FundGrantsPageContent } from './FundGrantsPageContent';
import { MarketplaceCards } from '@/components/Funding/MarketplaceCards';
import { FundingHeroPanel } from '@/components/Funding/FundingHeroPanel';
import { OpenFundingOpportunityCTA } from './OpenFundingOpportunityCTA';
import { FundGrantsPageContent } from '@/app/fund/FundGrantsPageContent';

export const metadata: Metadata = buildOpenGraphMetadata({
title: 'Funding Opportunities',
title: 'Fund',
description: 'Apply for funding opportunities via proposals.',
url: '/fund',
});

export default async function FundPage() {
export default function FundPage() {
return (
<PageLayout
topBanner={
<HeroHeader
title="Funding Opportunities"
subtitle={
<p className="text-sm sm:text-base text-gray-500">
Apply for funding opportunities via proposals.
</p>
}
cta={<FundingHeroPanel primaryCta={<OpenFundingOpportunityCTA />} />}
alignTop
>
<MarketplaceCards selected="grants" />
</HeroHeader>
}
rightSidebar={
<Suspense fallback={<ActivitySidebarSkeleton />}>
<FundingSidebarServer />
</Suspense>
}
>
<>
<section className="sr-only">
<p>
ResearchHub provides direct funding pathways for scientific research. Browse open funding
Expand Down Expand Up @@ -75,6 +47,6 @@ export default async function FundPage() {
</p>
</section>
<FundGrantsPageContent />
</PageLayout>
</>
);
}
16 changes: 16 additions & 0 deletions app/(home)/fund/proposals/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { FeedItemSkeleton } from '@/components/Feed/FeedItemSkeleton';

export default function FundProposalsLoading() {
return (
<div>
<div className="flex items-center justify-end mt-2 sm:mt-4 mb-2">
<div className="h-4 w-24 rounded bg-gray-200 animate-pulse" />
</div>
<div className="mt-4 space-y-8">
{Array.from({ length: 3 }, (_, i) => (
<FeedItemSkeleton key={i} variant="fundraise" />
))}
</div>
</div>
);
}
19 changes: 19 additions & 0 deletions app/(home)/fund/proposals/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Metadata } from 'next';
import { buildOpenGraphMetadata } from '@/lib/metadata';
import { ProposalFeed } from '@/components/Funding/ProposalFeed';
import { ProposalSortAndFilters } from '@/components/Funding/ProposalSortAndFilters';

export const metadata: Metadata = buildOpenGraphMetadata({
title: 'Proposals',
description: 'Propose research, get reviewed, receive funding.',
url: '/fund/proposals',
});

export default function FundProposalsPage() {
return (
<div>
<ProposalSortAndFilters />
<ProposalFeed />
</div>
);
}
13 changes: 13 additions & 0 deletions app/(home)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ReactNode } from 'react';
import { PageLayout } from '@/app/layouts/PageLayout';
import { FundSidebar } from '@/components/Funding/FundSidebar';
import { HomeTabs } from '@/components/Funding/HomeTabs';

export default function HomeLayout({ children }: { children: ReactNode }) {

Check warning on line 6 in app/(home)/layout.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AZ-9jRP4YF6UPUsdXFNX&open=AZ-9jRP4YF6UPUsdXFNX&pullRequest=983
return (
<PageLayout rightSidebar={<FundSidebar />}>
<HomeTabs />
{children}
</PageLayout>
);
}
11 changes: 11 additions & 0 deletions app/(home)/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ActivityCardSkeleton } from '@/components/Activity/ActivityCardSkeleton';

export default function HomeLoading() {
return (
<div>
{[...Array(6)].map((_, i) => (

Check warning on line 6 in app/(home)/loading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use `new Array()` instead of `Array()`.

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AZ-9jRQFYF6UPUsdXFNY&open=AZ-9jRQFYF6UPUsdXFNY&pullRequest=983
<ActivityCardSkeleton key={i} />

Check warning on line 7 in app/(home)/loading.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not use Array index in keys

See more on https://sonarcloud.io/project/issues?id=ResearchHub_web&issues=AZ-9jRQFYF6UPUsdXFNZ&open=AZ-9jRQFYF6UPUsdXFNZ&pullRequest=983
))}
</div>
);
}
13 changes: 13 additions & 0 deletions app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Metadata } from 'next';
import { buildOpenGraphMetadata } from '@/lib/metadata';
import { FundActivityPageContent } from '@/components/Funding/FundActivityPageContent';

export const metadata: Metadata = buildOpenGraphMetadata({
title: 'Activity',
description: 'Recent activity across funding opportunities and proposals.',
url: '/',
});

export default function HomeActivityPage() {
return <FundActivityPageContent />;
}
2 changes: 1 addition & 1 deletion app/about/components/CTASection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const CTASection = () => {
{
kind: 'action',
label: 'Join ResearchHub',
onAction: () => showAuthModal(() => router.push('/popular')),
onAction: () => showAuthModal(() => router.push('/')),
},
{ kind: 'link', href: '/fund', label: 'Fund science', external: true },
];
Expand Down
2 changes: 1 addition & 1 deletion app/expert-finder/ExpertFinderClientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function ExpertFinderClientLayout({ children }: ExpertFinderClien

useEffect(() => {
if (!isLoading && !canAccessExpertFinder) {
router.push('/popular');
router.push('/');
}
}, [isLoading, canAccessExpertFinder, router]);

Expand Down
26 changes: 0 additions & 26 deletions app/fund/loading.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions app/fund/proposals/loading.tsx

This file was deleted.

69 changes: 0 additions & 69 deletions app/fund/proposals/page.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion app/layouts/components/RightSidebarContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { RightSidebar } from '../RightSidebar';

function getSidebarInstanceKey(pathname: string, rightSidebar: boolean | ReactNode): string {
if (typeof rightSidebar !== 'boolean') {
return `custom:${pathname}`;
return 'custom';
}

if (pathname.startsWith('/paper/create')) {
Expand Down
14 changes: 4 additions & 10 deletions app/layouts/topbar/pageRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,16 @@ import { Icon } from '@/components/ui/icons';
import { getTopicEmoji } from '@/components/Topic/TopicEmojis';
import { toTitleCase } from '@/utils/stringUtils';
import { getSourceLogo, getPreprintDisplayName } from '@/utils/preprintUtil';
import { HOME_TAB_PATHS, isHomeTabPath } from '@/hooks/useFundTabs';

export interface PageInfo {
title: string;
icon?: React.ReactNode;
}

export const ROOT_NAVIGATION_PATHS = new Set([
'/',
'/following',
'/latest',
'/popular',
'/for-you',
'/feed',
...HOME_TAB_PATHS,
'/earn',
'/fund',
'/fund/proposals',
'/journal',
'/notebook',
'/browse',
Expand All @@ -47,7 +41,7 @@ interface RouteRule {

const ROUTE_RULES: RouteRule[] = [
{
match: (p) => ['/', '/following', '/latest', '/popular', '/for-you', '/feed'].includes(p),
match: (p) => isHomeTabPath(p),
getInfo: () => ({
title: 'Home',
icon: <FontAwesomeIcon icon={faHouseLight} fontSize={24} color="#000" />,
Expand Down Expand Up @@ -152,7 +146,7 @@ const ROUTE_RULES: RouteRule[] = [
}),
},
{
match: (p) => p === '/fund' || p.startsWith('/fund/') || p.startsWith('/grant/'),
match: (p) => p.startsWith('/fund/') || p.startsWith('/grant/'),
getInfo: () => ({
title: 'Fund',
icon: <Icon name="fund" size={24} className="text-gray-900" />,
Expand Down
2 changes: 1 addition & 1 deletion app/moderators/ModerationClientLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function ModerationClientLayout({ children }: ModerationClientLay

useEffect(() => {
if (!isLoading && !isModerator) {
router.push('/popular');
router.push('/');
}
}, [isLoading, isModerator, router]);

Expand Down
37 changes: 0 additions & 37 deletions app/page.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export default function robots(): MetadataRoute.Robots {
'/dashboard/',
'/notifications/',
'/activity/',
'/for-you/',
'/following/',
'/notebook/',
'/moderators/',
'/expert-finder/',
Expand Down
Loading