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

Allow configuration of position and order of extension panels #481

Merged
merged 53 commits into from
Mar 11, 2025
Merged
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
000bcb7
Save work
forman Feb 26, 2025
ec134c4
Merge branch 'main' into forman-477-pos_and_style_of_side_panels
forman Feb 26, 2025
3105f11
get rid of "compact" mode in control bar actions
forman Feb 26, 2025
1491f21
Merge branch 'refs/heads/forman-x-storybook' into forman-477-pos_and_…
forman Feb 27, 2025
dab1f5b
new Sidepanel component
forman Feb 27, 2025
cd331e5
Merge branch 'refs/heads/forman-x-storybook' into forman-477-pos_and_…
forman Feb 27, 2025
131236d
new side panel
forman Feb 28, 2025
6a386a3
Merge remote-tracking branch 'origin/forman-477-pos_and_style_of_side…
forman Feb 28, 2025
61ed38e
better sorting & styles
forman Feb 28, 2025
78a327b
fixed style
forman Feb 28, 2025
f1c86cc
fixed style
forman Feb 28, 2025
0cda5ff
merging with main
forman Mar 2, 2025
88ac614
Merge branch 'main' into forman-477-pos_and_style_of_side_panels
forman Mar 2, 2025
9eaad7f
merging with main
forman Mar 2, 2025
5e616b6
fixed style
forman Mar 3, 2025
4a1c51e
fixed styles
forman Mar 3, 2025
ce12fdb
sidebar uses different styles, sidebar buttons have left tooltip
forman Mar 4, 2025
b48452d
get spacing right
forman Mar 4, 2025
5cc05c7
still fixing splitter
forman Mar 4, 2025
841b78a
fixed splitting
forman Mar 4, 2025
cd107a4
fixed splitting
forman Mar 4, 2025
24850bf
rearrangements
forman Mar 5, 2025
b80d4b9
new approach
forman Mar 5, 2025
ccf3fbb
more intuitive sidebar switcher
forman Mar 5, 2025
2290be1
Merge branch 'forman-477-pos_and_style_of_side_panels' into forman-47…
forman Mar 5, 2025
d36eb21
suppress console outp
forman Mar 5, 2025
b1333d0
fixed splitting
forman Mar 6, 2025
7cc4624
about to align all side panel styles
forman Mar 6, 2025
a98cb52
adhere to Material Design
forman Mar 6, 2025
ffd49a5
Merge branch 'main' into forman-477-pos_and_style_of_side_panels
forman Mar 6, 2025
3c5027e
filter SET_SIDEBAR_POSITION actions
forman Mar 6, 2025
9a39e2f
using new util func makeCssStyles()
forman Mar 6, 2025
6521424
activated throttling
forman Mar 6, 2025
9cb0322
added width,height
forman Mar 6, 2025
2ab8286
larger icon
forman Mar 6, 2025
918c7c0
scrollbars are styled according to MUI theme mode
forman Mar 6, 2025
b132ecd
improve styling for InfoPanel
forman Mar 6, 2025
0856e7f
Renamed "Info" panel into "Details"; using new icon too; Fixed issue …
forman Mar 6, 2025
06b3deb
Renamed "Info" panel into "Details"; using new icon too; Fixed issue …
forman Mar 6, 2025
0ded0f4
extracted style
forman Mar 7, 2025
b3e27b1
put resize logic into hook
forman Mar 7, 2025
69cc6cd
Scale panel if container resizes; got rid of Splitter component
forman Mar 7, 2025
495e024
fixing splitting
forman Mar 8, 2025
83ce6da
this seem to work fine
forman Mar 9, 2025
a526cbf
Side panel now uses new `childPos` property with value `"last"`
forman Mar 9, 2025
f8f9180
Get rid of console output
forman Mar 9, 2025
f95921b
renamed actions to match new terminology
forman Mar 9, 2025
c0dad03
removed more console logging
forman Mar 10, 2025
d9a6c5a
we finally have a sticky sidebar
forman Mar 10, 2025
5234e92
corrected style of hor scrollbars and corners
forman Mar 10, 2025
36f47c0
Merge branch 'main' into forman-477-pos_and_style_of_side_panels
forman Mar 10, 2025
09f4ef5
'CSSProperties' is declared but its value is never read
forman Mar 10, 2025
e8bdde3
Apply suggestions from code review
forman Mar 11, 2025
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
2 changes: 2 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ const config: StorybookConfig = {
options: {},
},
};

// noinspection JSUnusedGlobalSymbols
export default config;
1 change: 1 addition & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ const preview: Preview = {
],
};

// noinspection JSUnusedGlobalSymbols
export default preview;
13 changes: 12 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@

### Improvements

* Redesigned the right side panel: (#477)
- Replaced the tabs by a sidebar comprising panel icons;
extension panels can now be positioned and can have own icons. (#477)
- Restyled many side panels

* Variable layer legends are now styled according to the
current theme mode. (#491)

* Added a `Divider` to provide a visual separation of control bar items for
better clarity to the users. (#487)

* Various style adjustments with respect to the current theme modes

_Dark_ and _Light_.

* Renamed "Info" panel into "Details"; using new icon too.

* Improved _Developer Reference_ documentation.

### Fixes and other Changes
### Fixes

* Fixed a problem where mouse splitters used to resize
two components (e.g., two layers in map view, or map view and side panels)
Expand Down
4 changes: 2 additions & 2 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ A list of all the features that the viewer contains will be created here, in whi
<td>
Positioned in the sidebar, the metadata for the
<strong>selected dataset, variable, or place</strong> is located under
the "Info"-Tab. The <strong>display can be enabled</strong> using the
the "Details"-Tab. The <strong>display can be enabled</strong> using the
buttons at the top left. When a display is enabled, the button's
background appears highlighted in gray.
<br /><br />
Expand All @@ -936,7 +936,7 @@ A list of all the features that the viewer contains will be created here, in whi
<tr>
<td><b>Functionality</b></td>
<td>
Open the sidebar and navigate to the "Info" tab to view the metadata.
Open the sidebar and navigate to the "Details" tab to view the metadata.
Enable the display for the object of interest: <strong>dataset, selected
variable, or selected place</strong>. If no place is currently selected, the most
recently selected place will be used. Then, choose the relevant metadata
Expand Down
47 changes: 21 additions & 26 deletions src/actions/controlActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
ControlState,
LayerVisibilities,
MapInteraction,
SidebarPanelId,
TimeAnimationInterval,
ViewMode,
VolumeRenderMode,
Expand Down Expand Up @@ -501,45 +500,41 @@ export function setLayerMenuOpen(layerMenuOpen: boolean): SetLayerMenuOpen {

////////////////////////////////////////////////////////////////////////////////

export const SET_SIDEBAR_POSITION = "SET_SIDEBAR_POSITION";
export const SET_SIDE_PANEL_OPEN = "SET_SIDE_PANEL_OPEN";

export interface SetSidebarPosition {
type: typeof SET_SIDEBAR_POSITION;
sidebarPosition: number;
export interface SetSidePanelOpen {
type: typeof SET_SIDE_PANEL_OPEN;
sidePanelOpen: boolean;
}

export function setSidebarPosition(
sidebarPosition: number,
): SetSidebarPosition {
return { type: SET_SIDEBAR_POSITION, sidebarPosition };
export function setSidePanelOpen(sidePanelOpen: boolean): SetSidePanelOpen {
return { type: SET_SIDE_PANEL_OPEN, sidePanelOpen };
}

////////////////////////////////////////////////////////////////////////////////

export const SET_SIDEBAR_OPEN = "SET_SIDEBAR_OPEN";
export const SET_SIDE_PANEL_ID = "SET_SIDE_PANEL_ID";

export interface SetSidebarOpen {
type: typeof SET_SIDEBAR_OPEN;
sidebarOpen: boolean;
export interface SetSidePanelId {
type: typeof SET_SIDE_PANEL_ID;
sidePanelId: string | null;
}

export function setSidebarOpen(sidebarOpen: boolean): SetSidebarOpen {
return { type: SET_SIDEBAR_OPEN, sidebarOpen };
export function setSidePanelId(sidePanelId: string | null): SetSidePanelId {
return { type: SET_SIDE_PANEL_ID, sidePanelId };
}

////////////////////////////////////////////////////////////////////////////////

export const SET_SIDEBAR_PANEL_ID = "SET_SIDEBAR_PANEL_ID";
export const SET_SIDE_PANEL_SIZE = "SET_SIDE_PANEL_SIZE";

export interface SetSidebarPanelId {
type: typeof SET_SIDEBAR_PANEL_ID;
sidebarPanelId: SidebarPanelId | string;
export interface SetSidePanelSize {
type: typeof SET_SIDE_PANEL_SIZE;
sidePanelSize: number;
}

export function setSidebarPanelId(
sidebarPanelId: SidebarPanelId | string,
): SetSidebarPanelId {
return { type: SET_SIDEBAR_PANEL_ID, sidebarPanelId };
export function setSidePanelSize(sidePanelSize: number): SetSidePanelSize {
return { type: SET_SIDE_PANEL_SIZE, sidePanelSize };
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -822,9 +817,9 @@ export type ControlAction =
| OpenDialog
| CloseDialog
| SetLayerMenuOpen
| SetSidebarPosition
| SetSidebarOpen
| SetSidebarPanelId
| SetSidePanelSize
| SetSidePanelOpen
| SetSidePanelId
| SetVolumeRenderMode
| UpdateVolumeState
| SetVisibleInfoCardElements
Expand Down
32 changes: 16 additions & 16 deletions src/actions/dataActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ import {
SelectDataset,
selectDataset,
selectPlace,
SetSidebarOpen,
setSidebarOpen,
SetSidebarPanelId,
setSidebarPanelId,
SetSidePanelOpen,
setSidePanelOpen,
SetSidePanelId,
setSidePanelId,
} from "./controlActions";
import { newPersistentAppState, PersistedState } from "@/states/persistedState";
import { applyPersistentState } from "@/actions/otherActions";
Expand Down Expand Up @@ -543,7 +543,7 @@ export function removeUserPlaceGroup(
export function addStatistics() {
return (
dispatch: Dispatch<
SetSidebarOpen | SetSidebarPanelId | AddStatistics | MessageLogAction
SetSidePanelOpen | SetSidePanelId | AddStatistics | MessageLogAction
>,
getState: () => AppState,
) => {
Expand All @@ -553,18 +553,18 @@ export function addStatistics() {
const selectedVariable = selectedVariableSelector(getState());
const selectedPlaceInfo = selectedPlaceInfoSelector(getState());
const selectedTimeLabel = selectedDatasetTimeLabelSelector(getState());
const sidebarOpen = getState().controlState.sidebarOpen;
const sidebarPanelId = getState().controlState.sidebarPanelId;
const sidePanelOpen = getState().controlState.sidePanelOpen;
const sidePanelId = getState().controlState.sidePanelId;

if (!(selectedDataset && selectedVariable && selectedPlaceInfo)) {
return;
}

if (sidebarPanelId !== "stats") {
dispatch(setSidebarPanelId("stats"));
if (sidePanelId !== "stats") {
dispatch(setSidePanelId("stats"));
}
if (!sidebarOpen) {
dispatch(setSidebarOpen(true));
if (!sidePanelOpen) {
dispatch(setSidePanelOpen(true));
}
dispatch(_addStatistics(null));
api
Expand Down Expand Up @@ -614,7 +614,7 @@ export function removeStatistics(index: number): RemoveStatistics {
export function addTimeSeries() {
return (
dispatch: Dispatch<
SetSidebarOpen | SetSidebarPanelId | UpdateTimeSeries | MessageLogAction
SetSidePanelOpen | SetSidePanelId | UpdateTimeSeries | MessageLogAction
>,
getState: () => AppState,
) => {
Expand All @@ -630,8 +630,8 @@ export function addTimeSeries() {
const useMedian = getState().controlState.timeSeriesUseMedian;
const includeStdev = getState().controlState.timeSeriesIncludeStdev;
let timeChunkSize = selectedTimeChunkSizeSelector(getState());
const sidebarOpen = getState().controlState.sidebarOpen;
const sidebarPanelId = getState().controlState.sidebarPanelId;
const sidebarOpen = getState().controlState.sidePanelOpen;
const sidebarPanelId = getState().controlState.sidePanelId;

const placeGroups = placeGroupsSelector(getState());

Expand All @@ -642,10 +642,10 @@ export function addTimeSeries() {
selectedDatasetTimeDim
) {
if (sidebarPanelId !== "timeSeries") {
dispatch(setSidebarPanelId("timeSeries"));
dispatch(setSidePanelId("timeSeries"));
}
if (!sidebarOpen) {
dispatch(setSidebarOpen(true));
dispatch(setSidePanelOpen(true));
}

const timeLabels = selectedDatasetTimeDim.labels;
Expand Down
2 changes: 1 addition & 1 deletion src/actions/otherActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function _applyPersistentState(

function restoreMapView(mapState: PersistedMapState) {
if (MAP_OBJECTS["map"]) {
console.log("Restoring map:", mapState);
console.debug("Restoring map:", mapState);
const map = MAP_OBJECTS["map"] as OlMap;
map.setView(new OlView(mapState.view));
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/AuthWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const AuthWrapper: React.FC<React.PropsWithChildren<AuthWrapperProps>> = ({
}

const handleSigninCallback = (_user: User | void): void => {
console.info("handleSigninCallback:", _user);
console.debug("handleSigninCallback:", _user);
window.history.replaceState({}, document.title, window.location.pathname);
};

const handleRemoveUser = (): void => {
console.info("handleRemoveUser");
console.debug("handleRemoveUser");
// go home after logout
window.location.pathname = "/";
};
Expand Down
7 changes: 4 additions & 3 deletions src/components/ColorBarLegend/ColorBarCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* https://opensource.org/licenses/MIT.
*/

import { useEffect, useRef, MouseEvent, CSSProperties } from "react";
import { useEffect, useRef, MouseEvent } from "react";
import { styled, Theme } from "@mui/system";
import Tooltip from "@mui/material/Tooltip";

import i18n from "@/i18n";
import { makeCssStyles } from "@/util/styles";
import { ColorBar, renderColorBar } from "@/model/colorBar";
import { COLOR_BAR_ITEM_HEIGHT, COLOR_BAR_ITEM_WIDTH } from "./constants";
import { getBorderStyle } from "./style";
Expand All @@ -18,10 +19,10 @@ const StyledCanvas = styled("canvas")(({ theme }: { theme: Theme }) => ({
cursor: "pointer",
}));

const styles: Record<string, CSSProperties> = {
const styles = makeCssStyles({
nominal: {},
error: { border: "1px solid red" },
};
});

interface ColorBarCanvasProps {
colorBar: ColorBar;
Expand Down
5 changes: 3 additions & 2 deletions src/components/ControlBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ const ControlBarForm = styled("form")(({ theme }: { theme: Theme }) => ({
display: "flex",
flexWrap: "wrap",
paddingTop: theme.spacing(1),
paddingLeft: theme.spacing(1),
paddingRight: theme.spacing(1),
paddingLeft: theme.spacing(0.5),
paddingRight: theme.spacing(0),
paddingBottom: theme.spacing(0.25),
flexGrow: 0,
}));

Expand Down
Loading