Skip to content

Commit

Permalink
Changes the heading title of the "Measurement" block to "Selection"
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnnnii committed Jul 4, 2024
1 parent 9da3cee commit 9708064
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ import * as intl from "@arcgis/core/intl";
import { Point, Polyline, SpatialReference } from "@arcgis/core/geometry";
import { distance, geodesicArea, geodesicLength, planarArea } from "@arcgis/core/geometry/geometryEngine";

intl.convertNumberFormatToIntlOptions({
places: 2,

})
interface MeasurementsProps {
state: BlockState['state'];
dispatch: Dispatch<BlockAction[]>;
}
export default function Measurements({ state, dispatch }: MeasurementsProps) {
export default function SelectionInfo({ state, dispatch }: MeasurementsProps) {
const walkthrough = useWalkthrough();

const id = useReferenceElementId('confirm', 'left');
Expand Down Expand Up @@ -94,7 +90,7 @@ export default function Measurements({ state, dispatch }: MeasurementsProps) {
<CalciteBlock
ref={ref}
id={id}
heading="Measurements"
heading="Selection"
collapsible
open={state === 'open'}
onClick={() => {
Expand All @@ -108,7 +104,7 @@ export default function Measurements({ state, dispatch }: MeasurementsProps) {
dispatch([{
type: 'close',
mode: 'manual',
block: 'measurements'
block: 'selection'
}])
}
}}
Expand All @@ -117,7 +113,7 @@ export default function Measurements({ state, dispatch }: MeasurementsProps) {
dispatch([{
type: 'open',
mode: 'manual',
block: 'measurements'
block: 'selection'
}])
}
}}
Expand Down
2 changes: 1 addition & 1 deletion app/components/sidebar/sidebar-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type BlockAction = { mode?: 'managed' | 'manual', type: 'open' | 'close',
export interface BlockState { mode: 'managed' | 'manual', state: 'closed' | 'open' }
export interface SidebarState {
modelOrigin: BlockState;
measurements: BlockState;
selection: BlockState;
exportSettings: BlockState;
}
export function BlockStateReducer(state: SidebarState, actions: BlockAction[]) {
Expand Down
10 changes: 5 additions & 5 deletions app/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "@esri/calcite-components-react";
import useIsRoot from "~/hooks/useIsRoot";
import ModelOrigin from "./model-origin";
import Measurements from "./measurements";
import SelectionInfo from "./selection-info";
import ExportSettings from "./export-settings";
import { useEffect, useReducer } from "react";
import { BlockStateReducer, SidebarState } from "./sidebar-state";
Expand All @@ -13,7 +13,7 @@ import { useSelectionStateSelector } from "~/data/selection-store";

const initialState = {
modelOrigin: { mode: 'managed', state: 'closed' },
measurements: { mode: 'managed', state: 'closed' },
selection: { mode: 'managed', state: 'closed' },
exportSettings: { mode: 'managed', state: 'closed' },
} satisfies SidebarState;

Expand All @@ -39,14 +39,14 @@ export default function Sidebar() {
break;
}
case 'confirm': {
dispatch([{ block: 'measurements', type: 'open' }]);
dispatch([{ block: 'selection', type: 'open' }]);
break;
}
case 'downloading': {
dispatch([
{ block: 'exportSettings', type: 'open' },
{ block: 'modelOrigin', type: 'close' },
{ block: 'measurements', type: 'close' }
{ block: 'selection', type: 'close' }
]);
break;
}
Expand All @@ -59,7 +59,7 @@ export default function Sidebar() {
}}>
<CalcitePanel>
<ModelOrigin state={blockState.modelOrigin.state} dispatch={dispatch} />
<Measurements key={hasSelection ? 'selection' : 'no-selection'} state={blockState.measurements.state} dispatch={dispatch} />
<SelectionInfo key={hasSelection ? 'selection' : 'no-selection'} state={blockState.selection.state} dispatch={dispatch} />
<ExportSettings state={blockState.exportSettings.state} dispatch={dispatch} />
</CalcitePanel>
</CalciteShellPanel>
Expand Down

0 comments on commit 9708064

Please sign in to comment.