Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maps Update: Cards and Modals for Maps Components #1314

Open
wants to merge 53 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6f3ee9f
Changing maps page to cards with modals
juanjoseguva Jul 18, 2024
17d26a0
Adding messagesfor map modal
juanjoseguva Jul 18, 2024
823b161
Adding licence header
juanjoseguva Jul 18, 2024
09b333a
Removing unused line
juanjoseguva Jul 18, 2024
8ff0ebe
Fix to allow saves in map modal
Nireves333 Jul 24, 2024
dc87b56
Create and utilize new maps selector
hazeltonbw Jul 28, 2024
c799c95
Class Component to Redux function component update
hazeltonbw Jul 28, 2024
0a941da
Adding ": " to map card descriptors for formatting
juanjoseguva Jul 24, 2024
af01ec7
Removing unnecessary button
juanjoseguva Jul 24, 2024
b55b672
Adding missing : on a map descriptor
juanjoseguva Jul 30, 2024
2b3885d
Removing item name from descriptor (so no map)
juanjoseguva Jul 30, 2024
a7e6ddf
Limiting map note to 30 characters.
Jul 31, 2024
6397225
Treating circle size as a positive number
Jul 31, 2024
0fb3b45
Changing the order of descriptors on card to match the modal.
Jul 31, 2024
76ddde9
Removing unused variable
juanjoseguva Jul 31, 2024
815f998
Changing the name of the button to upload a new map image file.
Jul 31, 2024
b427cbf
Resolving syntax and jsdoc declaration requirements
Jul 31, 2024
b687569
Resolving syntax and jsdoc declaration requirements
Jul 31, 2024
d57da8c
use useAppDispatch for type safety
hazeltonbw Jul 31, 2024
bc49a65
Remove container props, utilize dispatch for redux actions
hazeltonbw Jul 31, 2024
105395d
Use the new component instead of old container
hazeltonbw Jul 31, 2024
0d0a421
Remove props used for container, removed isEdited and isSubmitting st…
hazeltonbw Jul 31, 2024
75c5609
Delete unused types and only import necessary functions from moment p…
hazeltonbw Jul 31, 2024
8430932
Delete unused props & functions, add new memoized selector
hazeltonbw Jul 31, 2024
6db61de
Treating map file name as an uneditable item
juanjoseguva Aug 1, 2024
e775c62
Handling displayable with an enum instead of a boolean and fixing a t…
juanjoseguva Aug 1, 2024
4c5f66c
Bug squashing
juanjoseguva Aug 1, 2024
09e0738
Aligning modal call function names with other components and limiting…
juanjoseguva Aug 2, 2024
811dc66
Update code to use simple selector
hazeltonbw Aug 3, 2024
9641220
Put modal state where it belongs
hazeltonbw Aug 3, 2024
30d7bf7
Merge branch 'development' into Maps-Update
juanjoseguva Aug 3, 2024
1e0b61b
Reverting to treating map displayability variable as a boolean instea…
juanjoseguva Aug 3, 2024
51a220f
Add coloring to map Display and add TODO for date internationalization
Nireves333 Aug 3, 2024
d270242
Use memoized createAppSelector instead of directly handling state in …
hazeltonbw Aug 4, 2024
18fa275
Fix linting errors
hazeltonbw Aug 4, 2024
ca08606
Leave TODO notes for future updates
hazeltonbw Aug 5, 2024
9c4513d
Merge remote-tracking branch 'origin/development' into pr/juanjoseguv…
huss Aug 5, 2024
8a276b4
fix linting
huss Aug 5, 2024
21de916
Initial RTKQ Maps
ChrisMart21 Aug 5, 2024
45d0db6
Remove Maps from RootState
ChrisMart21 Aug 11, 2024
17c851e
Comments
ChrisMart21 Aug 11, 2024
5c8dbc1
More Maps Changes
ChrisMart21 Aug 13, 2024
b7a3e56
ReEnable Immutable check
ChrisMart21 Aug 13, 2024
ae28cda
Bug Fix Revert Change.
ChrisMart21 Aug 13, 2024
67d578c
Hot Fix Changes.
ChrisMart21 Aug 13, 2024
66ea48d
Fix Imports
ChrisMart21 Aug 13, 2024
095def8
MapChartSelect Crash Fix
ChrisMart21 Aug 13, 2024
8a53505
Login Invalidation updated.
ChrisMart21 Aug 13, 2024
b71527a
Cleanup Legacy Redux where applicable
ChrisMart21 Aug 13, 2024
90db2c6
Merge branch 'development' into Maps-Update
ChrisMart21 Aug 13, 2024
18b8b6e
Fix Merge Issues / Missing MPL headers
ChrisMart21 Aug 13, 2024
a8237ba
Update Root Reducer, Sanitize Devtools
ChrisMart21 Aug 14, 2024
04ba6a5
Address Unserializable Values In State/Actions.
ChrisMart21 Aug 14, 2024
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
7 changes: 4 additions & 3 deletions src/client/app/components/BarChartComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PlotRelayoutEvent } from 'plotly.js';
import * as React from 'react';
import Plot from 'react-plotly.js';
import { TimeInterval } from '../../../common/TimeInterval';
import { updateSliderRange } from '../redux/actions/extraActions';
import { updateSliderRange } from '../redux/slices/graphSlice';
import { readingsApi, stableEmptyBarReadings } from '../redux/api/readingsApi';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
import { selectPlotlyBarDataFromResult, selectPlotlyBarDeps } from '../redux/selectors/barChartSelectors';
Expand Down Expand Up @@ -115,14 +115,15 @@ export default function BarChartComponent() {
const startTS = utc(e['xaxis.range[0]']);
const endTS = utc(e['xaxis.range[1]']);
const workingTimeInterval = new TimeInterval(startTS, endTS);
dispatch(updateSliderRange(workingTimeInterval));
dispatch(updateSliderRange(workingTimeInterval.toString()));
}
else if (e['xaxis.range']) {
// this case is when the slider knobs are dragged.
const range = e['xaxis.range']!;
const startTS = range && range[0];
const endTS = range && range[1];
dispatch(updateSliderRange(new TimeInterval(utc(startTS), utc(endTS))));
const interval = new TimeInterval(utc(startTS), utc(endTS)).toString();
dispatch(updateSliderRange(interval));

}
}, 500, { leading: false, trailing: true })}
Expand Down
17 changes: 4 additions & 13 deletions src/client/app/components/ChartSelectComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import { sortBy, values } from 'lodash';
import * as React from 'react';
import { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { useSelector } from 'react-redux';
import { Dropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
import { graphSlice, selectChartToRender } from '../redux/slices/graphSlice';
import { SelectOption } from '../types/items';
import { ChartTypes } from '../types/redux/graph';
import { State } from '../types/redux/state';
import translate from '../utils/translate';
import TooltipMarkerComponent from './TooltipMarkerComponent';

Expand All @@ -24,10 +20,10 @@ export default function ChartSelectComponent() {
const currentChartToRender = useAppSelector(selectChartToRender);
const dispatch = useAppDispatch();
const [expand, setExpand] = useState(false);
const mapsById = useSelector((state: State) => state.maps.byMapID);
const sortedMaps = sortBy(values(mapsById).map(map => (
{ value: map.id, label: map.name, isDisabled: !(map.origin && map.opposite) } as SelectOption
)), 'label');
// const mapsById = useAppSelector(selectMapDataById);
// const sortedMaps = sortBy(values(mapsById).map(map => (
// { value: map.id, label: map.name, isDisabled: !(map.origin && map.opposite) } as SelectOption
// )), 'label');

return (
<>
Expand All @@ -52,11 +48,6 @@ export default function ChartSelectComponent() {
key={chartType}
onClick={() => {
dispatch(graphSlice.actions.changeChartToRender(chartType));
if (chartType === ChartTypes.map && Object.keys(sortedMaps).length === 1) {
// If there is only one map, selectedMap is the id of the only map. ie; display map automatically if only 1 map
dispatch({ type: 'UPDATE_SELECTED_MAPS', mapID: sortedMaps[0].value });

}
}}
>
{translate(`${chartType}`)}
Expand Down
11 changes: 5 additions & 6 deletions src/client/app/components/DateRangeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import * as React from 'react';
import 'react-calendar/dist/Calendar.css';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
import { selectSelectedLanguage } from '../redux/slices/appStateSlice';
import { changeSliderRange, selectQueryTimeInterval, updateTimeInterval, selectChartToRender} from '../redux/slices/graphSlice';
import { changeSliderRange, selectQueryTimeInterval, updateTimeInterval, selectChartToRender } from '../redux/slices/graphSlice';
import '../styles/DateRangeCustom.css';
import { Dispatch } from '../types/redux/actions';
import { dateRangeToTimeInterval, timeIntervalToDateRange } from '../utils/dateRangeCompatibility';
import translate from '../utils/translate';
import TooltipMarkerComponent from './TooltipMarkerComponent';
Expand All @@ -22,15 +21,15 @@ import { ChartTypes } from '../types/redux/graph';
* @returns Date Range Calendar Picker
*/
export default function DateRangeComponent() {
const dispatch: Dispatch = useAppDispatch();
const dispatch = useAppDispatch();
const queryTimeInterval = useAppSelector(selectQueryTimeInterval);
const locale = useAppSelector(selectSelectedLanguage);
const chartType = useAppSelector(selectChartToRender);
const datePickerVisible = chartType !== ChartTypes.compare;
const datePickerVisible = chartType !== ChartTypes.compare;

const handleChange = (value: Value) => {
dispatch(updateTimeInterval(dateRangeToTimeInterval(value)));
dispatch(changeSliderRange(dateRangeToTimeInterval(value)));
dispatch(updateTimeInterval(dateRangeToTimeInterval(value).toString()));
dispatch(changeSliderRange(dateRangeToTimeInterval(value).toString()));
};


Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/HeaderButtonsComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { FormattedMessage } from 'react-intl';
import { Link, useLocation } from 'react-router-dom';
import { DropdownItem, DropdownMenu, DropdownToggle, Nav, NavLink, Navbar, UncontrolledDropdown } from 'reactstrap';
import TooltipHelpComponent from '../components/TooltipHelpComponent';
import { clearGraphHistory } from '../redux/actions/extraActions';
import { authApi } from '../redux/api/authApi';
import { selectOEDVersion } from '../redux/api/versionApi';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
Expand All @@ -19,6 +18,7 @@ import { UserRole } from '../types/items';
import translate from '../utils/translate';
import LanguageSelectorComponent from './LanguageSelectorComponent';
import TooltipMarkerComponent from './TooltipMarkerComponent';
import { clearGraphHistory } from '../redux/slices/graphSlice';

/**
* React Component that defines the header buttons at the top of a page
Expand Down
2 changes: 1 addition & 1 deletion src/client/app/components/HistoryComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import * as React from 'react';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
import { selectForwardHistory, selectPrevHistory } from '../redux/slices/graphSlice';
import { historyStepBack, historyStepForward } from '../redux/actions/extraActions';
import { historyStepBack, historyStepForward } from '../redux/slices/graphSlice';
import TooltipMarkerComponent from './TooltipMarkerComponent';

/**
Expand Down
7 changes: 4 additions & 3 deletions src/client/app/components/LineChartComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PlotRelayoutEvent } from 'plotly.js';
import * as React from 'react';
import Plot from 'react-plotly.js';
import { TimeInterval } from '../../../common/TimeInterval';
import { updateSliderRange } from '../redux/actions/extraActions';
import { updateSliderRange } from '../redux/slices/graphSlice';
import { readingsApi, stableEmptyLineReadings } from '../redux/api/readingsApi';
import { useAppDispatch, useAppSelector } from '../redux/reduxHooks';
import { selectLineChartQueryArgs } from '../redux/selectors/chartQuerySelectors';
Expand Down Expand Up @@ -101,14 +101,15 @@ export default function LineChartComponent() {
const startTS = utc(e['xaxis.range[0]']);
const endTS = utc(e['xaxis.range[1]']);
const workingTimeInterval = new TimeInterval(startTS, endTS);
dispatch(updateSliderRange(workingTimeInterval));
dispatch(updateSliderRange(workingTimeInterval.toString()));
}
else if (e['xaxis.range']) {
// this case is when the slider knobs are dragged.
const range = e['xaxis.range']!;
const startTS = range && range[0];
const endTS = range && range[1];
dispatch(updateSliderRange(new TimeInterval(utc(startTS), utc(endTS))));
const interval = new TimeInterval(utc(startTS), utc(endTS));
dispatch(updateSliderRange(interval.toString()));

}
}, 500, { leading: false, trailing: true })
Expand Down
Loading
Loading