From 3dea0c8ed209df92e412ed9eb49e8c5b5d159bbb Mon Sep 17 00:00:00 2001 From: Kiana McCullough Date: Mon, 13 Jan 2025 15:28:14 -0800 Subject: [PATCH] removing tag and affiliation --- .../FeaturedResearch.test.tsx | 40 ++------ .../FeaturedResearch/FeaturedResearch.tsx | 98 ++----------------- 2 files changed, 13 insertions(+), 125 deletions(-) diff --git a/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.test.tsx b/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.test.tsx index 5a504bb3e6..a1d64d3fae 100644 --- a/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.test.tsx +++ b/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.test.tsx @@ -42,23 +42,13 @@ describe('FeaturedResearch Tests', () => { columnType: ColumnTypeEnum.DATE, id: '3', }, - { - name: 'tags', - columnType: ColumnTypeEnum.STRING_LIST, - id: '4', - }, - { - name: 'affiliation', - columnType: ColumnTypeEnum.STRING, - id: '5', - }, { name: 'image', columnType: ColumnTypeEnum.FILEHANDLEID, - id: '6', + id: '4', }, - { name: 'link', columnType: ColumnTypeEnum.LINK, id: '7' }, - { name: 'order', columnType: ColumnTypeEnum.INTEGER, id: '8' }, + { name: 'link', columnType: ColumnTypeEnum.LINK, id: '5' }, + { name: 'order', columnType: ColumnTypeEnum.INTEGER, id: '6' }, ], rows: [ { @@ -67,8 +57,6 @@ describe('FeaturedResearch Tests', () => { 'Title 1', 'Description 1', '1726164997000', - '["tag1_1", "tag1_2"]', - 'affiliation 1', '151525812', 'https://mockurl.com/data-release-1', '2', @@ -80,8 +68,6 @@ describe('FeaturedResearch Tests', () => { 'Title 2', 'Description 2', '1726164997000', - '["tag2_1"]', - 'affiliation 2', '151468828', 'https://mockurl.com/data-release-2', '2', @@ -106,23 +92,13 @@ describe('FeaturedResearch Tests', () => { columnType: ColumnTypeEnum.DATE, id: '3', }, - { - name: 'tags', - columnType: ColumnTypeEnum.STRING_LIST, - id: '4', - }, - { - name: 'affiliation', - columnType: ColumnTypeEnum.STRING, - id: '5', - }, { name: 'image', columnType: ColumnTypeEnum.FILEHANDLEID, - id: '6', + id: '4', }, - { name: 'link', columnType: ColumnTypeEnum.LINK, id: '7' }, - { name: 'order', columnType: ColumnTypeEnum.INTEGER, id: '8' }, + { name: 'link', columnType: ColumnTypeEnum.LINK, id: '5' }, + { name: 'order', columnType: ColumnTypeEnum.INTEGER, id: '6' }, ], } @@ -169,12 +145,8 @@ describe('FeaturedResearch Tests', () => { expect(screen.getByText('Read more')).toBeInTheDocument() expect(screen.getByText('Title 1')).toBeInTheDocument() expect(screen.getByText('Description 1')).toBeInTheDocument() - expect(screen.getByText('tag1_1')).toBeInTheDocument() - expect(screen.getByText('affiliation 1')).toBeInTheDocument() expect(screen.getByText('Title 2')).toBeInTheDocument() - expect(screen.getByText('tag2_1')).toBeInTheDocument() - expect(screen.getByText('affiliation 2')).toBeInTheDocument() expect(screen.getByText('September, 2024')).toBeInTheDocument() await waitFor(() => { diff --git a/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.tsx b/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.tsx index c8f9174a29..b1b2d7e0b9 100644 --- a/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.tsx +++ b/packages/synapse-react-client/src/components/FeaturedResearch/FeaturedResearch.tsx @@ -28,11 +28,9 @@ export type FeaturedResearchCardProps = { research: Row entityId: string isLoading: boolean - affiliationColIndex: number publicationDateColIndex: number titleColIndex: number descriptionColIndex: number - tagsColIndex: number linkColIndex: number imageColIndex: number } @@ -51,30 +49,11 @@ const useImageUrl = (fileId: string, entityId: string) => { return dataUrl } -const parseTags = ( - tagsColIndex: number, - research: { values: (string | null)[] }, -): string[] => { - try { - const tags = ( - research.values[tagsColIndex] - ? JSON.parse(research.values[tagsColIndex] || '') - : [] - ) as string[] - return tags - } catch (e) { - console.error(e) - return [] - } -} - const FeaturedResearchCard = ({ research, entityId, - affiliationColIndex, publicationDateColIndex, titleColIndex, - tagsColIndex, linkColIndex, imageColIndex, isLoading, @@ -99,14 +78,6 @@ const FeaturedResearchCard = ({ }} > - - {research.values[affiliationColIndex]} - - - {parseTags(tagsColIndex, research)[0] && ( - - {parseTags(tagsColIndex, research)[0] || ''} - - )} - - {research.values[publicationDateColIndex] && - formatDate( - dayjs(Number(research.values[publicationDateColIndex])), - 'MMMM, YYYY', - )} - - + + {research.values[publicationDateColIndex] && + formatDate( + dayjs(Number(research.values[publicationDateColIndex])), + 'MMMM, YYYY', + )} + - - {parseTags(tagsColIndex, research)[0] && ( - - {parseTags(tagsColIndex, research)[0] || ''} - - )} - - {research.values[affiliationColIndex] ?? ''} - - @@ -350,8 +268,6 @@ function FeaturedResearch(props: FeaturedResearchProps) { titleColIndex={titleColIndex} descriptionColIndex={descriptionColIndex} publicationDateColIndex={publicationDateColIndex} - tagsColIndex={tagsColIndex} - affiliationColIndex={affiliationColIndex} imageColIndex={imageColIndex} linkColIndex={linkColIndex} />