Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
352 changes: 176 additions & 176 deletions .yarn/releases/yarn-4.18.0.cjs → .yarn/releases/yarn-4.18.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.18.0.cjs
yarnPath: .yarn/releases/yarn-4.18.1.cjs
2,578 changes: 285 additions & 2,293 deletions README.md

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions mock-api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1952,10 +1952,10 @@ __metadata:
languageName: node
linkType: hard

"content-type@npm:^2.0.0":
version: 2.0.0
resolution: "content-type@npm:2.0.0"
checksum: 10c0/491539fff707d7594b0ca4fabcc084bef2a31ffa754ff0a4f80c4377e3963cff0394317f9271c24087596c97fa675bc123d61fa34ffe65b4904e7d3d3098de72
"content-type@npm:^2.0.0, content-type@npm:^2.1.0":
version: 2.1.0
resolution: "content-type@npm:2.1.0"
checksum: 10c0/f5d420f55fd0c7a7f7cbae9637777ce67a074aa79b489d8d9fee8599089592b5f8bb194e1d6885741fee20271034baca0d68d5419535b52d070c4f7e39f4b448
languageName: node
linkType: hard

Expand Down Expand Up @@ -2504,15 +2504,17 @@ __metadata:
linkType: hard

"negotiator@npm:^1.0.0":
version: 1.0.0
resolution: "negotiator@npm:1.0.0"
checksum: 10c0/4c559dd52669ea48e1914f9d634227c561221dd54734070791f999c52ed0ff36e437b2e07d5c1f6e32909fc625fe46491c16e4a8f0572567d4dd15c3a4fda04b
version: 1.1.0
resolution: "negotiator@npm:1.1.0"
dependencies:
content-type: "npm:^2.1.0"
checksum: 10c0/656fa57de02f1a0c4c09f9e17eb78e8182547c07093e810ff8f16249b6ae31f2c546a3d457905e94f3276b25f0e2741ea1a3bc3912192932ed7e493adfea535e
languageName: node
linkType: hard

"node-gyp@npm:latest":
version: 13.0.1
resolution: "node-gyp@npm:13.0.1"
version: 13.0.2
resolution: "node-gyp@npm:13.0.2"
dependencies:
env-paths: "npm:^2.2.0"
exponential-backoff: "npm:^3.1.1"
Expand All @@ -2526,7 +2528,7 @@ __metadata:
which: "npm:^7.0.0"
bin:
node-gyp: bin/node-gyp.js
checksum: 10c0/424077bc9e9bbe953a8e86db473ba818cbc6a121714008c977fd589e21e5f0c811fbf22faac730dc7182450b5e52df301811d01ae3373898658d999b7710f4e6
checksum: 10c0/29d33ccf47ffeeb5e7af925550b416f698a26a72eb10975c7eb5775c1d0cecacd76d164a4aa45503d3ddcece209db65c712be00423c69381a4cd14e2e6540559
languageName: node
linkType: hard

Expand Down Expand Up @@ -2615,9 +2617,9 @@ __metadata:
linkType: hard

"picomatch@npm:^4.0.4":
version: 4.0.5
resolution: "picomatch@npm:4.0.5"
checksum: 10c0/947bc6b6e1ff1e6c5aaf95b107a0839d12802f4f7b867663f67d47accba939ca1cb582cf99dfc30438efa1c4648ac5990967e783e8929c36b03e8440704ef1bd
version: 4.0.7
resolution: "picomatch@npm:4.0.7"
checksum: 10c0/beb6ae02c43ae44e84883b90830196d9046b1726ead292adcf7f57945e0bb0d992d68563d87e03b484b6f3c9a5c6defda7523477f047d7f0e663f126cc01787f
languageName: node
linkType: hard

Expand Down Expand Up @@ -2655,12 +2657,12 @@ __metadata:
linkType: hard

"proxy-addr@npm:^2.0.7":
version: 2.0.7
resolution: "proxy-addr@npm:2.0.7"
version: 2.0.8
resolution: "proxy-addr@npm:2.0.8"
dependencies:
forwarded: "npm:0.2.0"
ipaddr.js: "npm:1.9.1"
checksum: 10c0/c3eed999781a35f7fd935f398b6d8920b6fb00bbc14287bc6de78128ccc1a02c89b95b56742bf7cf0362cc333c61d138532049c7dedc7a328ef13343eff81210
checksum: 10c0/58398f36e5b1f72b1011ca21844c0c41a9a3b6f2f0d101bcdb19abb3f3dd9626b27a96e53da777ded901eb67faed0304a4bc1d435b235e436f66f8e5e1fe1f5e
languageName: node
linkType: hard

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@
"react-spinners": "^0.17.1",
"react-to-print": "^3.3.0",
"react-toastify": "^11.1.0",
"react-window": "^2.3.2",
"react-window": "^2.3.3",
"redux": "^5.0.1",
"redux-persist": "^5.10.0",
"redux-promise": "^0.6.0",
"redux-thunk": "^3.1.0",
"reselect": "^5.3.0",
"socket.io-client": "^4.8.3",
"socket.io-client": "^4.8.4",
"suncalc": "^2.0.2",
"use-sound": "^5.0.0",
"uuid": "^14.0.2",
Expand All @@ -94,7 +94,7 @@
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.7",
"@vitejs/plugin-react": "^6.1.1",
"dotenv": "^18.0.3",
"dotenv": "^18.0.4",
"eslint-plugin-jest": "^29.16.6",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
Expand All @@ -111,7 +111,7 @@
"stylelint-config-css-modules": "^4.6.0",
"stylelint-config-standard": "^40.0.0",
"stylelint-scss": "^7.3.0",
"vite": "^8.3.0",
"vite": "^8.3.1",
"vite-plugin-svgr": "^5.2.0"
},
"jest": {
Expand Down Expand Up @@ -141,5 +141,5 @@
"jest-watch-typeahead/testname"
]
},
"packageManager": "yarn@4.18.0"
"packageManager": "yarn@4.18.1"
}
9 changes: 2 additions & 7 deletions src/EditableItem/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import Button from 'react-bootstrap/Button';
import Dropdown from 'react-bootstrap/Dropdown';
import SplitButton from 'react-bootstrap/SplitButton';

import { EVENT_FORM_STATES, PREVIEW_FEATURES } from '../constants';
import { EVENT_FORM_STATES } from '../constants';
import { isReportActive } from '../utils/events';
import { usePreviewFeature } from '../hooks';

import * as styles from './styles.module.scss';

Expand All @@ -29,10 +28,6 @@ const Footer = ({
const { t } = useTranslation('details-view', { keyPrefix: 'footer' });
const { cancelTitle = t('cancelButton') } = restProps;

// Remove this flag and the conditional rendering below once community input
// is enabled for all tenants.
const communityInputEnabled = usePreviewFeature(PREVIEW_FEATURES.COMMUNITY_INPUT_ADMIN);

const isActive = isReportActive(data);
const isInReview = data?.state === EVENT_FORM_STATES.REVIEW;
const SaveButtonComponent = onStateToggle ? SplitButton : Button;
Expand All @@ -49,7 +44,7 @@ const Footer = ({
label={t('stateResolveButton')}
/>
</Dropdown.Item>}
{isActive && communityInputEnabled && <Dropdown.Item>
{isActive && <Dropdown.Item>
<StateButton
targetState={EVENT_FORM_STATES.REVIEW}
onStateToggle={onStateToggle}
Expand Down
1 change: 0 additions & 1 deletion src/EventFilter/FiltersPopover/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ describe('EventFilter - FiltersPopover', () => {
eventTypes: [FENCE_EVENT_TYPE],
subjectStore: {},
},
view: { systemConfig: { previewFeatures: {} } },
};
});

Expand Down
1 change: 0 additions & 1 deletion src/EventFilter/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('EventFilter', () => {
feedEvents: { count: 3, results: [] },
subjectStore: {},
},
view: { systemConfig: { previewFeatures: {} } },
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ describe('SideBar - EventsManager - EventOverview - DetailsSection', () => {
},
mapLocationSelection: { isPickingLocation: false },
sideBar: {},
systemConfig: {
previewFeatures: { community_input_admin_enabled: true },
},
userPreferences: { gpsFormat: GPS_FORMATS.DEG },
},
};
Expand Down
9 changes: 2 additions & 7 deletions src/SideBar/EventsManager/EventOverview/Footer/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';

import { EVENT_FORM_STATES, PREVIEW_FEATURES } from '../../../../constants';
import { EVENT_FORM_STATES } from '../../../../constants';
import { isReportActive } from '../../../../utils/events';
import { usePreviewFeature } from '../../../../hooks';

import AddAttachmentButton from '../../../../AddAttachmentButton';
import AddNoteButton from '../../../../AddNoteButton';
Expand Down Expand Up @@ -31,16 +30,12 @@ const Footer = ({
}) => {
const { t } = useTranslation('reports', { keyPrefix: 'eventsManager.eventOverview.footer' });

// Remove this flag and the conditional option below once community input is
// enabled for all tenants.
const isCommunityInputEnabled = usePreviewFeature(PREVIEW_FEATURES.COMMUNITY_INPUT_ADMIN);

const isActive = isReportActive(report);
const isInReview = report?.state === REVIEW;

const saveOptions = isCommunity ? [] : [
(isActive || isInReview) && { key: 'resolve', label: t('saveAndResolveOption'), targetState: RESOLVED },
isActive && isCommunityInputEnabled && { key: 'review', label: t('saveAndReviewOption'), targetState: REVIEW },
isActive && { key: 'review', label: t('saveAndReviewOption'), targetState: REVIEW },
isInReview && { key: 'activate', label: t('saveAndActivateOption'), targetState: ACTIVE },
!isActive && !isInReview && { key: 'reopen', label: t('saveAndReopenOption'), targetState: ACTIVE },
]
Expand Down
40 changes: 10 additions & 30 deletions src/SideBar/EventsManager/EventOverview/Footer/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react';
import { Provider } from 'react-redux';
import userEvent from '@testing-library/user-event';

import { mockStore } from '../../../../__test-helpers/MockStore';
import { PREVIEW_FEATURES } from '../../../../constants';
import { render, screen, within } from '../../../../test-utils';
import { report } from '../../../../__test-helpers/fixtures/reports';

Expand All @@ -16,30 +13,24 @@ jest.mock('../../../../DetailViewComponents/AddReportButton', () => {
});

describe('SideBar - EventsManager - EventOverview - Footer', () => {
let onAddAttachments, onAddNote, onCancel, onSave, onSaveAndSetState, store;
let onAddAttachments, onAddNote, onCancel, onSave, onSaveAndSetState;

beforeEach(() => {
onAddAttachments = jest.fn();
onAddNote = jest.fn();
onCancel = jest.fn();
onSave = jest.fn();
onSaveAndSetState = jest.fn();

store = { data: {}, view: { systemConfig: {} } };
});

const renderFooter = (props = {}, storeOverrides = store) => render(
<Provider store={mockStore(storeOverrides)}>
<Footer
onAddAttachments={onAddAttachments}
onAddNote={onAddNote}
onSave={onSave}
onSaveAndSetState={onSaveAndSetState}
report={report}
{...props}
/>
</Provider>
);
const renderFooter = (props = {}) => render(<Footer
onAddAttachments={onAddAttachments}
onAddNote={onAddNote}
onSave={onSave}
onSaveAndSetState={onSaveAndSetState}
report={report}
{...props}
/>);

const openSaveOptions = async () => {
await userEvent.click(screen.getByRole('button', { name: 'More save options' }));
Expand Down Expand Up @@ -114,22 +105,11 @@ describe('SideBar - EventsManager - EventOverview - Footer', () => {
expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled();
});

test('offers to save and resolve an active event', async () => {
test('offers to save and resolve or send to review an active event', async () => {
renderFooter();

const menu = await openSaveOptions();

expect(within(menu).getAllByRole('menuitem').map((option) => option.textContent)).toEqual(['Save and resolve']);
});

test('offers to save and send to review an active event when community input is enabled', async () => {
renderFooter({}, {
...store,
view: { systemConfig: { previewFeatures: { [PREVIEW_FEATURES.COMMUNITY_INPUT_ADMIN]: true } } },
});

const menu = await openSaveOptions();

expect(within(menu).getAllByRole('menuitem').map((option) => option.textContent))
.toEqual(['Save and resolve', 'Save and review']);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { useTranslation } from 'react-i18next';

import { ReactComponent as CheckIcon } from '../../../../../common/images/icons/check-light.svg';

import { EVENT_FORM_STATES, PREVIEW_FEATURES } from '../../../../../constants';
import { EVENT_FORM_STATES } from '../../../../../constants';
import navigateMenuWithKeyboard from '../../../../utils/navigateMenuWithKeyboard';
import { usePreviewFeature } from '../../../../../hooks';

import * as styles from './styles.module.scss';

Expand All @@ -26,10 +25,6 @@ const normalizeState = (state) => state === NEW_LEGACY ? ACTIVE : state;
const StatusSelect = ({ isDirty, onSelect, savedState, state }) => {
const { t } = useTranslation('reports', { keyPrefix: 'eventsManager.eventOverview.header.statusSelect' });

// Remove this flag and the `.filter` below once community input is enabled
// for all tenants.
const isCommunityInputEnabled = usePreviewFeature(PREVIEW_FEATURES.COMMUNITY_INPUT_ADMIN);

const optionRefs = useRef([]);

const menuId = useId();
Expand All @@ -41,8 +36,7 @@ const StatusSelect = ({ isDirty, onSelect, savedState, state }) => {
const savedStateKey = normalizeState(savedState);

// The saved state leads, as the one the rest are moves away from.
const options = [savedStateKey, ...STATES.filter((option) => option !== savedStateKey)]
.filter((option) => isCommunityInputEnabled || option !== REVIEW || savedStateKey === REVIEW);
const options = [savedStateKey, ...STATES.filter((option) => option !== savedStateKey)];

// Closing without restoring focus: a click outside lands focus where the user
// clicked, and pulling it back would steal it from there.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import React from 'react';
import { Provider } from 'react-redux';
import userEvent from '@testing-library/user-event';

import { mockStore } from '../../../../../__test-helpers/MockStore';
import { PREVIEW_FEATURES } from '../../../../../constants';
import { render, screen, within } from '../../../../../test-utils';

import StatusSelect from './';

describe('SideBar - EventsManager - EventOverview - Header - StatusSelect', () => {
let onSelect, store;
let onSelect;

beforeEach(() => {
onSelect = jest.fn();

store = { view: { systemConfig: { previewFeatures: { [PREVIEW_FEATURES.COMMUNITY_INPUT_ADMIN]: true } } } };
});

const renderStatusSelect = (props = {}) => render(<Provider store={mockStore(store)}>
const renderStatusSelect = (props = {}) => render(<>
<button type="button">Outside</button>

<StatusSelect isDirty={false} onSelect={onSelect} savedState="active" state="active" {...props} />
</Provider>);
</>);

const getToggle = () => screen.getByRole('button', { name: /Change event state/ });

Expand All @@ -41,15 +36,6 @@ describe('SideBar - EventsManager - EventOverview - Header - StatusSelect', () =
.toEqual(['Active', 'Send to review', 'Resolve']);
});

test('does not offer to send to review without community input', async () => {
store.view.systemConfig.previewFeatures = {};
renderStatusSelect();

await userEvent.click(getToggle());

expect(screen.queryByRole('menuitem', { name: 'Send to review' })).toBeNull();
});

test('selects the state the user picks and returns focus to the toggle', async () => {
renderStatusSelect();

Expand Down
Loading
Loading