Files
Condopay/App.tsx
frakarr 5311400615 feat: Add tickets module and PayPal integration
Introduces a new 'Tickets' module for users to submit and manage issues within their condominium. This includes defining ticket types, statuses, priorities, and categories.

Additionally, this commit integrates PayPal as a payment option for family fee payments, enabling users to pay directly via PayPal using their client ID.

Key changes:
- Added `Ticket` related types and enums.
- Implemented `TicketService` functions for CRUD operations.
- Integrated `@paypal/react-paypal-js` library.
- Added `paypalClientId` to `AppSettings` and `Condo` types.
- Updated `FamilyDetail` page to include PayPal payment option.
- Added 'Segnalazioni' navigation link to `Layout`.
2025-12-07 19:49:59 +01:00

46 lines
1.4 KiB
TypeScript

import React from 'react';
import { HashRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom';
import { Layout } from './components/Layout';
import { FamilyList } from './pages/FamilyList';
import { FamilyDetail } from './pages/FamilyDetail';
import { SettingsPage } from './pages/Settings';
import { TicketsPage } from './pages/Tickets';
import { LoginPage } from './pages/Login';
import { CondoService } from './services/mockDb';
const ProtectedRoute = ({ children }: { children?: React.ReactNode }) => {
const user = CondoService.getCurrentUser();
const location = useLocation();
if (!user) {
return <Navigate to="/login" state={{ from: location }} replace />;
}
return <>{children}</>;
};
const App: React.FC = () => {
return (
<HashRouter>
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route path="/" element={
<ProtectedRoute>
<Layout />
</ProtectedRoute>
}>
<Route index element={<FamilyList />} />
<Route path="family/:id" element={<FamilyDetail />} />
<Route path="tickets" element={<TicketsPage />} />
<Route path="settings" element={<SettingsPage />} />
</Route>
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
</HashRouter>
);
};
export default App;