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
2 changes: 0 additions & 2 deletions app/grant/[id]/[slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
modifiedTime: work.updatedDate,
expirationTime: work.note?.post?.grant?.endDate,
authors: work.authors.map((a) => a.authorProfile.fullName),
section: work.topics[0]?.name,
tags: work.topics.map((t) => t.name),
});
} catch {
return {};
Expand Down
4 changes: 2 additions & 2 deletions app/paper/[id]/[slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
publishedTime: work.publishedDate || work.createdDate,
modifiedTime: work.updatedDate,
authors: work.authors.map((a) => a.authorProfile.fullName),
section: work.topics[0]?.name,
tags: work.topics.map((t) => t.name),
section: work.topics?.[0]?.name,
tags: work.topics?.map((topic) => topic.name) ?? [],
});
} catch {
return {};
Expand Down
2 changes: 1 addition & 1 deletion app/paper/[id]/create/version/UploadVersionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function UploadVersionForm({
}))
);
const [selectedHubs, setSelectedHubs] = useState<Hub[]>(() => {
const sourceTopics = metadata?.topics ?? initialPaper.topics;
const sourceTopics = metadata?.topics ?? initialPaper.topics ?? [];
return sourceTopics.map((topic) => ({
id: topic.id,
name: topic.name,
Expand Down
2 changes: 1 addition & 1 deletion app/post/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function PostLoading() {
return (
<PageLayout
topBanner={<WorkHeaderSkeleton tabCount={4} />}
rightSidebar={<WorkRightSidebarSkeleton />}
rightSidebar={<WorkRightSidebarSkeleton showTopics={false} />}
>
<WorkSkeleton showPdf={false} />
</PageLayout>
Expand Down
2 changes: 0 additions & 2 deletions app/proposal/[id]/[slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
publishedTime: work.publishedDate || work.createdDate,
modifiedTime: work.updatedDate,
authors: work.authors.map((a) => a.authorProfile.fullName),
section: work.topics[0]?.name,
tags: work.topics.map((t) => t.name),
}),
// Tokenized URL — private proposal, keep it out of search indexes.
...(shareToken ? { robots: { index: false, follow: false } } : {}),
Expand Down
2 changes: 1 addition & 1 deletion app/question/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function QuestionLoading() {
return (
<PageLayout
topBanner={<WorkHeaderSkeleton tabCount={3} />}
rightSidebar={<WorkRightSidebarSkeleton />}
rightSidebar={<WorkRightSidebarSkeleton showTopics={false} />}
>
<WorkSkeleton showPdf={false} />
</PageLayout>
Expand Down
2 changes: 0 additions & 2 deletions app/report/[id]/[slug]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
publishedTime: work.publishedDate || work.createdDate,
modifiedTime: work.updatedDate,
authors: work.authors.map((author) => author.authorProfile.fullName),
section: work.topics[0]?.name,
tags: work.topics.map((topic) => topic.name),
});
}

Expand Down
1 change: 0 additions & 1 deletion components/Funding/GrantActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function GrantActionBar({ work, className }: GrantActionBarProps) {
const { vote, isVoting } = useVote({
votableEntityId: work.id,
feedContentType: 'POST',
relatedDocumentTopics: work.topics,
relatedDocumentId: work.id.toString(),
relatedDocumentContentType: work.contentType,
});
Expand Down
39 changes: 0 additions & 39 deletions components/Notebook/PublishingForm/components/TopicsSection.tsx

This file was deleted.

29 changes: 2 additions & 27 deletions components/Notebook/PublishingForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { WorkImageSection } from './components/WorkImageSection';
import { FundingSection } from './components/FundingSection';
import { AuthorsSection } from './components/AuthorsSection';
import { ContactsSection } from './components/ContactsSection';
import { TopicsSection } from './components/TopicsSection';
import { GrantDescriptionSection } from './components/GrantDescriptionSection';
import { GrantOrganizationSection } from './components/GrantOrganizationSection';
import { GrantFundingAmountSection } from './components/GrantFundingAmountSection';
Expand Down Expand Up @@ -100,7 +99,6 @@ const getButtonText = ({
const FORM_DEFAULTS = {
authors: [],
contacts: [],
topics: [],
rewardFunders: false,
nftSupply: '1000',
budget: '',
Expand Down Expand Up @@ -171,12 +169,6 @@ const populateFromPost = (post: any, setValue: (name: any, value: any) => void)
if (post.image) {
setValue('coverImage', { file: null, url: post.image });
}
if (post.topics?.length > 0) {
setValue(
'topics',
post.topics.map((t: any) => ({ value: t.id.toString(), label: t.name }))
);
}
if (post.authors?.length > 0) {
setValue(
'authors',
Expand All @@ -199,12 +191,6 @@ const populateFormFromNoteDetails = (
if (note.image || note.previewImage) {
setValue('coverImage', { file: null, key: note.image, url: note.previewImage });
}
if (note.topics?.length) {
setValue(
'topics',
note.topics.map((topic) => ({ value: topic.id.toString(), label: topic.name }))
);
}
if (note.authors?.length) {
setValue(
'authors',
Expand Down Expand Up @@ -242,20 +228,13 @@ const populateFormFromNoteDetails = (
}
};

/** Fills the gaps a Registered Report's proposal covers, which are ids without labels. */
/** Fills the author gap from a Registered Report's proposal. */
const populateRegisteredReportPrefill = (
note: NoteWithContent,
getValues: (name: any) => any,
setValue: (name: any, value: any) => void
) => {
const { topicIds = [], authorIds = [] } = note.registeredReportPrefill ?? {};

if (topicIds.length > 0 && getValues('topics').length === 0) {
setValue(
'topics',
topicIds.map((id) => ({ value: id.toString(), label: `Topic ${id}` }))
);
}
const { authorIds = [] } = note.registeredReportPrefill ?? {};

if (authorIds.length > 0 && getValues('authors').length === 0) {
setValue(
Expand Down Expand Up @@ -283,8 +262,6 @@ const buildNoteDetailsUpdate = (
return { image: values.coverImage?.key ?? '', previewImage: values.coverImage?.url ?? '' };
case 'authors':
return { authorIds: mapOptionsToIds(values.authors) };
case 'topics':
return { hubIds: mapOptionsToIds(values.topics) };
case 'contacts':
return isGrant ? { grantSettings: { contactIds: mapOptionsToIds(values.contacts) } } : null;
case 'organization':
Expand Down Expand Up @@ -684,7 +661,6 @@ export function PublishingForm({
fullJSON,
fullSrc: html || '',
assignDOI: !formData.workId,
topics: formData.topics.map((topic) => topic.value),
authors: mapOptionsToIds(formData.authors),
contacts: mapOptionsToIds(formData.contacts),
articleType: ARTICLE_TYPE_API_MAP[formData.articleType] ?? 'DISCUSSION',
Expand Down Expand Up @@ -840,7 +816,6 @@ export function PublishingForm({
</>
)}
{articleType === 'grant' ? <ContactsSection /> : <AuthorsSection />}
<TopicsSection />
{note.post?.doi && (
<div className="py-3 px-6 space-y-6">
<DOISection doi={note.post.doi} />
Expand Down
5 changes: 0 additions & 5 deletions components/Notebook/PublishingForm/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const publishingFormSchema = z
}),
authors: z.array(optionSchema),
contacts: z.array(optionSchema),
topics: z.array(optionSchema),
budget: z.string().optional(),
rewardFunders: z.boolean(),
nftArt: z.any().nullable(),
Expand Down Expand Up @@ -70,10 +69,6 @@ export const publishingFormSchema = z
isPublic: z.boolean().optional(),
})
.superRefine((data, ctx) => {
if (data.topics.length === 0) {
addIssue(ctx, 'topics', 'At least one topic is required');
}

if (data.articleType === 'grant') {
if (data.contacts.length === 0) {
addIssue(ctx, 'contacts', 'At least one contact is required for grants');
Expand Down
33 changes: 1 addition & 32 deletions components/modals/QuestionEditModal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'use client';

import { useState, useEffect } from 'react';
import { useState } from 'react';
import { BaseModal } from '@/components/ui/BaseModal';
import { Button } from '@/components/ui/Button';
import { Input } from '@/components/ui/form/Input';
import { CommentEditor } from '@/components/Comment/CommentEditor';
import { CommentContent } from '@/components/Comment/lib/types';
import { SessionProvider, useSession } from 'next-auth/react';
import { HubsSelector, Hub } from '@/components/Paper/forms/HubsSelector';
import { Work } from '@/types/work';
import { PostService } from '@/services/post.service';
import { toast } from 'react-hot-toast';
Expand All @@ -29,19 +27,6 @@ export const QuestionEditModal = ({ isOpen, onClose, work }: QuestionEditModalPr
const [title, setTitle] = useState(work.title);
const [plainText, setPlainText] = useState<string>('');
const [htmlContent, setHtmlContent] = useState<string>('');
const [selectedHubs, setSelectedHubs] = useState<Hub[]>([]);

// Initialize hubs from work topics
useEffect(() => {
if (work.topics && work.topics.length > 0) {
const hubs = work.topics.map((topic) => ({
id: topic.id.toString(),
name: topic.name,
slug: topic.slug || '',
}));
setSelectedHubs(hubs);
}
}, [work.topics]);

const handleSave = async () => {
if (!title.trim()) {
Expand All @@ -52,11 +37,6 @@ export const QuestionEditModal = ({ isOpen, onClose, work }: QuestionEditModalPr
// For editing existing questions, we don't require plainText if it hasn't been changed
// The content is already stored in work.previewContent

if (selectedHubs.length === 0) {
toast.error('Please select at least one topic');
return;
}

withVerification(async () => {
setIsSaving(true);
try {
Expand All @@ -66,7 +46,6 @@ export const QuestionEditModal = ({ isOpen, onClose, work }: QuestionEditModalPr
document_type: work.contentType === 'preregistration' ? 'PREREGISTRATION' : 'QUESTION',
full_src: htmlContent || work.previewContent || '',
renderable_text: plainText || work.title || '',
hubs: selectedHubs.map((h) => Number(h.id)),
title: title,
};

Expand Down Expand Up @@ -138,16 +117,6 @@ export const QuestionEditModal = ({ isOpen, onClose, work }: QuestionEditModalPr
}}
/>
</div>

{/* Topics */}
<div>
<HubsSelector
selectedHubs={selectedHubs}
onChange={setSelectedHubs}
error={null}
hideSelectedItems={true}
/>
</div>
</div>
</BaseModal>
);
Expand Down
8 changes: 0 additions & 8 deletions components/skeletons/PublishingFormSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ export function PublishingFormSkeleton() {
</div>
</div>

{/* Topics Section */}
<div className="py-3 px-6">
<div className="h-5 w-24 bg-gray-200 rounded mb-4" />
<div className="space-y-2">
<div className="h-8 w-full bg-gray-100 rounded" />
</div>
</div>

{/* Journal Section */}
<div className="p-6">
<div className="h-5 w-28 bg-gray-200 rounded mb-4" />
Expand Down
2 changes: 0 additions & 2 deletions components/work/ProposalSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { WorkMetadata } from '@/services/metadata.service';
import { getShareToken } from '@/lib/shareToken/server';
import { FundraiseSection } from './components/FundraiseSection';
import { FundingOpportunitySection } from './components/FundingOpportunitySection';
import { TopicsSection } from './components/TopicsSection';
import { NonprofitSection } from './components/NonprofitSection';
import { FundersSection } from './components/FundersSection';
import { PeerReviewsSection } from './components/PeerReviewsSection';
Expand Down Expand Up @@ -46,7 +45,6 @@ export const ProposalSidebar = async ({ work, metadata }: ProposalSidebarProps)
)}
{work.linkedGrant && <FundingOpportunitySection grant={work.linkedGrant} />}
{metadata.fundraising && <NonprofitSection fundraiseId={metadata.fundraising.id} />}
<TopicsSection topics={metadata.topics || []} />
{work.doi && <DOISection doi={work.doi} />}
</div>
);
Expand Down
10 changes: 0 additions & 10 deletions components/work/ProposalSidebarSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ export const ProposalSidebarSkeleton = () => {
</div>
</section>

{/* Topics */}
<section>
<div className="h-5 w-16 bg-gray-200 rounded mb-3" />
<div className="flex flex-wrap gap-2">
<div className="h-6 w-20 bg-gray-200 rounded-full" />
<div className="h-6 w-24 bg-gray-200 rounded-full" />
<div className="h-6 w-16 bg-gray-200 rounded-full" />
</div>
</section>

{/* DOI */}
<section>
<div className="h-5 w-10 bg-gray-200 rounded mb-2" />
Expand Down
2 changes: 0 additions & 2 deletions components/work/RegisteredReportSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SidebarHeader } from '@/components/ui/SidebarHeader';
import { DOISection } from './components/DOISection';
import { PeerReviewsSection } from './components/PeerReviewsSection';
import { TopicsSection } from './components/TopicsSection';
import type { RegisteredReportProposalDetails } from '@/types/registeredReport';

interface RegisteredReportSidebarProps {
Expand Down Expand Up @@ -34,7 +33,6 @@ export function RegisteredReportSidebar({
{reviewsUrl && (
<PeerReviewsSection peerReviews={proposal.peerReviews} reviewsUrl={reviewsUrl} />
)}
<TopicsSection topics={proposal.topics} />
{reportDoi && <DOISection doi={reportDoi} />}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion components/work/WorkHeader/WorkHeaderHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function useWorkVote(work: Work) {
const { vote, isVoting } = useVote({
votableEntityId: work.id,
feedContentType: work.contentType === 'paper' ? 'PAPER' : 'POST',
relatedDocumentTopics: work.topics,
relatedDocumentTopics: work.contentType === 'paper' ? work.topics : undefined,
relatedDocumentId: work.id.toString(),
relatedDocumentContentType: work.contentType,
});
Expand Down
2 changes: 1 addition & 1 deletion components/work/WorkPrimaryActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const WorkPrimaryActions = ({
const { vote, isVoting } = useVote({
votableEntityId: work.id,
feedContentType: work.contentType === 'paper' ? 'PAPER' : 'POST',
relatedDocumentTopics: work.topics,
relatedDocumentTopics: work.contentType === 'paper' ? work.topics : undefined,
relatedDocumentId: work.id.toString(),
relatedDocumentContentType: work.contentType,
});
Expand Down
2 changes: 1 addition & 1 deletion components/work/WorkRightSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const WorkRightSidebar = ({ work, metadata }: WorkRightSidebarProps) => {
})}
/>
)}
<TopicsSection topics={metadata.topics || []} />
{work.contentType === 'paper' && <TopicsSection topics={metadata.topics || []} />}
{work.doi && <DOISection doi={work.doi} />}
{work.postType !== 'QUESTION' && <LicenseSection license={work.license} />}
<FormatsSection formats={work.formats} />
Expand Down
Loading
Loading