MCPcopy Create free account
hub / github.com/ScrapeGraphAI/scrapecraft / App

Function App

frontend/src/App.tsx:13–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11import 'prismjs/themes/prism-tomorrow.css';
12
13function App() {
14 const { currentPipeline, createPipeline, fetchPipelines, isLoading } = usePipelineStore();
15 const [isInitializing, setIsInitializing] = useState(true);
16
17 useEffect(() => {
18 // Initialize PrismJS
19 Prism.highlightAll();
20
21 // Auto-create a pipeline on first load
22 const initializePipeline = async () => {
23 await fetchPipelines();
24
25 // If no current pipeline, create one automatically
26 if (!currentPipeline) {
27 await createPipeline({
28 name: 'My Scraping Pipeline',
29 description: 'Ready to scrape the web!'
30 });
31 }
32
33 // Small delay to ensure smooth loading experience
34 setTimeout(() => {
35 setIsInitializing(false);
36 }, 500);
37 };
38
39 initializePipeline();
40 }, []); // eslint-disable-line react-hooks/exhaustive-deps
41
42 // Initialize WebSocket connection
43 useWebSocket(currentPipeline?.id || 'default');
44
45 // Show loading screen during initialization
46 if (isInitializing || (isLoading && !currentPipeline)) {
47 return <LoadingScreen />;
48 }
49
50 return (
51 <div className="h-screen flex flex-col bg-background text-foreground">
52 <Header />
53 <div className="flex-1 overflow-hidden">
54 <SplitView />
55 </div>
56 <StatusBar />
57 <ApprovalManager />
58 </div>
59 );
60}
61
62export default App;

Callers

nothing calls this directly

Calls 2

useWebSocketFunction · 0.90
initializePipelineFunction · 0.85

Tested by

no test coverage detected