Skip to content

Commit b025772

Browse files
committed
Renaming Files and adding Js doc comments
1 parent 88ffc5b commit b025772

File tree

7 files changed

+79
-31
lines changed

7 files changed

+79
-31
lines changed

packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx renamed to packages/base/src/dialogs/symbology/components/color_ramp/ColorRampControls.tsx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1+
/**
2+
* @module ColorRampControls
3+
*
4+
* This component provides the main UI controls for classifying raster layers
5+
* using different color ramps and classification modes.
6+
*
7+
* Allows users to:
8+
* - Select a color ramp (`ColorRampSelector`)
9+
* - Choose classification mode and number of classes (`ModeSelectRow`)
10+
* - Run classification via `classifyFunc`, with loading state (`LoadingIcon`)
11+
*
12+
* Props:
13+
* - `modeOptions`: Available classification modes.
14+
* - `layerParams`: Layer symbology state.
15+
* - `classifyFunc`: Callback for classification.
16+
* - `showModeRow`: Toggle for mode selector.
17+
* - `showRampSelector`: Toggle for ramp selector.
18+
*/
19+
120
import { IDict } from '@jupytergis/schema';
221
import { Button } from '@jupyterlab/ui-components';
322
import React, { useEffect, useState } from 'react';
423

524
import { LoadingIcon } from '@/src/shared/components/loading';
6-
import CanvasSelectComponent from './CanvasSelectComponent';
25+
import ColorRampSelector from './ColorRampSelector';
726
import ModeSelectRow from './ModeSelectRow';
827
import { COLOR_RAMP_DEFAULTS, ColorRampName } from '../../colorRampUtils';
928

10-
interface IColorRampProps {
29+
interface IColorRampControlsProps {
1130
modeOptions: string[];
1231
layerParams: IDict;
1332
classifyFunc: (
@@ -20,13 +39,13 @@ interface IColorRampProps {
2039
showRampSelector: boolean;
2140
}
2241

23-
export type ColorRampOptions = {
42+
export type ColorRampControlsOptions = {
2443
selectedRamp: string;
2544
numberOfShades: string;
2645
selectedMode: string;
2746
};
2847

29-
const ColorRamp: React.FC<IColorRampProps> = ({
48+
const ColorRampControls: React.FC<IColorRampControlsProps> = ({
3049
layerParams,
3150
modeOptions,
3251
classifyFunc,
@@ -99,7 +118,7 @@ const ColorRamp: React.FC<IColorRampProps> = ({
99118
{showRampSelector && (
100119
<div className="jp-gis-symbology-row">
101120
<label htmlFor="color-ramp-select">Color Ramp:</label>
102-
<CanvasSelectComponent
121+
<ColorRampSelector
103122
selectedRamp={selectedRamp}
104123
setSelected={setSelectedRamp}
105124
/>
@@ -144,4 +163,4 @@ const ColorRamp: React.FC<IColorRampProps> = ({
144163
);
145164
};
146165

147-
export default ColorRamp;
166+
export default ColorRampControls;

packages/base/src/dialogs/symbology/components/color_ramp/CanvasSelectComponent.tsx renamed to packages/base/src/dialogs/symbology/components/color_ramp/ColorRampSelector.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1+
/**
2+
* @module ColorRampSelector
3+
*
4+
* Dropdown component for selecting a color ramp.
5+
* - Displays the currently selected ramp as a preview on a canvas.
6+
* - Expands to show a list of available ramps (`ColorRampSelectorEntry`).
7+
* - Updates the preview and notifies parent via `setSelected` when a ramp is chosen.
8+
*
9+
* Props:
10+
* - `selectedRamp`: Name of the currently selected color ramp.
11+
* - `setSelected`: Callback fired with the new ramp when selected.
12+
*/
13+
114
import { Button } from '@jupyterlab/ui-components';
215
import React, { useEffect, useRef, useState } from 'react';
316

417
import { useColorMapList } from '@/src/dialogs/symbology/colorRampUtils';
5-
import ColorRampEntry from './ColorRampEntry';
18+
import ColorRampSelectorEntry from './ColorRampSelectorEntry';
619

720
export interface IColorMap {
821
name: string;
922
colors: string[];
1023
}
1124

12-
interface ICanvasSelectComponentProps {
25+
interface IColorRampSelectorProps {
1326
selectedRamp: string;
1427
setSelected: (item: any) => void;
1528
}
1629

17-
const CanvasSelectComponent: React.FC<ICanvasSelectComponentProps> = ({
30+
const ColorRampSelector: React.FC<IColorRampSelectorProps> = ({
1831
selectedRamp,
1932
setSelected,
2033
}) => {
@@ -108,11 +121,15 @@ const CanvasSelectComponent: React.FC<ICanvasSelectComponentProps> = ({
108121
className={`jp-gis-color-ramp-dropdown ${isOpen ? 'jp-gis-open' : ''}`}
109122
>
110123
{colorMaps.map((item, index) => (
111-
<ColorRampEntry index={index} colorMap={item} onClick={selectItem} />
124+
<ColorRampSelectorEntry
125+
index={index}
126+
colorMap={item}
127+
onClick={selectItem}
128+
/>
112129
))}
113130
</div>
114131
</div>
115132
);
116133
};
117134

118-
export default CanvasSelectComponent;
135+
export default ColorRampSelector;

packages/base/src/dialogs/symbology/components/color_ramp/ColorRampEntry.tsx renamed to packages/base/src/dialogs/symbology/components/color_ramp/ColorRampSelectorEntry.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1+
/**
2+
* @module ColorRampSelectorEntry
3+
*
4+
* Represents a single selectable color ramp option in the `ColorRampSelector`.
5+
* Renders a preview ColorRamp on a canvas and triggers `onClick` when selected.
6+
*
7+
* Props:
8+
* - `index`: Unique index for canvas ID.
9+
* - `colorMap`: Ramp definition including name and colors.
10+
* - `onClick`: Callback fired with the ramp name when clicked.
11+
*/
12+
113
import React, { useEffect } from 'react';
214

3-
import { IColorMap } from './CanvasSelectComponent';
15+
import { IColorMap } from './ColorRampSelector';
416

5-
interface IColorRampEntryProps {
17+
interface IColorRampSelectorEntryProps {
618
index: number;
719
colorMap: IColorMap;
820
onClick: (item: any) => void;
921
}
1022

11-
const ColorRampEntry: React.FC<IColorRampEntryProps> = ({
23+
const ColorRampSelectorEntry: React.FC<IColorRampSelectorEntryProps> = ({
1224
index,
1325
colorMap,
1426
onClick,
@@ -57,4 +69,4 @@ const ColorRampEntry: React.FC<IColorRampEntryProps> = ({
5769
);
5870
};
5971

60-
export default ColorRampEntry;
72+
export default ColorRampSelectorEntry;

packages/base/src/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { ExpressionValue } from 'ol/expr/expression';
55
import React, { useEffect, useRef, useState } from 'react';
66

77
import { GeoTiffClassifications } from '@/src/dialogs/symbology/classificationModes';
8-
import ColorRamp, {
9-
ColorRampOptions,
10-
} from '@/src/dialogs/symbology/components/color_ramp/ColorRamp';
8+
import ColorRampControls, {
9+
ColorRampControlsOptions,
10+
} from '@/src/dialogs/symbology/components/color_ramp/ColorRampControls';
1111
import StopRow from '@/src/dialogs/symbology/components/color_stops/StopRow';
1212
import useGetBandInfo, {
1313
IBandRow,
@@ -50,13 +50,13 @@ const SingleBandPseudoColor: React.FC<ISymbologyDialogProps> = ({
5050
const [selectedFunction, setSelectedFunction] =
5151
useState<InterpolationType>('linear');
5252
const [colorRampOptions, setColorRampOptions] = useState<
53-
ColorRampOptions | undefined
53+
ColorRampControlsOptions | undefined
5454
>();
5555

5656
const stopRowsRef = useRef<IStopRow[]>();
5757
const bandRowsRef = useRef<IBandRow[]>([]);
5858
const selectedFunctionRef = useRef<InterpolationType>();
59-
const colorRampOptionsRef = useRef<ColorRampOptions | undefined>();
59+
const colorRampOptionsRef = useRef<ColorRampControlsOptions | undefined>();
6060
const selectedBandRef = useRef<number>();
6161

6262
useEffect(() => {
@@ -404,7 +404,7 @@ const SingleBandPseudoColor: React.FC<ISymbologyDialogProps> = ({
404404
</div>
405405
</div>
406406
{bandRows.length > 0 && (
407-
<ColorRamp
407+
<ColorRampControls
408408
layerParams={layer.parameters}
409409
modeOptions={modeOptions}
410410
classifyFunc={buildColorInfoFromClassification}

packages/base/src/dialogs/symbology/vector_layer/types/Categorized.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ReadonlyJSONObject } from '@lumino/coreutils';
33
import { ExpressionValue } from 'ol/expr/expression';
44
import React, { useEffect, useRef, useState } from 'react';
55

6-
import ColorRamp from '@/src/dialogs/symbology/components/color_ramp/ColorRamp';
6+
import ColorRampControls from '@/src/dialogs/symbology/components/color_ramp/ColorRampControls';
77
import StopContainer from '@/src/dialogs/symbology/components/color_stops/StopContainer';
88
import {
99
IStopRow,
@@ -330,7 +330,7 @@ const Categorized: React.FC<ISymbologyTabbedDialogWithAttributesProps> = ({
330330
)}
331331

332332
<div className="jp-gis-layer-symbology-container">
333-
<ColorRamp
333+
<ColorRampControls
334334
layerParams={layer.parameters}
335335
modeOptions={[]}
336336
classifyFunc={buildColorInfoFromClassification}

packages/base/src/dialogs/symbology/vector_layer/types/Graduated.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { ExpressionValue } from 'ol/expr/expression';
33
import React, { useEffect, useRef, useState } from 'react';
44

55
import { VectorClassifications } from '@/src/dialogs/symbology/classificationModes';
6-
import ColorRamp, {
7-
ColorRampOptions,
8-
} from '@/src/dialogs/symbology/components/color_ramp/ColorRamp';
6+
import ColorRampControls, {
7+
ColorRampControlsOptions,
8+
} from '@/src/dialogs/symbology/components/color_ramp/ColorRampControls';
99
import StopContainer from '@/src/dialogs/symbology/components/color_stops/StopContainer';
1010
import {
1111
IStopRow,
@@ -35,13 +35,13 @@ const Graduated: React.FC<ISymbologyTabbedDialogWithAttributesProps> = ({
3535
const symbologyTabRef = useRef<string>();
3636
const colorStopRowsRef = useRef<IStopRow[]>([]);
3737
const radiusStopRowsRef = useRef<IStopRow[]>([]);
38-
const colorRampOptionsRef = useRef<ColorRampOptions | undefined>();
38+
const colorRampOptionsRef = useRef<ColorRampControlsOptions | undefined>();
3939

4040
const [selectedAttribute, setSelectedAttribute] = useState('');
4141
const [colorStopRows, setColorStopRows] = useState<IStopRow[]>([]);
4242
const [radiusStopRows, setRadiusStopRows] = useState<IStopRow[]>([]);
4343
const [colorRampOptions, setColorRampOptions] = useState<
44-
ColorRampOptions | undefined
44+
ColorRampControlsOptions | undefined
4545
>();
4646
const [colorManualStyle, setColorManualStyle] = useState({
4747
strokeColor: '#3399CC',
@@ -381,7 +381,7 @@ const Graduated: React.FC<ISymbologyTabbedDialogWithAttributesProps> = ({
381381
</div>
382382
)}
383383

384-
<ColorRamp
384+
<ColorRampControls
385385
layerParams={layer.parameters}
386386
modeOptions={modeOptions}
387387
classifyFunc={buildColorInfoFromClassification}

packages/base/src/dialogs/symbology/vector_layer/types/Heatmap.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import colormap from 'colormap';
22
import React, { useEffect, useRef, useState } from 'react';
33

4-
import CanvasSelectComponent from '@/src/dialogs/symbology/components/color_ramp/CanvasSelectComponent';
4+
import ColorRampSelector from '@/src/dialogs/symbology/components/color_ramp/ColorRampSelector';
55
import { ISymbologyDialogProps } from '@/src/dialogs/symbology/symbologyDialog';
66

77
const Heatmap: React.FC<ISymbologyDialogProps> = ({
@@ -99,7 +99,7 @@ const Heatmap: React.FC<ISymbologyDialogProps> = ({
9999
<p>Represent features based on their density using a heatmap.</p>
100100
<div className="jp-gis-symbology-row jp-gis-heatmap">
101101
<label htmlFor="color-ramp-select">Color Ramp:</label>
102-
<CanvasSelectComponent
102+
<ColorRampSelector
103103
selectedRamp={selectedRamp}
104104
setSelected={setSelectedRamp}
105105
/>

0 commit comments

Comments
 (0)