MCPcopy Create free account
hub / github.com/AsyncFuncAI/deepwiki-open / ProcessedProjects

Function ProcessedProjects

src/components/ProcessedProjects.tsx:25–270  ·  view source on GitHub ↗
({ 
  showHeader = true, 
  maxItems, 
  className = "",
  messages 
}: ProcessedProjectsProps)

Source from the content-addressed store, hash-verified

23}
24
25export default function ProcessedProjects({
26 showHeader = true,
27 maxItems,
28 className = "",
29 messages
30}: ProcessedProjectsProps) {
31 const [projects, setProjects] = useState<ProcessedProject[]>([]);
32 const [isLoading, setIsLoading] = useState(true);
33 const [error, setError] = useState<string | null>(null);
34 const [searchQuery, setSearchQuery] = useState('');
35 const [viewMode, setViewMode] = useState<'card' | 'list'>('card');
36
37 // Default messages fallback
38 const defaultMessages = {
39 title: 'Processed Wiki Projects',
40 searchPlaceholder: 'Search projects by name, owner, or repository...',
41 noProjects: 'No projects found in the server cache. The cache might be empty or the server encountered an issue.',
42 noSearchResults: 'No projects match your search criteria.',
43 processedOn: 'Processed on:',
44 loadingProjects: 'Loading projects...',
45 errorLoading: 'Error loading projects:',
46 backToHome: 'Back to Home'
47 };
48
49 const t = (key: string) => {
50 if (messages?.projects?.[key]) {
51 return messages.projects[key];
52 }
53 return defaultMessages[key as keyof typeof defaultMessages] || key;
54 };
55
56 useEffect(() => {
57 const fetchProjects = async () => {
58 setIsLoading(true);
59 setError(null);
60 try {
61 const response = await fetch('/api/wiki/projects');
62 if (!response.ok) {
63 throw new Error(`Failed to fetch projects: ${response.statusText}`);
64 }
65 const data = await response.json();
66 if (data.error) {
67 throw new Error(data.error);
68 }
69 setProjects(data as ProcessedProject[]);
70 } catch (e: unknown) {
71 console.error("Failed to load projects from API:", e);
72 const message = e instanceof Error ? e.message : "An unknown error occurred.";
73 setError(message);
74 setProjects([]);
75 } finally {
76 setIsLoading(false);
77 }
78 };
79
80 fetchProjects();
81 }, []);
82

Callers

nothing calls this directly

Calls 4

handleDeleteFunction · 0.85
filterMethod · 0.80
fetchProjectsFunction · 0.70
tFunction · 0.70

Tested by

no test coverage detected