From 3bde167eddfb7cb7102f0b859b48747c7f2aeee4 Mon Sep 17 00:00:00 2001 From: CiTRuS93 Date: Mon, 9 Nov 2020 11:43:31 +0200 Subject: [PATCH 1/5] #198 adding loading spinner to protest page --- src/components/LoadingSpinner/LoadingSpinner.js | 2 +- src/views/ProtestPage.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/LoadingSpinner/LoadingSpinner.js b/src/components/LoadingSpinner/LoadingSpinner.js index c9574ba9..cbcfdd3a 100644 --- a/src/components/LoadingSpinner/LoadingSpinner.js +++ b/src/components/LoadingSpinner/LoadingSpinner.js @@ -2,7 +2,7 @@ import React from 'react'; import styled from 'styled-components/macro'; function LoadingSpinner({ imgSrc, style = {} }) { - const spinnerSrc = 'icons/loading-spinner.svg'; + const spinnerSrc = '/icons/loading-spinner.svg'; return ( {'loading'} diff --git a/src/views/ProtestPage.js b/src/views/ProtestPage.js index 8cc3b3ee..ba0b872a 100644 --- a/src/views/ProtestPage.js +++ b/src/views/ProtestPage.js @@ -29,6 +29,7 @@ import { isVisitor, sortDateTimeList, } from '../utils'; +import LoadingSpinner from '../components/LoadingSpinner/LoadingSpinner'; import { Image } from 'antd'; function getEditButtonLink(user, protest) { @@ -261,7 +262,7 @@ function ProtestPage() { // const { onFileUpload } = useFileUpload(false); if (!protest) { // TODO: loading state - return
טוען...
; + return ; } const { coordinates, id: protestId } = protest; From f6bc333085d9cc41829a3fe2246c1bb9ce8865f0 Mon Sep 17 00:00:00 2001 From: CiTRuS93 Date: Tue, 10 Nov 2020 08:58:16 +0200 Subject: [PATCH 2/5] add margin, p and short import --- src/views/ProtestPage.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/ProtestPage.js b/src/views/ProtestPage.js index ba0b872a..843e39e5 100644 --- a/src/views/ProtestPage.js +++ b/src/views/ProtestPage.js @@ -29,7 +29,7 @@ import { isVisitor, sortDateTimeList, } from '../utils'; -import LoadingSpinner from '../components/LoadingSpinner/LoadingSpinner'; +import LoadingSpinner from '../components/LoadingSpinner'; import { Image } from 'antd'; function getEditButtonLink(user, protest) { @@ -262,7 +262,12 @@ function ProtestPage() { // const { onFileUpload } = useFileUpload(false); if (!protest) { // TODO: loading state - return ; + return ( +
+

טוען ...

+ +
+ ); } const { coordinates, id: protestId } = protest; From 8e650770abf5df3180f8c3080d19ff87bb3772b5 Mon Sep 17 00:00:00 2001 From: CiTRuS93 Date: Tue, 17 Nov 2020 17:58:57 +0200 Subject: [PATCH 3/5] #127 add cancel button --- src/components/ProtestForm/ProtestForm.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/ProtestForm/ProtestForm.js b/src/components/ProtestForm/ProtestForm.js index 90dcc8fc..661c0d91 100644 --- a/src/components/ProtestForm/ProtestForm.js +++ b/src/components/ProtestForm/ProtestForm.js @@ -10,6 +10,7 @@ import { validateLatLng, isValidUrl } from '../../utils'; import { fetchNearbyProtests } from '../../api'; import L from 'leaflet'; import DateTimeList from '../DateTimeList'; +import { useHistory } from 'react-router-dom'; const protestMarker = new L.Icon({ iconUrl: '/icons/fist.svg', @@ -26,6 +27,7 @@ function ProtestForm({ editMode = null, isAdmin, }) { + let history = useHistory(); const coordinatesUpdater = useCallback(() => { let initialState = [31.7749837, 35.219797]; if (validateLatLng(initialCoords)) initialState = initialCoords; @@ -89,6 +91,9 @@ function ProtestForm({ nearbyProtests(); }, [coordinatesUpdater]); + const onCancel = () => { + history.goBack(); + }; const onSubmit = async (params) => { if (!editMode && !params.streetAddress) { alert('אנא הזינו את כתובת ההפגנה'); @@ -282,6 +287,10 @@ function ProtestForm({ )} )} +
+ ); } From 332a751148ab41f6f35b6ef5137ef6b673c634c0 Mon Sep 17 00:00:00 2001 From: CiTRuS93 Date: Wed, 18 Nov 2020 13:08:39 +0200 Subject: [PATCH 4/5] added confirm --- src/components/ProtestForm/ProtestForm.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ProtestForm/ProtestForm.js b/src/components/ProtestForm/ProtestForm.js index 8d4cdcad..9182ffa3 100644 --- a/src/components/ProtestForm/ProtestForm.js +++ b/src/components/ProtestForm/ProtestForm.js @@ -26,7 +26,7 @@ function ProtestForm({ editMode = null, isAdmin, }) { - let history = useHistory(); + const history = useHistory(); const coordinatesUpdater = useCallback(() => { let initialState = [31.7749837, 35.219797]; if (validateLatLng(initialCoords)) initialState = initialCoords; @@ -87,7 +87,9 @@ function ProtestForm({ }, [coordinatesUpdater]); const onCancel = () => { - history.goBack(); + if (window.confirm('המידע שהזנת לא יישמר. לחזור אחורה?')) { + history.goBack(); + } }; const onSubmit = async (params) => { if (!editMode && !params.streetAddress) { From 39fa6bf16b2ea1de4c188345959c78d3248499bd Mon Sep 17 00:00:00 2001 From: CiTRuS93 Date: Mon, 30 Nov 2020 12:06:52 +0200 Subject: [PATCH 5/5] change cancel button color to red --- src/components/ProtestForm/ProtestForm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ProtestForm/ProtestForm.js b/src/components/ProtestForm/ProtestForm.js index 9182ffa3..8ad355ad 100644 --- a/src/components/ProtestForm/ProtestForm.js +++ b/src/components/ProtestForm/ProtestForm.js @@ -283,7 +283,7 @@ function ProtestForm({ )}
-