Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pigchip/pwa-nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
pigchip committed Dec 1, 2024
2 parents face065 + 1f0aef8 commit 83a0ba4
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 83 deletions.
140 changes: 70 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"cookie": "^1.0.1",
"date-fns-tz": "^3.2.0",
"leaflet": "^1.9.4",
"next": "14.2.7",
"next": "^15.0.3",
"next-pwa": "^5.6.0",
"nookies": "^2.5.2",
"react": "^18",
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/lines/[lineId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { NextRequest, NextResponse } from 'next/server';

export async function GET(req: NextRequest, { params }: { params: { lineId: string } }) {
const { lineId } = params;
export async function GET(req: NextRequest, { params }: { params: Promise<{ lineId: string }> }) {
const { lineId } = await params;

try {
const line = await getLineById(lineId);
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/stations/[stationId]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { NextRequest, NextResponse } from 'next/server';

export async function GET(req: NextRequest, { params }: { params: { stationId: string } }) {
const { stationId } = params;
export async function GET(req: NextRequest, { params }: { params: Promise<{ stationId: string }> }) {
const { stationId } = await params;

try {
const station = await getStationById(stationId);
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/userByEmail/[email]/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NextResponse } from 'next/server';

export async function GET(req: Request, { params }: { params: { email: string } }) {
const { email } = params;
export async function GET(req: Request, { params }: { params: Promise<{ email: string }> }) {
const { email } = await params;

if (!email) {
return NextResponse.json(
Expand Down
17 changes: 11 additions & 6 deletions src/app/reports/details/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import { useReports } from "@/contexts/ReportsContext";
import { useRouter } from "next/navigation";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import { useRole } from "@/contexts/RoleContext";
import { useState } from "react";
import { useState, useEffect } from "react";
import { Status } from "@/types/register";
import ConfirmModal from "@/components/ConfirmModal";
import MapWithMarker from "@/components/MapWithMarker"; // Importa el componente del mapa
import { Knock } from "@knocklabs/node";
import { useLinesStations } from "@/stores/LinesStationsContext";

const EvidenceDetails: React.FC = () => {
const { selectedReport, setSelectedReport, updateReport } = useReports();
const router = useRouter();
const { role } = useRole();
const [newStatus, setNewStatus] = useState<Status | null>(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const { lines, stations, getFirstAndLastStations } = useLinesStations();

const knockApiKey = process.env.NEXT_PUBLIC_KNOCK_SECRET_API_KEY;

Expand Down Expand Up @@ -118,8 +120,11 @@ const EvidenceDetails: React.FC = () => {
return <div>Loading...</div>;
}

const { body, date, line, route, station, status, transport, time, x, y } =
selectedReport;
const { body, date, line: lineId, route, station: stationId, status, transport, time, x, y } = selectedReport;

const line = lines.find(line => line.id === lineId);
const station = stations.find(station => station.id === stationId);
const { firstStation, lastStation } = getFirstAndLastStations(lineId);

return (
<Layout>
Expand Down Expand Up @@ -147,15 +152,15 @@ const EvidenceDetails: React.FC = () => {
</div>
<div className="flex flex-col sm:flex-row justify-between">
<span className="font-semibold">Línea:</span>
<span>{line}</span>
<span>{line?.name} de {firstStation?.name} a {lastStation?.name}</span>
</div>
<div className="flex flex-col sm:flex-row justify-between">
<span className="font-semibold">Ruta:</span>
<span>{route}</span>
</div>
<div className="flex flex-col sm:flex-row justify-between">
<span className="font-semibold">Estación:</span>
<span>{station}</span>
<span>{station?.name}</span>
</div>
<div className="flex flex-col sm:flex-row justify-between">
<span className="font-semibold">Estado:</span>
Expand Down Expand Up @@ -213,4 +218,4 @@ const EvidenceDetails: React.FC = () => {
);
};

export default EvidenceDetails;
export default EvidenceDetails;

0 comments on commit 83a0ba4

Please sign in to comment.