The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { useQuery } from '@apollo/client/react';
import { isDefined } from 'twenty-shared/utils';
import { FindManySkillsForSuggestionDocument } from '~/generated-metadata/graphql';
// Skill references only carry an id and a label, so the icon comes from the cached catalog
export const useSkillIcon = (skillId: string | null): string | null => {
const { data } = useQuery(FindManySkillsForSuggestionDocument, {
skip: !isDefined(skillId),
fetchPolicy: 'cache-first',
});
const skill = data?.skills.find((candidate) => candidate.id === skillId);
return skill?.icon ?? null;
};