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

WIP 2 #3

Open
wants to merge 164 commits into
base: develop
Choose a base branch
from
Open

Conversation

karljakoblarsson
Copy link
Owner

No description provided.

dennisbergstrom and others added 30 commits December 14, 2022 11:20
Resolved an issue where toggling a parent group's visibility did not accurately reflect the visibility of its sublayers.

The `setGroupHidden` and `setGroupVisible` functions were updated to maintain the correct state of `visibleSubLayers`.
The following features have been added in this commit:

SnackbarProvider.js:
- Create `SnackbarContext` to share snackbar state and controls among components.
- Implement `SnackbarProvider` component to set up `SnackbarContext` provider using the `useSnackbar` hook from `notistack` for snackbar controls.
- Initialize shared state (`messageItems`) to hold list of messages for snackbar display.
- Utilize `NotistackSnackbarProvider` to render the snackbar and provide the shared state and functions through `SnackbarContext`, enabling access to snackbar controls and shared state in child components.

useSnackbar.js:
- Create `useSnackbar` custom hook to manage snackbar messages with methods for adding (`addToSnackbar`), removing (`removeFromSnackbar`), hiding (`hideSnackbar`), displaying snackbar messages without storing (`displaySnackbar`) and clearing all messages (`clearAllMessages`).
- Implement functionality to handle group and layer specific snackbar messages for visibility notification of layers at different zoom levels.
- Include handling for non-grouped messages, displaying individual messages as standalone notifications.
- Add a close action button to each snackbar message and enable automatic control of snackbar visibility duration.

App.js:
- Update `SnackbarProvider` import statement to use the `SnackbarProvider` component.
Implement a queue-based system to manage state updates in the `useSnackbar` function to solve race conditions.

Changes include:
1. Create a new `updateQueue` ref to hold all state update operations.
2. Adjust `addToSnackbar` and `removeFromSnackbar` to push their state update functions into `updateQueue`, rather than executing them directly.
3. Add a new function `processQueue` that takes the next update function from the queue and executes it.
4. Call `processQueue` in `addToSnackbar` and `removeFromSnackbar` after their update is pushed into the queue, starting the processing of queued updates.
1. Import and implement `useSnackbar` custom hook for managing notifications. This enables addition, removal, and display of Snackbar messages.
2. Update the `listenToZoomChange` and `zoomEndHandler` functions to effectively handle zoom level changes and visibility of the layer at the current zoom level.
3. Refactor render logic to adjust CheckBoxIcon's color based on layer visibility, type, and zoom level.
Changes include:
1. Import and implement `useSnackbar` custom hook in GroupLayer for handling notifications.
2. Use a custom hook within a `useEffect` to remove layer captions from the Snackbar message when the visibility of sublayers in a group changes.
3. Update the `handleLayerItemClick` method in GroupLayer to manage visibility toggling of group layers and remove the appropriate layer captions from the Snackbar message.
4. Pass `zoomVisible` state as a prop from GroupLayer to SubLayerItem component to ensure consistent layer visibility management.
5. Modify the `getLayerToggleIcon` function in SubLayerItem to adjust the icon color based on the zoom visibility.
Import `useSnackbar` in MapCleaner to use `clearAllMessages` that clears all Snackbar messages.
Changes include:
- Add features that allow users to create new `Quick Layers` by inputting data into fields.
- Ability to add and delete layers.
- Import and validate JSON data.
- Automatically generate unique IDs for each `Quick Layer`.
- All `Quick Layers` are displayed in a list.
- Filter feature to search through the list of `Quick Layers`.
- A success message is displayed if the save or import was successful, and an error message is shown if the save or import failed.
Add new classes for managing Quick Layers in the backend.

Changes include:
`LayerMenuOptions.cs`: New property `quickLayersPresets` to store a list of `Quick Layer` presets.
`QuickLayer.cs`: This class defines the structure of a `Quick Layer`.
`QuickLayerMetadata.cs`: This class holds metadata about a `Quick Layer`.
`QuickLayerPreset.cs`: This class represents a `Quick Layer` preset.
We want to be more explicit with our props.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants