From 25a46466b3fc6d700577c4aa30b0abd134954e87 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:39:39 +0900 Subject: [PATCH 01/14] =?UTF-8?q?[UNI-82]=20feat=20:=20=EB=B6=88=ED=8E=B8?= =?UTF-8?q?=ED=95=9C=20=EA=B8=B8=20=EC=A0=9C=EB=B3=B4=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/App.tsx | 4 +++- uniro_frontend/src/pages/reportHazard.tsx | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 uniro_frontend/src/pages/reportHazard.tsx diff --git a/uniro_frontend/src/App.tsx b/uniro_frontend/src/App.tsx index deda414..c0face0 100644 --- a/uniro_frontend/src/App.tsx +++ b/uniro_frontend/src/App.tsx @@ -8,6 +8,7 @@ import BuildingSearchPage from "./pages/buildingSearch"; import NavigationResultPage from "./pages/navigationResult"; import ReportRoutePage from "./pages/reportRoute"; import ReportForm from "./pages/reportForm"; +import ReportHazardPage from "./pages/reportHazard"; function App() { return ( @@ -19,7 +20,8 @@ function App() { } /> } /> } /> - } /> + } /> + } /> ); } diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx new file mode 100644 index 0000000..46d5245 --- /dev/null +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -0,0 +1,11 @@ +import useMap from "../hooks/useMap"; + +export default function ReportHazardPage() { + const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); + + return ( +
+
+
+ ); +} From 0073dda47e08cc95a390aa232cf3868428e31dcc Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:41:32 +0900 Subject: [PATCH 02/14] =?UTF-8?q?[UNI-82]=20feat=20:=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=20Mock=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20(=EA=B2=BD=EB=A1=9C,=20?= =?UTF-8?q?=EC=9C=84=ED=97=98=20=EC=A3=BC=EC=9D=98=20=EB=A7=88=EC=BB=A4)?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index 46d5245..15d6317 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -1,8 +1,58 @@ +import { useEffect } from "react"; import useMap from "../hooks/useMap"; +import { mockNavigationRoute } from "../data/mock/hanyangRoute"; +import createAdvancedMarker from "../utils/markers/createAdvanedMarker"; +import createMarkerElement from "../components/map/mapMarkers"; +import { RouteEdge } from "../data/types/edge"; +import { Markers } from "../constant/enum/markerEnum"; +import { mockHazardEdges } from "../data/mock/hanyangHazardEdge"; export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); + const addHazardMarker = () => { + if (AdvancedMarker === null || map === null) return; + for (const edge of mockHazardEdges) { + const { id, startNode, endNode, dangerFactors, cautionFactors } = edge; + const hazardMarker = createAdvancedMarker( + AdvancedMarker, + map, + new google.maps.LatLng({ + lat: (startNode.lat + endNode.lat) / 2, + lng: (startNode.lng + endNode.lng) / 2, + }), + createMarkerElement({ type: dangerFactors ? Markers.DANGER : Markers.CAUTION }), + ); + } + }; + + const drawRoute = (routes: RouteEdge[]) => { + if (!Polyline || !AdvancedMarker || !map) return; + + for (const route of routes) { + const coreNode = route.endNode; + + createAdvancedMarker( + AdvancedMarker, + map, + coreNode, + createMarkerElement({ type: Markers.WAYPOINT, className: "translate-waypoint" }), + ); + + const routePolyLine = new Polyline({ + map: map, + path: [route.startNode, route.endNode], + strokeColor: "#808080", + }); + } + + }; + + useEffect(() => { + drawRoute(mockNavigationRoute.route); + addHazardMarker(); + }, [map, AdvancedMarker, Polyline]) + return (
From c13cf7c7be31e0341d9782278d797f449e9017b6 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:49:06 +0900 Subject: [PATCH 03/14] =?UTF-8?q?[UNI-85]=20feat=20:=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=9E=90=20=EC=84=A0=20=ED=84=B0=EC=B9=98=20=EC=8B=9C,=20?= =?UTF-8?q?=EC=9D=B8=EC=A0=91=20=EA=B0=84=EC=84=A0=20=ED=83=90=EC=83=89=20?= =?UTF-8?q?=ED=9B=84=20=EC=A0=9C=EB=B3=B4=20=EB=A7=88=EC=BB=A4=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=A1=9C=EC=A7=81=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/assets/markers/report.svg | 20 +++++++++++++ .../src/constant/enum/markerEnum.ts | 1 + uniro_frontend/src/data/types/marker.d.ts | 3 +- uniro_frontend/src/pages/reportHazard.tsx | 30 +++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 uniro_frontend/src/assets/markers/report.svg diff --git a/uniro_frontend/src/assets/markers/report.svg b/uniro_frontend/src/assets/markers/report.svg new file mode 100644 index 0000000..6fd82e6 --- /dev/null +++ b/uniro_frontend/src/assets/markers/report.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/uniro_frontend/src/constant/enum/markerEnum.ts b/uniro_frontend/src/constant/enum/markerEnum.ts index 8fc891c..9487ca9 100644 --- a/uniro_frontend/src/constant/enum/markerEnum.ts +++ b/uniro_frontend/src/constant/enum/markerEnum.ts @@ -7,4 +7,5 @@ export const enum Markers { SELECTED_BUILDING = "selectedBuilding", WAYPOINT = "waypoint", NUMBERED_WAYPOINT = "numberedWayPoint", + REPORT = "report", } diff --git a/uniro_frontend/src/data/types/marker.d.ts b/uniro_frontend/src/data/types/marker.d.ts index 06c1bc4..7e86790 100644 --- a/uniro_frontend/src/data/types/marker.d.ts +++ b/uniro_frontend/src/data/types/marker.d.ts @@ -10,4 +10,5 @@ export type MarkerTypes = | Markers.ORIGIN | Markers.NUMBERED_WAYPOINT | Markers.WAYPOINT - | Markers.SELECTED_BUILDING; + | Markers.SELECTED_BUILDING + | Markers.REPORT; diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index 15d6317..ab654cf 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -6,6 +6,11 @@ import createMarkerElement from "../components/map/mapMarkers"; import { RouteEdge } from "../data/types/edge"; import { Markers } from "../constant/enum/markerEnum"; import { mockHazardEdges } from "../data/mock/hanyangHazardEdge"; +import { ClickEvent } from "../data/types/event"; +import createSubNodes from "../utils/polylines/createSubnodes"; +import { LatLngToLiteral } from "../utils/coordinates/coordinateTransform"; +import findNearestSubEdge from "../utils/polylines/findNearestEdge"; +import centerCoordinate from "../utils/coordinates/centerCoordinate"; export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); @@ -44,6 +49,31 @@ export default function ReportHazardPage() { path: [route.startNode, route.endNode], strokeColor: "#808080", }); + + routePolyLine.addListener("click", (e: ClickEvent) => { + const subNodes = createSubNodes(routePolyLine); + + const edges = subNodes + .map( + (node, idx) => + [node, subNodes[idx + 1]] as [google.maps.LatLngLiteral, google.maps.LatLngLiteral], + ) + .slice(0, -1); + + const point = LatLngToLiteral(e.latLng); + + const { edge: nearestEdge, point: nearestPoint } = findNearestSubEdge(edges, point); + + const newReportMarker = createAdvancedMarker( + AdvancedMarker, + map, + centerCoordinate(nearestEdge[0], nearestEdge[1]), + createMarkerElement({ + type: Markers.REPORT, + className: 'translate-routemarker' + }) + ) + }) } }; From bd2b24fe9b1cce585178703b23347080dc210895 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:49:57 +0900 Subject: [PATCH 04/14] =?UTF-8?q?[UNI-85]=20feat=20:=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=20=EB=A7=88=EC=BB=A4=20=EA=B4=80=EB=A6=AC=20State=20(reportMar?= =?UTF-8?q?ker)=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20MarkerTypesWithElement?= =?UTF-8?q?=20=EC=9E=AC=EC=82=AC=EC=9A=A9=20=ED=83=80=EC=9E=85=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98=20&=20=EC=A0=9C=EB=B3=B4=20=EB=A7=88=EC=BB=A4=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EC=83=9D=EC=84=B1=20=EB=B0=A9=EC=A7=80=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/data/types/marker.d.ts | 5 +++++ uniro_frontend/src/pages/reportHazard.tsx | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/uniro_frontend/src/data/types/marker.d.ts b/uniro_frontend/src/data/types/marker.d.ts index 7e86790..4782ede 100644 --- a/uniro_frontend/src/data/types/marker.d.ts +++ b/uniro_frontend/src/data/types/marker.d.ts @@ -12,3 +12,8 @@ export type MarkerTypes = | Markers.WAYPOINT | Markers.SELECTED_BUILDING | Markers.REPORT; + +export type MarkerTypesWithElement = { + type: MarkerTypes; + element: AdvancedMarker; +}; diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index ab654cf..765ed40 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useEffect, useState } from "react"; import useMap from "../hooks/useMap"; import { mockNavigationRoute } from "../data/mock/hanyangRoute"; import createAdvancedMarker from "../utils/markers/createAdvanedMarker"; @@ -11,9 +11,11 @@ import createSubNodes from "../utils/polylines/createSubnodes"; import { LatLngToLiteral } from "../utils/coordinates/coordinateTransform"; import findNearestSubEdge from "../utils/polylines/findNearestEdge"; import centerCoordinate from "../utils/coordinates/centerCoordinate"; +import { MarkerTypesWithElement } from "../data/types/marker"; export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); + const [reportMarker, setReportMarker] = useState(); const addHazardMarker = () => { if (AdvancedMarker === null || map === null) return; @@ -73,6 +75,18 @@ export default function ReportHazardPage() { className: 'translate-routemarker' }) ) + + setReportMarker((prevMarker) => { + if (prevMarker) { + if (prevMarker.type === Markers.REPORT) { + prevMarker.element.map = null; + } + } + return { + type: Markers.REPORT, + element: newReportMarker + } + }) }) } From bf5ee1da498256eecf72717df7c15a1b51a10888 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:54:02 +0900 Subject: [PATCH 05/14] =?UTF-8?q?[UNI-85]=20feat=20:=20=EA=B8=B0=EC=A1=B4?= =?UTF-8?q?=20=EB=A7=88=EC=BB=A4=20=EC=88=98=EC=A0=95=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EC=84=A0=ED=83=9D=20(state=20=EB=B3=80=EA=B2=BD,?= =?UTF-8?q?=20Marker=20=EC=BB=A8=ED=85=90=EC=B8=A0=20=EB=B3=80=EA=B2=BD)?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 27 ++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index 765ed40..6b99b55 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -21,6 +21,9 @@ export default function ReportHazardPage() { if (AdvancedMarker === null || map === null) return; for (const edge of mockHazardEdges) { const { id, startNode, endNode, dangerFactors, cautionFactors } = edge; + + const type = dangerFactors ? Markers.DANGER : Markers.CAUTION; + const hazardMarker = createAdvancedMarker( AdvancedMarker, map, @@ -28,7 +31,29 @@ export default function ReportHazardPage() { lat: (startNode.lat + endNode.lat) / 2, lng: (startNode.lng + endNode.lng) / 2, }), - createMarkerElement({ type: dangerFactors ? Markers.DANGER : Markers.CAUTION }), + createMarkerElement({ type }), + () => { + hazardMarker.content = createMarkerElement({ + type, + title: dangerFactors ? dangerFactors[0] : cautionFactors && cautionFactors[0], + hasTopContent: true + }) + setReportMarker((prevMarker) => { + if (prevMarker) { + if (prevMarker.type === Markers.REPORT) { + prevMarker.element.map = null; + } + else { + prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) + } + } + + return { + type, + element: hazardMarker + } + }) + } ); } }; From e0d8e5d3c093bc8ad3fa3ec9f7d82672f6801d86 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:57:17 +0900 Subject: [PATCH 06/14] =?UTF-8?q?[UNI-85]=20feat=20:=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=20=ED=84=B0=EC=B9=98=20=EC=8B=9C,=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EB=90=9C=20=EB=A7=88=EC=BB=A4=20=EC=B4=88=EA=B8=B0=ED=99=94=20?= =?UTF-8?q?(state=20=EC=B4=88=EA=B8=B0=ED=99=94,=20Marker=20=EC=BB=A8?= =?UTF-8?q?=ED=85=90=ED=8A=B8=20=EC=B4=88=EA=B8=B0=ED=99=94)=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index 6b99b55..c62d650 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -106,6 +106,9 @@ export default function ReportHazardPage() { if (prevMarker.type === Markers.REPORT) { prevMarker.element.map = null; } + else { + prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) + } } return { type: Markers.REPORT, @@ -117,9 +120,26 @@ export default function ReportHazardPage() { }; + useEffect(() => { drawRoute(mockNavigationRoute.route); addHazardMarker(); + + if (map) { + map.addListener('click', () => { + setReportMarker((prevMarker) => { + if (prevMarker) { + if (prevMarker.type === Markers.REPORT) { + prevMarker.element.map = null; + } + else { + prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) + } + } + return undefined + }) + }) + } }, [map, AdvancedMarker, Polyline]) return ( From 92a1dea416ac71261b867592b4236793a9b8cc8d Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 15:59:57 +0900 Subject: [PATCH 07/14] =?UTF-8?q?[UNI-85]=20feat=20:=20Marker=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=20=EC=A4=91=EB=B3=B5=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 33 +++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index c62d650..9d71809 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -17,6 +17,16 @@ export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); const [reportMarker, setReportMarker] = useState(); + const resetMarker = (prevMarker: MarkerTypesWithElement) => { + if (prevMarker.type === Markers.REPORT) { + prevMarker.element.map = null; + return; + } + else { + prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) + } + } + const addHazardMarker = () => { if (AdvancedMarker === null || map === null) return; for (const edge of mockHazardEdges) { @@ -40,12 +50,7 @@ export default function ReportHazardPage() { }) setReportMarker((prevMarker) => { if (prevMarker) { - if (prevMarker.type === Markers.REPORT) { - prevMarker.element.map = null; - } - else { - prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) - } + resetMarker(prevMarker); } return { @@ -103,13 +108,9 @@ export default function ReportHazardPage() { setReportMarker((prevMarker) => { if (prevMarker) { - if (prevMarker.type === Markers.REPORT) { - prevMarker.element.map = null; - } - else { - prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) - } + resetMarker(prevMarker); } + return { type: Markers.REPORT, element: newReportMarker @@ -129,13 +130,9 @@ export default function ReportHazardPage() { map.addListener('click', () => { setReportMarker((prevMarker) => { if (prevMarker) { - if (prevMarker.type === Markers.REPORT) { - prevMarker.element.map = null; - } - else { - prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) - } + resetMarker(prevMarker); } + return undefined }) }) From a0a0b899e0cb843de7a6670e14bb5df5a2a17581 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 16:02:27 +0900 Subject: [PATCH 08/14] =?UTF-8?q?[UNI-85]=20feat=20:=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EB=90=9C=20=EB=A7=88=EC=BB=A4=20=EC=A1=B4=EC=9E=AC=20=EC=8B=9C?= =?UTF-8?q?,=20=EB=B2=84=ED=8A=BC=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20Form?= =?UTF-8?q?=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index 9d71809..ebe7c6d 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -12,6 +12,8 @@ import { LatLngToLiteral } from "../utils/coordinates/coordinateTransform"; import findNearestSubEdge from "../utils/polylines/findNearestEdge"; import centerCoordinate from "../utils/coordinates/centerCoordinate"; import { MarkerTypesWithElement } from "../data/types/marker"; +import Button from "../components/customButton"; +import { Link } from "react-router"; export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); @@ -142,6 +144,13 @@ export default function ReportHazardPage() { return (
+ {reportMarker && ( +
+ + + +
+ )}
); } From 7d3d0d485e120676006d94243bcdeec205781bcd Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 16:03:29 +0900 Subject: [PATCH 09/14] =?UTF-8?q?[UNI-82]=20fix=20:=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EB=90=9C=20=EA=B2=BD=EB=A1=9C=20=EC=B4=88=EA=B8=B0=20=EB=A7=88?= =?UTF-8?q?=EC=BB=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index ebe7c6d..2598388 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -121,6 +121,12 @@ export default function ReportHazardPage() { }) } + createAdvancedMarker( + AdvancedMarker, + map, + routes[0].startNode, + createMarkerElement({ type: Markers.WAYPOINT, className: "translate-waypoint" }), + ); }; From a1dbc4eaaa8ab161bedb86627979f678b484ce39 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 16:24:18 +0900 Subject: [PATCH 10/14] =?UTF-8?q?[UNI-83]=20feat=20:=20=EC=83=81=EB=8B=A8?= =?UTF-8?q?=20=EC=95=88=EB=82=B4=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/constant/enum/messageEnum.ts | 6 +++++ uniro_frontend/src/pages/reportHazard.tsx | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 uniro_frontend/src/constant/enum/messageEnum.ts diff --git a/uniro_frontend/src/constant/enum/messageEnum.ts b/uniro_frontend/src/constant/enum/messageEnum.ts new file mode 100644 index 0000000..e8a6238 --- /dev/null +++ b/uniro_frontend/src/constant/enum/messageEnum.ts @@ -0,0 +1,6 @@ +export enum ReportHazardMessage { + DEFAULT = "선 위를 눌러 제보할 지점을 선택하세요", + NEW = "이 지점으로 새로운 제보를 진행할까요?", + UPDATE = "이 지점에 제보된 기존 정보를 바꿀까요?", + ERROR = "선 위에서만 선택 가능해요", +} diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index 2598388..f242f91 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -14,11 +14,16 @@ import centerCoordinate from "../utils/coordinates/centerCoordinate"; import { MarkerTypesWithElement } from "../data/types/marker"; import Button from "../components/customButton"; import { Link } from "react-router"; +import { ReportHazardMessage } from "../constant/enum/messageEnum"; +import { motion, AnimatePresence } from "framer-motion"; export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); const [reportMarker, setReportMarker] = useState(); + + const [message, setMessage] = useState(ReportHazardMessage.DEFAULT); + const resetMarker = (prevMarker: MarkerTypesWithElement) => { if (prevMarker.type === Markers.REPORT) { prevMarker.element.map = null; @@ -50,6 +55,7 @@ export default function ReportHazardPage() { title: dangerFactors ? dangerFactors[0] : cautionFactors && cautionFactors[0], hasTopContent: true }) + setMessage(ReportHazardMessage.UPDATE) setReportMarker((prevMarker) => { if (prevMarker) { resetMarker(prevMarker); @@ -108,6 +114,8 @@ export default function ReportHazardPage() { }) ) + setMessage(ReportHazardMessage.NEW) + setReportMarker((prevMarker) => { if (prevMarker) { resetMarker(prevMarker); @@ -138,8 +146,11 @@ export default function ReportHazardPage() { map.addListener('click', () => { setReportMarker((prevMarker) => { if (prevMarker) { + setMessage(ReportHazardMessage.DEFAULT) resetMarker(prevMarker); } + else setMessage(ReportHazardMessage.ERROR) + return undefined }) @@ -147,8 +158,23 @@ export default function ReportHazardPage() { } }, [map, AdvancedMarker, Polyline]) + useEffect(() => { + if (message === ReportHazardMessage.ERROR) { + setTimeout(() => { + setMessage(ReportHazardMessage.DEFAULT); + }, 1000) + } + }, [message]) + return (
+
+ {message} +
{reportMarker && (
From bbb837dd4a2f9ee44b0cf35d4c347bd590471c18 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 16:49:59 +0900 Subject: [PATCH 11/14] =?UTF-8?q?[UNI-85]=20feat=20:=20=EC=9C=84=ED=97=98?= =?UTF-8?q?=20=EC=A3=BC=EC=9D=98=20=EC=9A=94=EC=86=8C=20=EC=A0=9C=EB=B3=B4?= =?UTF-8?q?=20global=20State=20=EC=84=A0=EC=96=B8=20(=EC=A0=9C=EB=B3=B4=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20(=EC=83=9D=EC=84=B1,=20=EC=88=98=EC=A0=95)?= =?UTF-8?q?,=20=EA=B0=84=EC=84=A0=20=EC=8B=9C=EC=9E=91=20=EB=85=B8?= =?UTF-8?q?=EB=93=9C,=20=EB=81=9D=20=EB=85=B8=EB=93=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/hooks/useReportHazard.ts | 22 ++++++++++++++++++ uniro_frontend/src/pages/reportForm.tsx | 6 +++++ uniro_frontend/src/pages/reportHazard.tsx | 25 +++++++++++++++++---- 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 uniro_frontend/src/hooks/useReportHazard.ts diff --git a/uniro_frontend/src/hooks/useReportHazard.ts b/uniro_frontend/src/hooks/useReportHazard.ts new file mode 100644 index 0000000..79aea93 --- /dev/null +++ b/uniro_frontend/src/hooks/useReportHazard.ts @@ -0,0 +1,22 @@ +import { create } from "zustand"; + +interface ReportedHazardEdge { + reportType: "CREATE" | "UPDATE" | undefined; + setReportType: (type: "CREATE" | "UPDATE") => void; + startNode: google.maps.LatLng | google.maps.LatLngLiteral | undefined; + endNode: google.maps.LatLng | google.maps.LatLngLiteral | undefined; + setNode: ( + point1: google.maps.LatLng | google.maps.LatLngLiteral, + point2: google.maps.LatLng | google.maps.LatLngLiteral, + ) => void; +} + +const useReportHazard = create((set) => ({ + reportType: undefined, + setReportType: (newType) => set(() => ({ reportType: newType })), + startNode: undefined, + endNode: undefined, + setNode: (point1, point2) => set(() => ({ startNode: point1, endNode: point2 })), +})); + +export default useReportHazard; diff --git a/uniro_frontend/src/pages/reportForm.tsx b/uniro_frontend/src/pages/reportForm.tsx index 436c444..be6d43c 100644 --- a/uniro_frontend/src/pages/reportForm.tsx +++ b/uniro_frontend/src/pages/reportForm.tsx @@ -11,6 +11,7 @@ import Button from "../components/customButton"; import useScrollControl from "../hooks/useScrollControl"; import useModal from "../hooks/useModal"; +import useReportHazard from "../hooks/useReportHazard"; const ReportForm = () => { useScrollControl(); @@ -28,7 +29,12 @@ const ReportForm = () => { const [FailModal, isFailOpen, openFail, closeFail] = useModal(); const [SuccessModal, isSuccessOpen, openSuccess, closeSuccess] = useModal(); + const { reportType, startNode, endNode } = useReportHazard() + useEffect(() => { + + console.log(reportType, startNode, endNode); + setTimeout(() => { setReportMode("update"); }, 2000); diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index f242f91..d4738a1 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -16,10 +16,16 @@ import Button from "../components/customButton"; import { Link } from "react-router"; import { ReportHazardMessage } from "../constant/enum/messageEnum"; import { motion, AnimatePresence } from "framer-motion"; +import useReportHazard from "../hooks/useReportHazard"; + +interface reportMarkerTypes extends MarkerTypesWithElement { + edge: [google.maps.LatLng | google.maps.LatLngLiteral, google.maps.LatLng | google.maps.LatLngLiteral] +} export default function ReportHazardPage() { const { map, mapRef, AdvancedMarker, Polyline } = useMap({ zoom: 18, minZoom: 17 }); - const [reportMarker, setReportMarker] = useState(); + const [reportMarker, setReportMarker] = useState(); + const { setReportType, setNode } = useReportHazard(); const [message, setMessage] = useState(ReportHazardMessage.DEFAULT); @@ -63,7 +69,8 @@ export default function ReportHazardPage() { return { type, - element: hazardMarker + element: hazardMarker, + edge: [startNode, endNode] } }) } @@ -123,7 +130,8 @@ export default function ReportHazardPage() { return { type: Markers.REPORT, - element: newReportMarker + element: newReportMarker, + edge: nearestEdge } }) }) @@ -137,6 +145,13 @@ export default function ReportHazardPage() { ); }; + const reportHazard = () => { + if (!reportMarker) return; + + setReportType(reportMarker.type === Markers.REPORT ? "CREATE" : "UPDATE"); + + setNode(...reportMarker.edge) + } useEffect(() => { drawRoute(mockNavigationRoute.route); @@ -166,6 +181,8 @@ export default function ReportHazardPage() { } }, [message]) + + return (
@@ -178,7 +195,7 @@ export default function ReportHazardPage() {
{reportMarker && (
- +
From addf28f5f96b551a58a9c2e27be0e9c640bb752e Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 16:57:30 +0900 Subject: [PATCH 12/14] =?UTF-8?q?[UNI-83]=20feat=20:=20=EC=A0=9C=EB=B3=B4?= =?UTF-8?q?=20=EB=A7=88=EC=BB=A4=20=EC=83=9D=EC=84=B1=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98,=20CTA=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniro_frontend/src/pages/reportHazard.tsx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index d4738a1..fc765ad 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -15,8 +15,9 @@ import { MarkerTypesWithElement } from "../data/types/marker"; import Button from "../components/customButton"; import { Link } from "react-router"; import { ReportHazardMessage } from "../constant/enum/messageEnum"; -import { motion, AnimatePresence } from "framer-motion"; +import { motion } from "framer-motion"; import useReportHazard from "../hooks/useReportHazard"; +import AnimatedContainer from "../container/animatedContainer"; interface reportMarkerTypes extends MarkerTypesWithElement { edge: [google.maps.LatLng | google.maps.LatLngLiteral, google.maps.LatLng | google.maps.LatLngLiteral] @@ -117,7 +118,8 @@ export default function ReportHazardPage() { centerCoordinate(nearestEdge[0], nearestEdge[1]), createMarkerElement({ type: Markers.REPORT, - className: 'translate-routemarker' + className: 'translate-routemarker', + hasAnimation: true, }) ) @@ -193,13 +195,16 @@ export default function ReportHazardPage() { className="text-gray-100 text-kor-body2 font-medium text-center">{message}
- {reportMarker && ( -
- - - -
- )} + + + + +
); } From aeaf58266afcc12a732d6b10b069ec9b3a3fae20 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 17:05:17 +0900 Subject: [PATCH 13/14] =?UTF-8?q?[UNI-19]=20feat=20:=20=EB=A9=94=EC=84=B8?= =?UTF-8?q?=EC=A7=80=20Enum=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20Lint=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/constant/enum/messageEnum.ts | 2 +- uniro_frontend/src/pages/reportForm.tsx | 3 +- uniro_frontend/src/pages/reportHazard.tsx | 73 +++++++++---------- 3 files changed, 37 insertions(+), 41 deletions(-) diff --git a/uniro_frontend/src/constant/enum/messageEnum.ts b/uniro_frontend/src/constant/enum/messageEnum.ts index e8a6238..e591b49 100644 --- a/uniro_frontend/src/constant/enum/messageEnum.ts +++ b/uniro_frontend/src/constant/enum/messageEnum.ts @@ -1,6 +1,6 @@ export enum ReportHazardMessage { DEFAULT = "선 위를 눌러 제보할 지점을 선택하세요", - NEW = "이 지점으로 새로운 제보를 진행할까요?", + CREATE = "이 지점으로 새로운 제보를 진행할까요?", UPDATE = "이 지점에 제보된 기존 정보를 바꿀까요?", ERROR = "선 위에서만 선택 가능해요", } diff --git a/uniro_frontend/src/pages/reportForm.tsx b/uniro_frontend/src/pages/reportForm.tsx index be6d43c..2e6e856 100644 --- a/uniro_frontend/src/pages/reportForm.tsx +++ b/uniro_frontend/src/pages/reportForm.tsx @@ -29,10 +29,9 @@ const ReportForm = () => { const [FailModal, isFailOpen, openFail, closeFail] = useModal(); const [SuccessModal, isSuccessOpen, openSuccess, closeSuccess] = useModal(); - const { reportType, startNode, endNode } = useReportHazard() + const { reportType, startNode, endNode } = useReportHazard(); useEffect(() => { - console.log(reportType, startNode, endNode); setTimeout(() => { diff --git a/uniro_frontend/src/pages/reportHazard.tsx b/uniro_frontend/src/pages/reportHazard.tsx index fc765ad..6e7adc0 100644 --- a/uniro_frontend/src/pages/reportHazard.tsx +++ b/uniro_frontend/src/pages/reportHazard.tsx @@ -20,7 +20,7 @@ import useReportHazard from "../hooks/useReportHazard"; import AnimatedContainer from "../container/animatedContainer"; interface reportMarkerTypes extends MarkerTypesWithElement { - edge: [google.maps.LatLng | google.maps.LatLngLiteral, google.maps.LatLng | google.maps.LatLngLiteral] + edge: [google.maps.LatLng | google.maps.LatLngLiteral, google.maps.LatLng | google.maps.LatLngLiteral]; } export default function ReportHazardPage() { @@ -28,18 +28,16 @@ export default function ReportHazardPage() { const [reportMarker, setReportMarker] = useState(); const { setReportType, setNode } = useReportHazard(); - const [message, setMessage] = useState(ReportHazardMessage.DEFAULT); const resetMarker = (prevMarker: MarkerTypesWithElement) => { if (prevMarker.type === Markers.REPORT) { prevMarker.element.map = null; return; + } else { + prevMarker.element.content = createMarkerElement({ type: prevMarker.type }); } - else { - prevMarker.element.content = createMarkerElement({ type: prevMarker.type }) - } - } + }; const addHazardMarker = () => { if (AdvancedMarker === null || map === null) return; @@ -60,9 +58,9 @@ export default function ReportHazardPage() { hazardMarker.content = createMarkerElement({ type, title: dangerFactors ? dangerFactors[0] : cautionFactors && cautionFactors[0], - hasTopContent: true - }) - setMessage(ReportHazardMessage.UPDATE) + hasTopContent: true, + }); + setMessage(ReportHazardMessage.UPDATE); setReportMarker((prevMarker) => { if (prevMarker) { resetMarker(prevMarker); @@ -71,10 +69,10 @@ export default function ReportHazardPage() { return { type, element: hazardMarker, - edge: [startNode, endNode] - } - }) - } + edge: [startNode, endNode], + }; + }); + }, ); } }; @@ -118,12 +116,12 @@ export default function ReportHazardPage() { centerCoordinate(nearestEdge[0], nearestEdge[1]), createMarkerElement({ type: Markers.REPORT, - className: 'translate-routemarker', + className: "translate-routemarker", hasAnimation: true, - }) - ) + }), + ); - setMessage(ReportHazardMessage.NEW) + setMessage(ReportHazardMessage.CREATE); setReportMarker((prevMarker) => { if (prevMarker) { @@ -133,10 +131,10 @@ export default function ReportHazardPage() { return { type: Markers.REPORT, element: newReportMarker, - edge: nearestEdge - } - }) - }) + edge: nearestEdge, + }; + }); + }); } createAdvancedMarker( @@ -152,38 +150,34 @@ export default function ReportHazardPage() { setReportType(reportMarker.type === Markers.REPORT ? "CREATE" : "UPDATE"); - setNode(...reportMarker.edge) - } + setNode(...reportMarker.edge); + }; useEffect(() => { drawRoute(mockNavigationRoute.route); addHazardMarker(); if (map) { - map.addListener('click', () => { + map.addListener("click", () => { setReportMarker((prevMarker) => { if (prevMarker) { - setMessage(ReportHazardMessage.DEFAULT) + setMessage(ReportHazardMessage.DEFAULT); resetMarker(prevMarker); - } - else setMessage(ReportHazardMessage.ERROR) - + } else setMessage(ReportHazardMessage.ERROR); - return undefined - }) - }) + return undefined; + }); + }); } - }, [map, AdvancedMarker, Polyline]) + }, [map, AdvancedMarker, Polyline]); useEffect(() => { if (message === ReportHazardMessage.ERROR) { setTimeout(() => { setMessage(ReportHazardMessage.DEFAULT); - }, 1000) + }, 1000); } - }, [message]) - - + }, [message]); return (
@@ -192,7 +186,10 @@ export default function ReportHazardPage() { initial={{ x: 0 }} animate={message === ReportHazardMessage.ERROR ? { x: [0, 5, -5, 2.5, -2.5, 0] } : { x: 0 }} transition={{ duration: 0.5, ease: "easeOut" }} - className="text-gray-100 text-kor-body2 font-medium text-center">{message} + className="text-gray-100 text-kor-body2 font-medium text-center" + > + {message} +
- + From b2c8c2195a0ba42e0aba913c9d9ba5d541453393 Mon Sep 17 00:00:00 2001 From: dgfh0450 Date: Mon, 3 Feb 2025 17:12:43 +0900 Subject: [PATCH 14/14] =?UTF-8?q?[UNI-101]=20chore=20:=20Backoffice=20depl?= =?UTF-8?q?oy=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/fe-deploy.yml | 104 ++++++++++++++++---------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/.github/workflows/fe-deploy.yml b/.github/workflows/fe-deploy.yml index 86395ac..17836b4 100644 --- a/.github/workflows/fe-deploy.yml +++ b/.github/workflows/fe-deploy.yml @@ -1,66 +1,66 @@ name: FE CI / CD on: - push: - branches: - - fe + push: + branches: + - fe jobs: - CI: - runs-on: ubuntu-latest + CI: + runs-on: ubuntu-latest - env: - GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} - IMAGE_NAME: uniro-fe - IMAGE_TAG: ${{ github.sha }} + env: + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + IMAGE_NAME: uniro-fe + IMAGE_TAG: ${{ github.sha }} - steps: - - name: 코드 체크아웃 - uses: actions/checkout@v4 + steps: + - name: 코드 체크아웃 + uses: actions/checkout@v4 - - name: Google Cloud SDK 설정 - uses: "google-github-actions/auth@v2" - with: - credentials_json: ${{ secrets.GCP_SA_KEY }} + - name: Google Cloud SDK 설정 + uses: "google-github-actions/auth@v2" + with: + credentials_json: ${{ secrets.GCP_SA_KEY }} - - name: Docker를 위한 gcloud 인증 설정 - run: gcloud auth configure-docker --quiet + - name: Docker를 위한 gcloud 인증 설정 + run: gcloud auth configure-docker --quiet - - name: Create .env from secret - run: | - echo "${{ secrets.FE_ENV }}" > uniro_frontend/.env + - name: Create .env from secret + run: | + echo "${{ secrets.FE_ENV }}" > uniro_frontend/.env - - name: Docker 이미지 빌드 및 푸시 - run: | - docker build -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f uniro_frontend/Dockerfile . - docker push gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} + - name: Docker 이미지 빌드 및 푸시 + run: | + docker build -t gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} -f uniro_frontend/Dockerfile . + docker push gcr.io/${{ env.GCP_PROJECT_ID }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} - CD: - runs-on: ubuntu-latest - needs: CI + CD: + runs-on: ubuntu-latest + needs: CI - env: - GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} - IMAGE_NAME: uniro-fe - IMAGE_TAG: ${{ github.sha }} - DEPLOY_PATH: ${{ secrets.DEPLOY_SERVER_PATH }} + env: + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + IMAGE_NAME: uniro-fe + IMAGE_TAG: ${{ github.sha }} + DEPLOY_PATH: ${{ secrets.DEPLOY_SERVER_PATH }} - steps: - - name: 배포 서버에 SSH로 연결하여 배포 - uses: appleboy/ssh-action@v0.1.5 - with: - host: ${{ secrets.DEPLOY_SERVER_HOST }} - username: ${{ secrets.DEPLOY_SERVER_USER }} - key: ${{ secrets.DEPLOY_SSH_KEY }} - envs: GCP_PROJECT_ID, IMAGE_NAME, IMAGE_TAG, DEPLOY_PATH, TEST - script: | - cd ${DEPLOY_PATH} - sudo docker ps -a --format '{{.ID}} {{.Names}}' \ - | grep -v 'nginx-container' \ - | awk '{print $1}' \ - | xargs -r sudo docker stop || true - sudo docker rm $(sudo docker ps -a -q) || true - sudo docker login -u _json_key --password-stdin https://gcr.io <<< '${{ secrets.GCP_SA_KEY }}' - sudo docker pull gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} - sudo docker run -d --name ${IMAGE_NAME} -p 3000:3000 gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} - sudo docker network connect nginx_app-network ${IMAGE_NAME} + steps: + - name: 배포 서버에 SSH로 연결하여 배포 + uses: appleboy/ssh-action@v0.1.5 + with: + host: ${{ secrets.DEPLOY_SERVER_HOST }} + username: ${{ secrets.DEPLOY_SERVER_USER }} + key: ${{ secrets.DEPLOY_SSH_KEY }} + envs: GCP_PROJECT_ID, IMAGE_NAME, IMAGE_TAG, DEPLOY_PATH, TEST + script: | + cd ${DEPLOY_PATH} + sudo docker ps -a --format '{{.ID}} {{.Names}}' \ + | egrep -v 'nginx-container|uniro-backoffice' \ + | awk '{print $1}' \ + | xargs -r sudo docker stop || true + sudo docker rm $(sudo docker ps -a -q) || true + sudo docker login -u _json_key --password-stdin https://gcr.io <<< '${{ secrets.GCP_SA_KEY }}' + sudo docker pull gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} + sudo docker run -d --name ${IMAGE_NAME} -p 3000:3000 gcr.io/${GCP_PROJECT_ID}/${IMAGE_NAME}:${IMAGE_TAG} + sudo docker network connect nginx_app-network ${IMAGE_NAME}