diff --git a/frontend/src/components/banner/index.js b/frontend/src/components/banner/index.js index 25671edad5..5a6a89a452 100644 --- a/frontend/src/components/banner/index.js +++ b/frontend/src/components/banner/index.js @@ -11,10 +11,10 @@ export function Banner() { if (!localStorage.getItem('optout-closed')) { form.style.display = 'grid'; } - document.getElementById('optout-agree').onclick = function() { + document.getElementById('optout-agree').onclick = function () { setAgree(); }; - document.getElementById('optout-disagree').onclick = function() { + document.getElementById('optout-disagree').onclick = function () { setDisagree(); }; } @@ -83,7 +83,7 @@ export function DonationBanner() { if (!localStorage.getItem('donation-closed')) { form.style.display = 'grid'; } - document.getElementById('donation-close').onclick = function() { + document.getElementById('donation-close').onclick = function () { closeForm(); }; } @@ -107,12 +107,10 @@ export function DonationBanner() { target="_blank" rel="noopener noreferrer" > - 2021 HOT Summit + 2021 HOT Summit

-

- Join the virtual HOT Summit 2021 on November 22! All are invited; RSVP for free. -

+

Join the virtual HOT Summit 2021 on November 22! All are invited; RSVP for free.

Close @@ -130,10 +128,12 @@ export function ArchivalNotificationBanner() { if (!localStorage.getItem('archival-notification-closed')) { form.style.display = 'grid'; } - document.getElementById('archival-notification-learnmore').onclick = function() { - openWikiLink('/Humanitarian_OSM_Team/Working_groups/Data_Quality_Control_and_Assurance/Tasking_Manager_Project_Gardening'); + document.getElementById('archival-notification-learnmore').onclick = function () { + openWikiLink( + '/Humanitarian_OSM_Team/Working_groups/Data_Quality_Control_and_Assurance/Tasking_Manager_Project_Gardening', + ); }; - document.getElementById('archival-notification-close').onclick = function() { + document.getElementById('archival-notification-close').onclick = function () { closeForm(); }; } @@ -143,10 +143,7 @@ export function ArchivalNotificationBanner() { localStorage.setItem('archival-notification-closed', 'true'); } function openWikiLink(path) { - window.open( - 'https://wiki.openstreetmap.org/wiki' + path, - '_blank', - ); + window.open('https://wiki.openstreetmap.org/wiki' + path, '_blank'); closeForm(); } @@ -160,7 +157,9 @@ export function ArchivalNotificationBanner() { @@ -171,10 +170,16 @@ export function ArchivalNotificationBanner() {

-
+
-
+
diff --git a/frontend/src/components/banner/messages.js b/frontend/src/components/banner/messages.js index cce9e0b407..935c0287b7 100644 --- a/frontend/src/components/banner/messages.js +++ b/frontend/src/components/banner/messages.js @@ -34,11 +34,12 @@ export default defineMessages({ defaultMessage: 'Learn More', }, importantNotification: { - id: 'banner.title.notification', - defaultMessage: 'Important notification for users', + id: 'banner.title.notification', + defaultMessage: 'Important notification for users', }, archivalNotificationText: { id: 'banner.text.archivalNotification', - defaultMessage: 'Attention: as part of the ongoing maintenance of the Tasking Manager, projects created before 2020 will be archived.', - } + defaultMessage: + 'Attention: as part of the ongoing maintenance of the Tasking Manager, projects created before 2020 will be archived.', + }, }); diff --git a/frontend/src/components/code.js b/frontend/src/components/code.js index 91cdd6bf4c..72253bf01b 100644 --- a/frontend/src/components/code.js +++ b/frontend/src/components/code.js @@ -1,2 +1,3 @@ -export const Code = ({ className, children }) => - { children }; +export const Code = ({ className, children }) => ( + {children} +); diff --git a/frontend/src/components/deleteModal/index.js b/frontend/src/components/deleteModal/index.js index 3c2fdb3923..5647f7f6e2 100644 --- a/frontend/src/components/deleteModal/index.js +++ b/frontend/src/components/deleteModal/index.js @@ -93,7 +93,12 @@ export function DeleteModal({ id, name, type, className }: Object) { )} {deleteStatus === 'failure' && ( -

{(error && messages[`${error}Error`] && ) || error}

+

+ {(error && messages[`${error}Error`] && ( + + )) || + error} +

)}
diff --git a/frontend/src/components/deleteModal/messages.js b/frontend/src/components/deleteModal/messages.js index 871c2fb3dc..a4b2db608a 100644 --- a/frontend/src/components/deleteModal/messages.js +++ b/frontend/src/components/deleteModal/messages.js @@ -50,11 +50,12 @@ export default defineMessages({ }, InternalServerErrorError: { id: 'deleteModal.status.failure.InternalServerErrorError', - defaultMessage: "Something has gone wrong on the server, but the server could not be more specific on what the exact problem is.", + defaultMessage: + 'Something has gone wrong on the server, but the server could not be more specific on what the exact problem is.', }, HasMappedTasksError: { id: 'deleteModal.status.failure.HasMappedTasksError', - defaultMessage: "Project has mapped tasks, cannot be deleted.", + defaultMessage: 'Project has mapped tasks, cannot be deleted.', }, cancel: { id: 'deleteModal.button.cancel', diff --git a/frontend/src/components/header/NavLink.js b/frontend/src/components/header/NavLink.js index 5a6c1229ea..97693a4d08 100644 --- a/frontend/src/components/header/NavLink.js +++ b/frontend/src/components/header/NavLink.js @@ -11,7 +11,7 @@ export const NavLink = ({ partial = true, ...props }) => ( /> ); -export const TopNavLink = props => { +export const TopNavLink = (props) => { const { isActive, ...otherProps } = props; return ( diff --git a/frontend/src/components/header/index.js b/frontend/src/components/header/index.js index c03fbde97e..db488c79e2 100644 --- a/frontend/src/components/header/index.js +++ b/frontend/src/components/header/index.js @@ -35,7 +35,12 @@ function getMenuItensForUser(userDetails, organisations) { { label: messages.about, link: 'about', showAlways: true }, ]; if (SERVICE_DESK) { - menuItems.push({ label: messages.support, link: SERVICE_DESK, showAlways: true, serviceDesk: true }); + menuItems.push({ + label: messages.support, + link: SERVICE_DESK, + showAlways: true, + serviceDesk: true, + }); } let filteredMenuItems; diff --git a/frontend/src/components/header/signUp.js b/frontend/src/components/header/signUp.js index 6063d7b7e5..2e5e04072f 100644 --- a/frontend/src/components/header/signUp.js +++ b/frontend/src/components/header/signUp.js @@ -94,7 +94,8 @@ const SignupForm = ({ data, setData, step, setStep }) => { } /* eslint-disable-next-line */ - const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + const re = + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; if (re.test(data.email) === false) { setStep({ ...step, errMessage: }); return; diff --git a/frontend/src/components/homepage/testimonials/messages.js b/frontend/src/components/homepage/testimonials/messages.js index 1031657b81..133c5ded2f 100644 --- a/frontend/src/components/homepage/testimonials/messages.js +++ b/frontend/src/components/homepage/testimonials/messages.js @@ -11,7 +11,7 @@ export default defineMessages({ ifrcCitation: { id: 'home.testimonials.ifrc.citation', defaultMessage: - "In the early days of the Cyclone Idai response, IFRC was looking for detailed maps to get a sense of the scale of the flooding, which were also used for search and rescue operations. Later on, we had requests to identify where certain buildings, such as health centres or hospitals, were located so our health team could assess the damage and medical needs of patients.", + 'In the early days of the Cyclone Idai response, IFRC was looking for detailed maps to get a sense of the scale of the flooding, which were also used for search and rescue operations. Later on, we had requests to identify where certain buildings, such as health centres or hospitals, were located so our health team could assess the damage and medical needs of patients.', }, ifrcBio: { id: 'home.testimonials.ifrc.bio', diff --git a/frontend/src/components/projectCard/nCardPlaceholder.js b/frontend/src/components/projectCard/nCardPlaceholder.js index 82d3aace79..88996203d7 100644 --- a/frontend/src/components/projectCard/nCardPlaceholder.js +++ b/frontend/src/components/projectCard/nCardPlaceholder.js @@ -2,33 +2,36 @@ import React from 'react'; import { TextBlock, MediaBlock, RectShape } from 'react-placeholder/lib/placeholders'; -export const projectCardPlaceholderTemplate = (cardWidthClass = 'w-25-l') => (n, i) => ( -
-
-
- {' '} - {' '} +export const projectCardPlaceholderTemplate = + (cardWidthClass = 'w-25-l') => + (n, i) => + ( +
+
+
+ {' '} + {' '} +
+
+ {' '} + {' '} +
+

+ +

+ +
-
- {' '} - {' '} -
-

- -

- -
-
-); + ); export const nCardPlaceholders = (N, cardWidthClass = 'w-25-l') => { return [...Array(N).keys()].map(projectCardPlaceholderTemplate(cardWidthClass)); diff --git a/frontend/src/components/projectDetail/favorites.js b/frontend/src/components/projectDetail/favorites.js index 62036f9537..c49234d09a 100644 --- a/frontend/src/components/projectDetail/favorites.js +++ b/frontend/src/components/projectDetail/favorites.js @@ -6,8 +6,8 @@ import { navigate } from '@reach/router'; import { useSelector } from 'react-redux'; import messages from './messages'; -export const AddToFavorites = props => { - const userToken = useSelector(state => state.auth.get('token')); +export const AddToFavorites = (props) => { + const userToken = useSelector((state) => state.auth.get('token')); const [state, dispatchToggle] = useFavProjectAPI(false, props.projectId, userToken); const isFav = state.isFav; const isLoading = state.isLoading; diff --git a/frontend/src/components/projectDetail/questionsAndComments.js b/frontend/src/components/projectDetail/questionsAndComments.js index 3534d04dad..40bb5ed41f 100644 --- a/frontend/src/components/projectDetail/questionsAndComments.js +++ b/frontend/src/components/projectDetail/questionsAndComments.js @@ -35,7 +35,7 @@ export const PostProjectComment = ({ projectId, updateComments }) => { return (
- +
{
-
+
{ isShowPreview={isShowPreview} isProjectDetailCommentSection={true} /> -
+
- +
@@ -91,10 +91,9 @@ export const QuestionsAndComments = ({ projectId }) => { useEffect(() => { if (projectId && page) { - fetchLocalJSONAPI( - `projects/${projectId}/comments/?perPage=5&page=${page}`, - token, - ).then((res) => setComments(res)); + fetchLocalJSONAPI(`projects/${projectId}/comments/?perPage=5&page=${page}`, token).then( + (res) => setComments(res), + ); } }, [page, projectId, token]); diff --git a/frontend/src/components/projectEdit/actionsForm.js b/frontend/src/components/projectEdit/actionsForm.js index 95fc5b69f1..d5897262cb 100644 --- a/frontend/src/components/projectEdit/actionsForm.js +++ b/frontend/src/components/projectEdit/actionsForm.js @@ -363,52 +363,53 @@ const MessageContributorsModal = ({ projectId, close }: Object) => { const TransferProject = ({ projectId, orgId }: Object) => { const token = useSelector((state) => state.auth.get('token')); - const { projectInfo, } = useContext(StateContext); + const { projectInfo } = useContext(StateContext); const [username, setUsername] = useState(''); const [managers, setManagers] = useState([]); const [admins, setAdmins] = useState([]); const [isFetchingOptions, setIsFetchingOptions] = useState(true); useEffect(() => { - fetchLocalJSONAPI(`organisations/${orgId}/?omitManagerList=false`, token).then((r) => - setManagers(r.managers.map((m) => m.username))).then(() => - setIsFetchingOptions(false)); + fetchLocalJSONAPI(`organisations/${orgId}/?omitManagerList=false`, token) + .then((r) => setManagers(r.managers.map((m) => m.username))) + .then(() => setIsFetchingOptions(false)); fetchLocalJSONAPI(`users/?pagination=false`, token).then((t) => - setAdmins(t.users.map((u) => u.username))) + setAdmins(t.users.map((u) => u.username)), + ); }, [token, orgId]); const optionsExtended = [ { label: projectInfo.organisationName, - options: managers?.map(manager => ({ + options: managers?.map((manager) => ({ label: manager, value: manager, - })) + })), }, { label: , - options: admins?.filter( - admin => !managers?.includes(admin) - ).map(adminName => ({ - label: adminName, - value: adminName, - })) + options: admins + ?.filter((admin) => !managers?.includes(admin)) + .map((adminName) => ({ + label: adminName, + value: adminName, + })), }, ]; const handleSelect = (value) => { setUsername(value); }; - const { username: loggedInUsername, role: loggedInUserRole } = useSelector((state) => state.auth.get('userDetails')); - const hasAccess = ( + const { username: loggedInUsername, role: loggedInUserRole } = useSelector((state) => + state.auth.get('userDetails'), + ); + const hasAccess = managers?.includes(loggedInUsername) || loggedInUserRole === 'ADMIN' || - loggedInUsername === projectInfo.author - ); + loggedInUsername === projectInfo.author; const isDisabled = () => { - return ( - transferOwnershipAsync.status === 'pending' || !username || !hasAccess) + return transferOwnershipAsync.status === 'pending' || !username || !hasAccess; }; const transferOwnership = () => { return pushToLocalJSONAPI( @@ -428,11 +429,10 @@ const TransferProject = ({ projectId, orgId }: Object) => { getOptionLabel={({ label }) => label} getOptionValue={({ value }) => value} onChange={(e) => handleSelect(e?.value)} - value={optionsExtended?.find(manager => manager.value === username)} + value={optionsExtended?.find((manager) => manager.value === username)} options={optionsExtended} isLoading={isFetchingOptions} - > - + >

{ values={{ link: }} />

- +
rel="noopener noreferrer" > - ; + +); diff --git a/frontend/src/components/projectEdit/settingsForm.js b/frontend/src/components/projectEdit/settingsForm.js index 20933ab42c..bf0f511a5c 100644 --- a/frontend/src/components/projectEdit/settingsForm.js +++ b/frontend/src/components/projectEdit/settingsForm.js @@ -127,11 +127,12 @@ export const SettingsForm = ({ languages, defaultLocale }) => {

- {(projectInfo.mappingEditors.includes('RAPID') || projectInfo.validationEditors.includes('RAPID')) && ( + {(projectInfo.mappingEditors.includes('RAPID') || + projectInfo.validationEditors.includes('RAPID')) && (
-