aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/app/components/NavBar.tsx7
-rw-r--r--src/frontend/app/components/StopGalleryItem.tsx2
-rw-r--r--src/frontend/app/root.tsx14
-rw-r--r--src/frontend/app/routes.tsx3
-rw-r--r--src/frontend/app/routes/home.css (renamed from src/frontend/app/routes/stoplist.css)0
-rw-r--r--src/frontend/app/routes/home.tsx (renamed from src/frontend/app/routes/stoplist.tsx)3
-rw-r--r--src/frontend/app/routes/index.tsx5
-rw-r--r--src/frontend/app/routes/settings.tsx2
-rw-r--r--src/frontend/public/manifest.webmanifest6
9 files changed, 14 insertions, 28 deletions
diff --git a/src/frontend/app/components/NavBar.tsx b/src/frontend/app/components/NavBar.tsx
index 6a06e63..bb73d58 100644
--- a/src/frontend/app/components/NavBar.tsx
+++ b/src/frontend/app/components/NavBar.tsx
@@ -27,7 +27,8 @@ export default function NavBar() {
{
name: t("navbar.stops", "Paradas"),
icon: MapPin,
- path: "/stops",
+ path: "/",
+ exact: true
},
{
name: t("navbar.map", "Mapa"),
@@ -65,7 +66,9 @@ export default function NavBar() {
<nav className="navigation-bar">
{navItems.map((item) => {
const Icon = item.icon;
- const isActive = location.pathname.startsWith(item.path);
+ const isActive = item.exact ?
+ location.pathname === item.path :
+ location.pathname.startsWith(item.path);
return (
<Link
diff --git a/src/frontend/app/components/StopGalleryItem.tsx b/src/frontend/app/components/StopGalleryItem.tsx
index 0af14bc..b32661a 100644
--- a/src/frontend/app/components/StopGalleryItem.tsx
+++ b/src/frontend/app/components/StopGalleryItem.tsx
@@ -23,7 +23,7 @@ const StopGalleryItem: React.FC<StopGalleryItemProps> = ({ stop }) => {
{StopDataProvider.getDisplayName(region, stop)}
</div>
<div className="gallery-item-lines">
- {stop.lines?.slice(0, 6).map((line) => (
+ {stop.lines?.slice(0, 5).map((line) => (
<LineIcon key={line} line={line} region={region} />
))}
{stop.lines && stop.lines.length > 5 && (
diff --git a/src/frontend/app/root.tsx b/src/frontend/app/root.tsx
index 6bb3da6..5891097 100644
--- a/src/frontend/app/root.tsx
+++ b/src/frontend/app/root.tsx
@@ -16,7 +16,7 @@ import "./root.css";
import "maplibre-theme/icons.default.css";
import "maplibre-theme/modern.css";
import { Protocol } from "pmtiles";
-import maplibregl, { type LngLatLike } from "maplibre-gl";
+import maplibregl from "maplibre-gl";
import { AppProvider } from "./AppContext";
const pmtiles = new Protocol();
maplibregl.addProtocol("pmtiles", pmtiles.tile);
@@ -76,18 +76,6 @@ export function Layout({ children }: { children: React.ReactNode }) {
<title>Busurbano</title>
<Meta />
- {/* Set theme early to avoid flash of wrong theme (especially skeletons) */}
- <script
- dangerouslySetInnerHTML={{
- __html: `(() => { try {
- var saved = localStorage.getItem('theme');
- var system = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light';
- var resolved = (saved === 'light' || saved === 'dark') ? saved : system;
- document.documentElement.setAttribute('data-theme', resolved);
- document.documentElement.style.colorScheme = resolved;
- } catch (e) {} })();`,
- }}
- />
<Links />
</head>
<body>
diff --git a/src/frontend/app/routes.tsx b/src/frontend/app/routes.tsx
index 189949f..7d81b5f 100644
--- a/src/frontend/app/routes.tsx
+++ b/src/frontend/app/routes.tsx
@@ -1,8 +1,7 @@
import { type RouteConfig, index, route } from "@react-router/dev/routes";
export default [
- index("routes/index.tsx"),
- route("/stops", "routes/stoplist.tsx"),
+ index("routes/home.tsx"),
route("/map", "routes/map.tsx"),
route("/estimates/:id", "routes/estimates-$id.tsx"),
route("/timetable/:id", "routes/timetable-$id.tsx"),
diff --git a/src/frontend/app/routes/stoplist.css b/src/frontend/app/routes/home.css
index 253c0ab..253c0ab 100644
--- a/src/frontend/app/routes/stoplist.css
+++ b/src/frontend/app/routes/home.css
diff --git a/src/frontend/app/routes/stoplist.tsx b/src/frontend/app/routes/home.tsx
index a98b2b4..88c774b 100644
--- a/src/frontend/app/routes/stoplist.tsx
+++ b/src/frontend/app/routes/home.tsx
@@ -1,3 +1,4 @@
+"use client";
import { useEffect, useMemo, useRef, useState, useCallback } from "react";
import StopDataProvider, { type Stop } from "../data/StopDataProvider";
import StopItem from "../components/StopItem";
@@ -5,7 +6,7 @@ import StopItemSkeleton from "../components/StopItemSkeleton";
import StopGallery from "../components/StopGallery";
import ServiceAlerts from "../components/ServiceAlerts";
import Fuse from "fuse.js";
-import "./stoplist.css";
+import "./home.css";
import { useTranslation } from "react-i18next";
import { useApp } from "../AppContext";
import { REGIONS } from "~/data/RegionConfig";
diff --git a/src/frontend/app/routes/index.tsx b/src/frontend/app/routes/index.tsx
deleted file mode 100644
index 252abec..0000000
--- a/src/frontend/app/routes/index.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { Navigate, redirect, type LoaderFunction } from "react-router";
-
-export default function Index() {
- return <Navigate to={"/stops"} replace />;
-}
diff --git a/src/frontend/app/routes/settings.tsx b/src/frontend/app/routes/settings.tsx
index d9efa2e..d687fab 100644
--- a/src/frontend/app/routes/settings.tsx
+++ b/src/frontend/app/routes/settings.tsx
@@ -35,7 +35,7 @@ export default function Settings() {
setRegion(pendingRegion as any);
setShowModal(false);
setPendingRegion(null);
- navigate("/stops");
+ navigate("/");
}
};
diff --git a/src/frontend/public/manifest.webmanifest b/src/frontend/public/manifest.webmanifest
index e685a23..161835c 100644
--- a/src/frontend/public/manifest.webmanifest
+++ b/src/frontend/public/manifest.webmanifest
@@ -4,13 +4,13 @@
"name": "BusUrbano",
"description": "Aplicación web para encontrar paradas y tiempos de llegada de los autobuses urbanos.",
"short_name": "BusUrbano",
- "start_url": "/stops",
- "display": "standalone",
+ "start_url": "/",
+ "display": "fullscreen",
"orientation": "portrait-primary",
"lang": "es",
"background_color": "#ffffff",
"theme_color": "#007bff",
- "categories": ["travel", "utilities", "productivity"],
+ "categories": ["productivity"],
"prefer_related_applications": false,
"icons": [
{