aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/root.tsx
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2025-09-07 17:29:53 +0200
committerAriel Costas Guerrero <ariel@costas.dev>2025-09-07 17:29:53 +0200
commit8182a08f60e88595984ba80b472f29ccf53c19bd (patch)
treec377ad8a7d43b8794b5df0f7283f71ac24408210 /src/frontend/app/root.tsx
parent577a6f00a0f006ca51276ae606835c2d892da872 (diff)
feat: Enhance development scripts and add Angular support
- Added new scripts for Angular development and formatting in package.json. - Updated workspaces to include Angular frontend. - Modified backend project file to exclude specific views from content inclusion. - Updated logging settings in appsettings.json to include HttpClient warnings. - Refactored TimetableTable component for cleaner rendering. - Removed UpdateNotification component and related service worker management code. - Simplified service worker registration in root component. - Cleaned up settings page by removing update management functionality. - Improved stoplist component structure for better readability. - Updated PWA worker to streamline caching and response handling.
Diffstat (limited to 'src/frontend/app/root.tsx')
-rw-r--r--src/frontend/app/root.tsx32
1 files changed, 8 insertions, 24 deletions
diff --git a/src/frontend/app/root.tsx b/src/frontend/app/root.tsx
index 040494f..25a873f 100644
--- a/src/frontend/app/root.tsx
+++ b/src/frontend/app/root.tsx
@@ -18,9 +18,6 @@ import "maplibre-theme/modern.css";
import { Protocol } from "pmtiles";
import maplibregl, { type LngLatLike } from "maplibre-gl";
import { AppProvider } from "./AppContext";
-import { swManager } from "./utils/serviceWorkerManager";
-import { UpdateNotification } from "./components/UpdateNotification";
-import { useEffect } from "react";
const pmtiles = new Protocol();
maplibregl.addProtocol("pmtiles", pmtiles.tile);
//#endregion
@@ -30,7 +27,7 @@ import "./i18n";
export const links: Route.LinksFunction = () => [];
export function HydrateFallback() {
- return "Loading...";
+ return "Cargando...";
}
export function Layout({ children }: { children: React.ReactNode }) {
@@ -90,32 +87,19 @@ export function Layout({ children }: { children: React.ReactNode }) {
);
}
-// Helper: check if coordinates are within Vigo bounds
-function isWithinVigo(lngLat: LngLatLike): boolean {
- let lng: number, lat: number;
- if (Array.isArray(lngLat)) {
- [lng, lat] = lngLat;
- } else if ("lng" in lngLat && "lat" in lngLat) {
- lng = lngLat.lng;
- lat = lngLat.lat;
- } else {
- return false;
- }
- // Rough bounding box for Vigo
- return lat >= 42.18 && lat <= 42.3 && lng >= -8.78 && lng <= -8.65;
-}
-
import NavBar from "./components/NavBar";
export default function App() {
- useEffect(() => {
- // Initialize service worker
- swManager.initialize();
- }, []);
+ if ('serviceWorker' in navigator) {
+ navigator.serviceWorker
+ .register('/pwa-worker.js')
+ .catch((error) => {
+ console.error('Error registering SW:', error);
+ });
+ }
return (
<AppProvider>
- <UpdateNotification />
<main className="main-content">
<Outlet />
</main>