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
41 changes: 10 additions & 31 deletions app/layouts/PublishMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,14 @@ const PUBLISH_MENU_SECTIONS = [
title: 'Funding Opportunity',
description: 'Fund specific research you care about',
icon: <Icon name="fund" size={18} color="#374151" />,
action: 'function',
handler: 'handleOpenGrant',
requiresAuth: true,
},
{
id: 'request-funding',
title: 'Proposal',
description: 'Raise money for your research',
icon: <FundingIcon size={18} color="#374151" />,
action: 'function',
handler: 'handleFundResearch',
requiresAuth: true,
},
{
id: 'submit-paper',
title: 'Preprint',
description: 'Publish your research as a preprint',
icon: <Icon name="submit1" size={18} color="#374151" />,
action: 'navigate',
path: '/notebook?newResearch=true',
requiresAuth: true,
},
],
},
Expand Down Expand Up @@ -115,24 +102,16 @@ export const PublishMenu: React.FC<PublishMenuProps> = ({ children, forceMinimiz
};

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;
}
}
});
} else if (item.action === 'navigate') {
router.push(item.path);
}
executeAuthenticatedAction(() => {
switch (item.handler) {
case 'handleFundResearch':
handleFundResearch();
break;
case 'handleOpenGrant':
handleOpenGrant();
break;
}
});

// Close mobile drawer after action
if (smAndDown) {
Expand Down
15 changes: 3 additions & 12 deletions app/notebook/[orgSlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useNotebookContext } from '@/contexts/NotebookContext';
import { useEffect } from 'react';
import { useSearchParams, useRouter } from 'next/navigation';
import proposalTemplate from '@/components/Editor/lib/data/proposalTemplate';
import { getInitialContent, initialContent } from '@/components/Editor/lib/data/initialContent';
import grantTemplate from '@/components/Editor/lib/data/grantTemplate';
import {
getDocumentTitle,
Expand All @@ -31,7 +30,6 @@ export default function OrganizationPage() {
const [{ isLoading: isUpdatingContent }, updateNoteContent] = useNoteContent();

const isNewFunding = searchParams.get('newFunding') === 'true';
const isNewResearch = searchParams.get('newResearch') === 'true';
const isNewGrant = searchParams.get('newGrant') === 'true';
const grantSource = searchParams.get('grantSource');
const proposalSource = searchParams.get('proposalSource');
Expand All @@ -44,7 +42,7 @@ export default function OrganizationPage() {
queryValue,
documentType,
}: {
template: typeof proposalTemplate | typeof initialContent | typeof grantTemplate;
template: typeof proposalTemplate | typeof grantTemplate;
queryParam?: string;
queryValue?: string;
documentType?: string;
Expand Down Expand Up @@ -78,14 +76,7 @@ export default function OrganizationPage() {
useEffect(() => {
if (!selectedOrg) return;

if (isNewResearch) {
createNoteWithContent(selectedOrg.slug, {
template: getInitialContent('research'),
queryParam: 'newResearch',
queryValue: 'true',
documentType: 'DISCUSSION',
});
} else if (isNewFunding) {
if (isNewFunding) {
// "Upload a document" is handled inline in OpenProposalModal; here we
// only create from template/blank.
if (proposalSource === 'blank') {
Expand All @@ -106,7 +97,7 @@ export default function OrganizationPage() {
documentType: 'GRANT',
});
}
}, [selectedOrg, isNewResearch, isNewFunding, isNewGrant, grantSource, proposalSource]); // eslint-disable-line react-hooks/exhaustive-deps
}, [selectedOrg, isNewFunding, isNewGrant, grantSource, proposalSource]); // eslint-disable-line react-hooks/exhaustive-deps

const handleStartFromTemplate = async () => {
if (!selectedOrg) return;
Expand Down
2 changes: 1 addition & 1 deletion components/Notebook/NoteEditorLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const NOTEBOOK_TOUR_FEATURE = 'notebook_tour';
// Query params the note-creation flows append when redirecting to the editor.
// Their presence means the user just created this note (vs. opening an existing
// one), which is the only moment we want to auto-launch the tour.
const NEW_NOTE_PARAMS = ['newResearch', 'newGrant', 'newFunding', 'template'];
const NEW_NOTE_PARAMS = ['newGrant', 'newFunding', 'template'];

// Friendly label for the note's work type, shown at the top-left of the doc.
function getWorkTypeLabel(
Expand Down
9 changes: 1 addition & 8 deletions components/Notebook/NotebookHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ export function NotebookHome() {
icon: <FundingIcon size={24} color="#2563eb" />,
onClick: () => setIsProposalModalOpen(true),
},
{
id: 'preprint',
title: 'Preprint',
description: 'Publish your research as a preprint',
icon: <Icon name="submit1" size={24} color="#2563eb" />,
onClick: () => router.push('/notebook?newResearch=true'),
},
];

const hasNotes = notes?.some(
Expand Down Expand Up @@ -117,7 +110,7 @@ export function NotebookHome() {
<NoteList notes={notes || []} isLoading={isLoadingNotes} />
) : (
<div className="rounded-xl border border-dashed border-gray-200 px-4 py-10 text-center text-sm text-gray-400">
No files yet. Create a funding opportunity, proposal, or preprint to get started.
No files yet. Create a funding opportunity or proposal to get started.
</div>
)}
</div>
Expand Down
11 changes: 0 additions & 11 deletions components/Notebook/NotebookPrimaryNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ export const NOTEBOOK_WORK_TYPES = [
label: 'Proposal',
description: 'Create a research proposal and optionally raise funding.',
},
{
value: 'discussion',
label: 'Preprint',
description: 'Share research findings or a manuscript.',
},
] as const;

type NotebookWorkType = (typeof NOTEBOOK_WORK_TYPES)[number]['value'];
Expand All @@ -36,7 +31,6 @@ const SectionHeading = ({ children }: { children: React.ReactNode }) => (
interface NotebookPrimaryNavigationProps {
onNewFundingOpportunity: () => void;
onNewProposal: () => void;
onNewPreprint: () => void;
onInvitePeople: () => void;
}

Expand All @@ -52,7 +46,6 @@ interface NotebookPrimaryNavigationProps {
export const NotebookPrimaryNavigation = ({
onNewFundingOpportunity,
onNewProposal,
onNewPreprint,
onInvitePeople,
}: NotebookPrimaryNavigationProps) => {
const { selectedOrg } = useOrganizationContext();
Expand All @@ -72,10 +65,6 @@ export const NotebookPrimaryNavigation = ({
icon: <FundingIcon size={18} color="#6b7280" />,
onClick: onNewProposal,
},
discussion: {
icon: <Icon name="submit1" size={18} color="#6b7280" />,
onClick: onNewPreprint,
},
};

return (
Expand Down
6 changes: 0 additions & 6 deletions components/Notebook/NotesMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ export function NotesMenu() {
setIsProposalModalOpen(true);
};

const handleNewPreprint = () => {
setIsOpen(false);
router.push('/notebook?newResearch=true');
};

const handleInvitePeople = () => {
setIsOpen(false);
setIsSettingsModalOpen(true);
Expand All @@ -105,7 +100,6 @@ export function NotesMenu() {
<NotebookPrimaryNavigation
onNewFundingOpportunity={handleNewFundingOpportunity}
onNewProposal={handleNewProposal}
onNewPreprint={handleNewPreprint}
onInvitePeople={handleInvitePeople}
/>
);
Expand Down

This file was deleted.

Loading