import { memo, useCallback, useMemo } from "react"; import { Button, Classes, Icon, Tag } from "@blueprintjs/core"; import CitekeyPopover from "Components/CitekeyPopover"; import { CustomClasses } from "../../../constants"; import { ShowTypeSemantic } from "../types"; import { SEnrichedItem } from "Types/transforms"; type OwnProps = { handleRemove: (value: SEnrichedItem) => void, handleSelect: (value: SEnrichedItem) => void, inGraph: string | false, isSelected: boolean, item: SEnrichedItem, type: ShowTypeSemantic }; const SemanticItem = memo(function SemanticItem(props) { const { handleRemove, handleSelect, inGraph, isSelected, item, type } = props; const { inLibrary } = item; const handleClick = useCallback(() => { if(isSelected){ handleRemove(item); } else { handleSelect(item); } }, [isSelected, item, handleRemove, handleSelect]); const itemActions = useMemo(() => { if(!inLibrary){ return ( <> {item.url ? {item.doi || "Semantic Scholar"} : null} {item.doi ?