Skip to content
Merged
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
14 changes: 0 additions & 14 deletions src/api/fragments/BasicParserItemData.ts

This file was deleted.

6 changes: 1 addition & 5 deletions src/api/fragments/prospectWithCorpusItems.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { gql } from '@apollo/client';
import { CuratedItemDataWithHistory } from './CuratedItemWithHistory';
import { RejectedItemData } from './rejectedItemData';
import { BasicParserItemData } from './BasicParserItemData';

/**
* Everything we need to fetch for a Prospect, including optional
Expand All @@ -16,6 +15,7 @@ export const ProspectDataWithCorpusItems = gql`
prospectType
url
createdAt
datePublished
imageUrl
authors
publisher
Expand All @@ -32,11 +32,7 @@ export const ProspectDataWithCorpusItems = gql`
rejectedCorpusItem {
...RejectedItemData
}
item {
...BasicParserItemData
}
}
${CuratedItemDataWithHistory}
${RejectedItemData}
${BasicParserItemData}
`;
51 changes: 5 additions & 46 deletions src/api/generatedTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,7 @@ export type Prospect = {
approvedCorpusItem?: Maybe<ApprovedCorpusItem>;
authors?: Maybe<Scalars['String']>;
createdAt?: Maybe<Scalars['Int']>;
datePublished?: Maybe<Scalars['String']>;
domain?: Maybe<Scalars['String']>;
excerpt?: Maybe<Scalars['String']>;
id: Scalars['ID'];
Expand Down Expand Up @@ -2635,15 +2636,6 @@ export enum Videoness {
NoVideos = 'NO_VIDEOS',
}

export type BasicParserItemDataFragment = {
__typename?: 'Item';
givenUrl: any;
itemId: string;
normalUrl: string;
datePublished?: any | null;
timeToRead?: number | null;
};

export type CollectionAuthorDataFragment = {
__typename?: 'CollectionAuthor';
externalId: string;
Expand Down Expand Up @@ -3038,6 +3030,7 @@ export type ProspectDataWithCorpusItemsFragment = {
prospectType: string;
url: string;
createdAt?: number | null;
datePublished?: string | null;
imageUrl?: string | null;
authors?: string | null;
publisher?: string | null;
Expand Down Expand Up @@ -3095,14 +3088,6 @@ export type ProspectDataWithCorpusItemsFragment = {
createdBy: string;
createdAt: number;
} | null;
item?: {
__typename?: 'Item';
givenUrl: any;
itemId: string;
normalUrl: string;
datePublished?: any | null;
timeToRead?: number | null;
} | null;
};

export type RejectedItemDataFragment = {
Expand Down Expand Up @@ -4386,6 +4371,7 @@ export type UpdateProspectAsCuratedMutation = {
prospectType: string;
url: string;
createdAt?: number | null;
datePublished?: string | null;
imageUrl?: string | null;
authors?: string | null;
publisher?: string | null;
Expand Down Expand Up @@ -4443,14 +4429,6 @@ export type UpdateProspectAsCuratedMutation = {
createdBy: string;
createdAt: number;
} | null;
item?: {
__typename?: 'Item';
givenUrl: any;
itemId: string;
normalUrl: string;
datePublished?: any | null;
timeToRead?: number | null;
} | null;
} | null;
};

Expand Down Expand Up @@ -4951,6 +4929,7 @@ export type GetProspectsQuery = {
prospectType: string;
url: string;
createdAt?: number | null;
datePublished?: string | null;
imageUrl?: string | null;
authors?: string | null;
publisher?: string | null;
Expand Down Expand Up @@ -5008,14 +4987,6 @@ export type GetProspectsQuery = {
createdBy: string;
createdAt: number;
} | null;
item?: {
__typename?: 'Item';
givenUrl: any;
itemId: string;
normalUrl: string;
datePublished?: any | null;
timeToRead?: number | null;
} | null;
}>;
};

Expand Down Expand Up @@ -5675,15 +5646,6 @@ export const RejectedItemDataFragmentDoc = gql`
createdAt
}
`;
export const BasicParserItemDataFragmentDoc = gql`
fragment BasicParserItemData on Item {
givenUrl
itemId
normalUrl
datePublished
timeToRead
}
`;
export const ProspectDataWithCorpusItemsFragmentDoc = gql`
fragment ProspectDataWithCorpusItems on Prospect {
id
Expand All @@ -5693,6 +5655,7 @@ export const ProspectDataWithCorpusItemsFragmentDoc = gql`
prospectType
url
createdAt
datePublished
imageUrl
authors
publisher
Expand All @@ -5709,13 +5672,9 @@ export const ProspectDataWithCorpusItemsFragmentDoc = gql`
rejectedCorpusItem {
...RejectedItemData
}
item {
...BasicParserItemData
}
}
${CuratedItemDataWithHistoryFragmentDoc}
${RejectedItemDataFragmentDoc}
${BasicParserItemDataFragmentDoc}
`;
export const ScheduledItemDataFragmentDoc = gql`
fragment ScheduledItemData on ScheduledCorpusItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand Down Expand Up @@ -100,7 +99,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand All @@ -120,7 +118,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand All @@ -140,7 +137,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand All @@ -160,7 +156,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand All @@ -183,7 +178,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand All @@ -203,7 +197,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospect.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand Down Expand Up @@ -252,7 +245,6 @@ describe('The ExistingProspectCard component', () => {
<MemoryRouter>
<ExistingProspectCard
item={prospectWithScheduleHistory.approvedCorpusItem!}
parserItem={prospect.item!}
prospectId={prospect.prospectId}
onSchedule={onSchedule}
onRemoveProspect={onRemoveProspect}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline';
import { DateTime } from 'luxon';

import { curationPalette } from '../../../theme';
import { ApprovedCorpusItem, Item } from '../../../api/generatedTypes';
import { ApprovedCorpusItem } from '../../../api/generatedTypes';
import { Button } from '../../../_shared/components';
import { getCuratorNameFromLdap } from '../../helpers/helperFunctions';
import { ScheduleHistory } from '../ScheduleHistory/ScheduleHistory';
Expand All @@ -34,11 +34,6 @@ interface ExistingProspectCardProps {
* An object with everything approved curated item-related in it.
*/
item: ApprovedCorpusItem;

/**
* An object with details from the parser
*/
parserItem: Item;
/**
* This is the prospect.id and NOT prospect.prospectId
*/
Expand Down Expand Up @@ -73,7 +68,6 @@ export const ExistingProspectCard: React.FC<ExistingProspectCardProps> = (
): JSX.Element => {
const {
item,
parserItem,
onSchedule,
onRemoveProspect,
prospectId,
Expand Down Expand Up @@ -118,9 +112,9 @@ export const ExistingProspectCard: React.FC<ExistingProspectCardProps> = (
<ListItem disableGutters>
<ListItemText
secondary={
parserItem?.datePublished &&
item.datePublished &&
`Published ${DateTime.fromJSDate(
new Date(parserItem?.datePublished),
new Date(item.datePublished),
).toFormat('MMMM dd, yyyy')}`
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ describe('The ProspectFilters component', () => {
const onChange = jest.fn();
const onSortByPublishedDate = jest.fn();
const sortByPublishedDate = false;
const sortByTimeToRead = false;
const handleSortByTimeToRead = jest.fn();

// const mockSetFilters = jest.fn();
//
Expand All @@ -114,8 +112,6 @@ describe('The ProspectFilters component', () => {
onChange={onChange}
onSortByPublishedDate={onSortByPublishedDate}
sortByPublishedDate={sortByPublishedDate}
sortByTimeToRead={sortByTimeToRead}
handleSortByTimeToRead={handleSortByTimeToRead}
/>,
);
};
Expand Down Expand Up @@ -149,13 +145,6 @@ describe('The ProspectFilters component', () => {
expect(publishedDate).toBeInTheDocument();
});

it('should render the sort by time to read filter', () => {
renderComponent();

const timeToRead = screen.getByText(/Time to Read/i);
expect(timeToRead).toBeInTheDocument();
});

it('should render the topic filter', () => {
renderComponent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ interface ProspectFiltersProps {
* in the parent component (Prospecting page).
*/
sortByPublishedDate: boolean;

/**
* Boolean flag to represent the state of sortByTimeToRead toggle in the parent component
* (prospecting page)
*/
sortByTimeToRead: boolean;

/**
* Function to toggle sortByTimeToRead in the parent component (prospecting page)
*/
handleSortByTimeToRead: VoidFunction;
}

/**
Expand All @@ -95,8 +84,6 @@ export const ProspectFilters: React.FC<ProspectFiltersProps> = (
setFilterByPublisher,
onChange,
onSortByPublishedDate,
sortByTimeToRead,
handleSortByTimeToRead,
} = props;

// Extract all topics from prospects item data
Expand Down Expand Up @@ -150,19 +137,6 @@ export const ProspectFilters: React.FC<ProspectFiltersProps> = (
labelPlacement={'top'} // Ensures the label is on top of the switch
/>
</FormGroup>
<FormGroup>
<FormControlLabel
sx={{ mx: 2, mb: 2 }}
control={
<Switch
checked={sortByTimeToRead}
onChange={handleSortByTimeToRead}
/>
}
label={'Time to Read'}
labelPlacement={'top'} // Ensures the label is on top of the switch
/>
</FormGroup>
{/*Topic Filter*/}
{prospects.length > 0 && (
<FormGroup sx={{ mx: 1, mb: 2 }}>
Expand Down
Loading