MCPcopy
hub / github.com/21st-dev/1code / ProjectIcon

Function ProjectIcon

src/renderer/components/ui/project-icon.tsx:17–38  ·  view source on GitHub ↗
({ project, className }: ProjectIconProps)

Source from the content-addressed store, hash-verified

15}
16
17export function ProjectIcon({ project, className }: ProjectIconProps) {
18 const { src, hasError } = useProjectIcon(project)
19 const [imgError, setImgError] = useState(false)
20 const handleError = useCallback(() => setImgError(true), [])
21
22 if (!project || hasError || !src || imgError) {
23 return (
24 <FolderOpen
25 className={cn("text-muted-foreground flex-shrink-0", className)}
26 />
27 )
28 }
29
30 return (
31 <img
32 src={src}
33 alt=""
34 className={cn("rounded-sm flex-shrink-0 object-cover", className)}
35 onError={handleError}
36 />
37 )
38}

Callers

nothing calls this directly

Calls 2

useProjectIconFunction · 0.90
cnFunction · 0.90

Tested by

no test coverage detected