From 29ab78c1c957a151efd2050f16b227cb2ecb4928 Mon Sep 17 00:00:00 2001 From: ramyaragupathy Date: Wed, 2 Mar 2022 21:11:16 +0530 Subject: [PATCH 1/3] #5017 Support link added --- frontend/src/components/header/index.js | 13 ++++++++++++- frontend/src/components/header/messages.js | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/header/index.js b/frontend/src/components/header/index.js index 05001054fa..caf50cc4f0 100644 --- a/frontend/src/components/header/index.js +++ b/frontend/src/components/header/index.js @@ -5,7 +5,7 @@ import Popup from 'reactjs-popup'; import { FormattedMessage } from 'react-intl'; import messages from './messages'; -import { ORG_URL, ORG_NAME, ORG_LOGO } from '../../config'; +import { ORG_URL, ORG_NAME, ORG_LOGO, SERVICE_DESK } from '../../config'; import logo from '../../assets/img/main-logo.svg'; import { ExternalLinkIcon } from '../svgIcons'; import { Dropdown } from '../dropdown'; @@ -33,6 +33,7 @@ function getMenuItensForUser(userDetails, organisations) { { label: messages.manage, link: 'manage', authenticated: true, manager: true }, { label: messages.learn, link: 'learn', showAlways: true }, { label: messages.about, link: 'about', showAlways: true }, + { label: messages.support, link: SERVICE_DESK, showAlways: true, serviceDesk: true }, ]; let filteredMenuItems; if (userDetails.username) { @@ -114,6 +115,16 @@ const PopupItems = (props) => {

))} + + {props.menuItems + .filter((item) => item.serviceDesk === true) + .map((item, n) => ( +

+ + + +

+ ))} {/* user links */} {props.userDetails.username && ( <> diff --git a/frontend/src/components/header/messages.js b/frontend/src/components/header/messages.js index ccff938fe0..ee8e69a43a 100644 --- a/frontend/src/components/header/messages.js +++ b/frontend/src/components/header/messages.js @@ -15,6 +15,10 @@ export default defineMessages({ id: 'header.nav.aboutLink', defaultMessage: 'About', }, + support: { + id: 'header.nav.support', + defaultMessage: 'Support', + }, myContributions: { id: 'header.nav.my_contributions', defaultMessage: 'My contributions', From d2887d093df93449c7f35cd057261b5bb0a5f5ed Mon Sep 17 00:00:00 2001 From: Hel Nershing Thapa Date: Mon, 21 Mar 2022 11:46:38 +0545 Subject: [PATCH 2/3] Use anchor tag for external support link --- frontend/src/components/header/index.js | 47 +++++++++++++++++-------- frontend/src/locales/en.json | 8 +++++ 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/header/index.js b/frontend/src/components/header/index.js index caf50cc4f0..59b3164a22 100644 --- a/frontend/src/components/header/index.js +++ b/frontend/src/components/header/index.js @@ -98,9 +98,21 @@ const PopupItems = (props) => { .filter((item) => item.authenticated === false || item.showAlways) .map((item, n) => (

- - - + {!item.serviceDesk ? ( + + + + ) : ( + + + + + )}

))}

@@ -116,15 +128,6 @@ const PopupItems = (props) => {

))} - {props.menuItems - .filter((item) => item.serviceDesk === true) - .map((item, n) => ( -

- - - -

- ))} {/* user links */} {props.userDetails.username && ( <> @@ -174,9 +177,23 @@ class Header extends React.Component { return (
{filteredMenuItems.map((item, n) => ( - - - + <> + {!item.serviceDesk ? ( + + + + ) : ( + + + + + )} + ))}
); diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index e7e3b00ab2..4a227f89d5 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -4,6 +4,10 @@ "banner.button.agree": "I agree", "banner.privacyPolicy": "privacy policy", "banner.text": "We use cookies and similar technologies to recognize and analyze your visits, and measure traffic usage and activity. You can learn about how we use the data about your visit or information you provide reading our {link}. By clicking \"I Agree\", you consent to the use of cookies.", + "banner.button.close": "Close", + "banner.button.learnmore": "Learn More", + "banner.title.notification": "Important notification for users", + "banner.text.archivalNotification": "Attention: as part of the ongoing maintenance of the Tasking Manager, projects created before 2020 will be archived.", "comment.input.imageUpload.error": "The image upload failed.", "comment.input.imageUpload.progress": "Uploading file...", "comment.input.sending.progress": "Sending message...", @@ -55,6 +59,7 @@ "header.nav.projects": "Explore projects", "header.nav.learn": "Learn", "header.nav.aboutLink": "About", + "header.nav.support": "Support", "header.nav.my_contributions": "My contributions", "header.nav.manage": "Manage", "header.buttons.logIn": "Log in", @@ -406,6 +411,8 @@ "projects.formInputs.random_task_selection": "Enforce random task selection", "projects.formInputs.random_task_selection.mapping": "Enforce random task selection on mapping", "projects.formInputs.random_task_selection.description": "If checked, users must edit tasks at random for the initial editing stage (managers and admins are exempt).", + "projects.formInputs.rapid_power_user": "Enable RapiD Power User Features", + "projects.formInputs.rapid_power_user.description": "If checked, RapiD will load with the power user dialog enabled.", "projects.formInputs.imagery": "Imagery", "projects.formInputs.imagery.note": "Follow this format for TMS URLs: {exampleUrl}", "projects.formInputs.priority_areas.options.polygon": "Draw polygon", @@ -531,6 +538,7 @@ "project.stats.totalEdits": "Total map edits", "project.stats.changesets": "Changesets", "project.stats.edits": "Edits", + "project.stats.edits.info": "These stats are retrieved using the default changeset comment of the project", "project.tasks.unsaved_map_changes.title": "You have some unsaved map changes", "project.tasks.unsaved_map_changes.split": "Save or undo it to be able to split the task", "project.tasks.unsaved_map_changes.unlock": "Save or undo it to be able to select another task", From 8e417ce32ddfa8eec6a87b93a06f40d990f9eb8b Mon Sep 17 00:00:00 2001 From: Hel Nershing Thapa Date: Mon, 21 Mar 2022 11:57:56 +0545 Subject: [PATCH 3/3] Update menu items test case to include support portal link --- frontend/src/components/header/tests/menuItens.test.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/header/tests/menuItens.test.js b/frontend/src/components/header/tests/menuItens.test.js index a0d6a359a6..3f7288c677 100644 --- a/frontend/src/components/header/tests/menuItens.test.js +++ b/frontend/src/components/header/tests/menuItens.test.js @@ -1,25 +1,26 @@ import { getMenuItensForUser } from '../index'; +import { SERVICE_DESK } from '../../../config'; it('test menuItems for unlogged user', () => { const userDetails = {}; const menuItems = getMenuItensForUser(userDetails, []).map((i) => i.link); - expect(menuItems).toEqual(['explore', 'learn', 'about']); + expect(menuItems).toEqual(['explore', 'learn', 'about', SERVICE_DESK]); }); it('test menuItems for logged non admin user', () => { const userDetails = { username: 'test', role: 'MAPPER' }; const menuItems = getMenuItensForUser(userDetails, []).map((i) => i.link); - expect(menuItems).toEqual(['explore', 'contributions', 'learn', 'about']); + expect(menuItems).toEqual(['explore', 'contributions', 'learn', 'about', SERVICE_DESK]); }); it('test menuItems for logged non admin user, but org manager', () => { const userDetails = { username: 'test', role: 'MAPPER' }; const menuItems = getMenuItensForUser(userDetails, [1, 3, 4]).map((i) => i.link); - expect(menuItems).toEqual(['explore', 'contributions', 'manage', 'learn', 'about']); + expect(menuItems).toEqual(['explore', 'contributions', 'manage', 'learn', 'about', SERVICE_DESK]); }); it('test menuItems for logged admin user', () => { const userDetails = { username: 'test', role: 'ADMIN' }; const menuItems = getMenuItensForUser(userDetails, []).map((i) => i.link); - expect(menuItems).toEqual(['explore', 'contributions', 'manage', 'learn', 'about']); + expect(menuItems).toEqual(['explore', 'contributions', 'manage', 'learn', 'about', SERVICE_DESK]); });