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
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,14 @@ const createMockComponentLibraryContext = (
error: null,
existingComponentLibraries: undefined,
searchResult: null,
highlightedComponentDigest: null,
searchComponentLibrary: vi.fn(),
addToComponentLibrary: vi.fn(),
removeFromComponentLibrary: vi.fn(),
refetchLibrary: vi.fn(),
refetchUserComponents: vi.fn(),
setHighlightedComponentDigest: vi.fn(),
setComponentFavorite: vi.fn(),
checkIfUserComponent: vi.fn().mockReturnValue(false),
checkLibraryContainsComponent: vi.fn().mockReturnValue(false),
checkIfHighlighted: vi.fn().mockReturnValue(false),
getComponentLibrary: vi.fn(),
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Spinner } from "@/components/ui/spinner";
import { useHydrateComponentReference } from "@/hooks/useHydrateComponentReference";
import { cn } from "@/lib/utils";
import { useComponentLibrary } from "@/providers/ComponentLibraryProvider";
import { type ComponentReference, type TaskSpec } from "@/utils/componentSpec";
import { getComponentName } from "@/utils/getComponentName";
import { isSubgraph } from "@/utils/subgraphUtils";
Expand Down Expand Up @@ -83,7 +82,6 @@ const ComponentMarkup = ({

// TODO: respect selected node as a starting point
const carousel = useRef(0);
const { checkIfHighlighted } = useComponentLibrary();
const { notifyNode, getNodeIdsByDigest, fitNodeIntoView } = useNodesOverlay();

const { spec, digest, url, name, published_by: author, owned } = component;
Expand Down Expand Up @@ -177,7 +175,6 @@ const ComponentMarkup = ({
error
? "cursor-not-allowed opacity-60"
: "cursor-grab hover:bg-gray-100 active:bg-gray-200",
checkIfHighlighted(component) && "bg-orange-100",
)}
draggable={!error && !isLoading}
onDragStart={onDragStart}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ type ComponentLibraryContextType = {
existingComponentLibraries: StoredLibrary[] | undefined;
searchResult: SearchResult | null;

highlightedComponentDigest: string | null;
searchComponentLibrary: (
search: string,
filters: string[],
Expand All @@ -88,14 +87,12 @@ type ComponentLibraryContextType = {
refetchLibrary: () => void;
refetchUserComponents: () => void;

setHighlightedComponentDigest: (digest: string | null) => void;
setComponentFavorite: (
component: ComponentReference,
favorited: boolean,
) => void;
checkIfUserComponent: (component: ComponentReference) => boolean;
checkLibraryContainsComponent: (component: ComponentReference) => boolean;
checkIfHighlighted: (component: ComponentReference) => boolean;

getComponentLibrary: (libraryName: AvailableComponentLibraries) => Library;
};
Expand Down Expand Up @@ -179,10 +176,6 @@ export const ComponentLibraryProvider = ({
const [userComponentsFolder, setUserComponentsFolder] =
useState<ComponentFolder>();

const [highlightedComponentDigest, setHighlightedComponentDigest] = useState<
string | null
>(null);

const [existingComponent, setExistingComponent] =
useState<UserComponent | null>(null);
const [newComponent, setNewComponent] =
Expand Down Expand Up @@ -365,13 +358,6 @@ export const ComponentLibraryProvider = ({
[componentLibrary, checkIfUserComponent],
);

const checkIfHighlighted = useCallback(
(component: ComponentReference) => {
return component.digest === highlightedComponentDigest;
},
[highlightedComponentDigest],
);

/**
* Local component library search
*/
Expand Down Expand Up @@ -602,19 +588,16 @@ export const ComponentLibraryProvider = ({
isLoading,
error,
searchResult,
highlightedComponentDigest,
existingComponentLibraries,
searchComponentLibrary,
getComponentLibrary,
addToComponentLibrary,
removeFromComponentLibrary,
refetchLibrary,
refetchUserComponents,
setHighlightedComponentDigest,
setComponentFavorite,
checkIfUserComponent,
checkLibraryContainsComponent,
checkIfHighlighted,
}),
[
componentLibrary,
Expand All @@ -624,19 +607,16 @@ export const ComponentLibraryProvider = ({
isLoading,
error,
searchResult,
highlightedComponentDigest,
existingComponentLibraries,
searchComponentLibrary,
getComponentLibrary,
addToComponentLibrary,
removeFromComponentLibrary,
refetchLibrary,
refetchUserComponents,
setHighlightedComponentDigest,
setComponentFavorite,
checkIfUserComponent,
checkLibraryContainsComponent,
checkIfHighlighted,
],
);

Expand Down
Loading