2025-05-28 21:43:02 +01:00
|
|
|
import './index.css';
|
2025-07-01 17:42:16 +01:00
|
|
|
import React, { useEffect } from 'react';
|
2025-05-28 21:43:02 +01:00
|
|
|
import HomePage from './pages/HomePage';
|
2025-07-01 17:42:16 +01:00
|
|
|
import { BackendHealthIndicator } from './components/BackendHealthIndicator';
|
|
|
|
import { backendService } from './services/backendService';
|
2025-06-09 10:04:40 +01:00
|
|
|
|
2025-05-28 21:43:02 +01:00
|
|
|
export default function App() {
|
2025-07-01 17:42:16 +01:00
|
|
|
useEffect(() => {
|
|
|
|
// Only start backend if running in Tauri
|
|
|
|
const initializeBackend = async () => {
|
|
|
|
try {
|
|
|
|
// Check if we're running in Tauri environment
|
|
|
|
if (typeof window !== 'undefined' && window.__TAURI__) {
|
|
|
|
console.log('Running in Tauri - Starting backend on React app startup...');
|
|
|
|
await backendService.startBackend();
|
|
|
|
console.log('Backend started successfully');
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Failed to start backend on app startup:', error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
initializeBackend();
|
|
|
|
}, []);
|
2025-06-09 10:04:40 +01:00
|
|
|
return (
|
|
|
|
<div className="min-h-screen bg-gray-100">
|
2025-07-01 17:42:16 +01:00
|
|
|
<div className="bg-white shadow-sm border-b relative">
|
|
|
|
<BackendHealthIndicator className="absolute top-3 left-3 z-10" />
|
|
|
|
<div className="max-w-4xl mx-auto px-4 py-3">
|
|
|
|
<h1 className="text-xl font-bold">Stirling PDF</h1>
|
2025-06-09 10:04:40 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2025-07-01 17:42:16 +01:00
|
|
|
<HomePage />
|
2025-06-09 10:04:40 +01:00
|
|
|
</div>
|
|
|
|
);
|
2025-05-28 21:43:02 +01:00
|
|
|
}
|