Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed Aug 23, 2024
1 parent a6788e6 commit 298a227
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 30 deletions.
1 change: 1 addition & 0 deletions src/components/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const Collapse: ParentComponent<CollapseProps> = (props) => {
props,
);

// eslint-disable-next-line solid/reactivity
const [style, setStyle] = createSignal(!mergedProps.value ? collapsedStyles : fixedStyles);

createEffect((prevValue) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Inputs/InputRangeSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function InputFieldRangeSlider(props: InputFieldRangeNumberProps)
const [
currentValue,
setCurrentValue,
] = createSignal(props.value);
] = createSignal(props.value); // eslint-disable-line solid/reactivity

const createSlider = () => {
slider = noUiSlider.create(refSliderNode, {
Expand Down
3 changes: 1 addition & 2 deletions src/components/LeftMenu/LayoutFeatures.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Import from solid-js
import {
Accessor, createSignal,
JSX, Setter, Show,
Accessor, createSignal, JSX, Setter,
} from 'solid-js';
import { produce } from 'solid-js/store';

Expand Down
12 changes: 2 additions & 10 deletions src/components/Modals/ClassificationDiscontinuityPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
// Imports from solid-js
import {
createSignal, For, JSX, Match,
onCleanup, onMount,
Show, Switch,
createSignal, For, JSX, Show,
} from 'solid-js';

// Imports from other packages
import toast from 'solid-toast';

// Helpers
import { useI18nContext } from '../../i18n/i18n-solid';
import d3 from '../../helpers/d3-custom';
import {
classificationMethodHasOption,
getClassifier,
parseUserDefinedBreaks,
prepareStatisticalSummary,
OptionsClassification,
} from '../../helpers/classification';
import { isFiniteNumber } from '../../helpers/common';
import { Mmin, Mround, round } from '../../helpers/math';
import { Mmin, round } from '../../helpers/math';
import { makeDistributionPlot } from '../DistributionPlots.tsx';

// Sub-components
import DropdownMenu from '../DropdownMenu.tsx';
import InputFieldCheckbox from '../Inputs/InputCheckbox.tsx';
import InputFieldRangeSlider from '../Inputs/InputRangeSlider.tsx';

// Store
import { classificationPanelStore, setClassificationPanelStore } from '../../store/ClassificationPanelStore';
Expand Down
2 changes: 2 additions & 0 deletions src/components/Modals/TableFunctionalitySelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ function CardFunctionality(
: undefined
}
onKeyDown={
// We don't care about pDesc reactivity here
// eslint-disable-next-line solid/reactivity
pDesc.enabled
? (e) => {
if (e.key === 'Enter' || e.key === ' ') {
Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/CartogramSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default function CartogramSettings(props: PortrayalSettingsProps): JSX.El

// The description of the layer for which we are creating the settings menu
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The fields of the layer that are of type 'ratio'
// (i.e. the fields that can be used for the choropleth).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export default function CategoricalChoroplethSettings(props: PortrayalSettingsPr

// The description of the layer for which we are creating the settings menu
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The number of features in the layer
const nbFt = layerDescription.data.features.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function CategoricalPictogramSettings(props: PortrayalSettingsPro

// The description of the layer for which we are creating the settings menu
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The number of features in the layer
const nbFt = layerDescription.data.features.length;
Expand Down Expand Up @@ -178,7 +178,7 @@ export default function CategoricalPictogramSettings(props: PortrayalSettingsPro
makePictoCategoriesMapping(
makeCategoriesMap(
layerDescription.data.features,
targetVariable(),
targetVariable(), // eslint-disable-line solid/reactivity
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/ChoroplethSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default function ChoroplethSettings(props: PortrayalSettingsProps): JSX.E

// The description of the layer for which we are creating the settings menu
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The fields of the layer that are of type 'ratio'
// (i.e. the fields that can be used for the choropleth).
Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/GriddingSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default function GriddingSettings(props: PortrayalSettingsProps): JSX.Ele

// The description of the layer of which we want to create a gridded representation
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The bbox of the layer
const bboxLayer = bbox(layerDescription.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default function LayerFromTabularSettings(
const { LL } = useI18nContext();

const tableDescription = layersDescriptionStore.tables
.find((table) => table.id === props.tableId)!;
.find((table) => table.id === props.tableId)!; // eslint-disable-line solid/reactivity

const [
newLayerName,
Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/MushroomsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export default function MushroomsSettings(
const { LL } = useI18nContext();

const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The fields of the layer that are of type 'stock'.
// We know that we have such fields because otherwise this component would not be rendered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ export default function PointAggregationSettings(props: PortrayalSettingsProps):

// The description of the layer for which we are creating the settings menu
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The fields that are of type stock or ratio
const targetFields = layerDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export default function ProportionalSymbolsSettings(
const { LL } = useI18nContext();

const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

const geometryType = layerDescription.type as VectorType;

Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/SelectionSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function SelectionSettings(
const { LL } = useI18nContext();

const layerDescription = layersDescriptionStore.layers
.find((layer) => layer.id === props.layerId)!;
.find((layer) => layer.id === props.layerId)!; // eslint-disable-line solid/reactivity

const nFeaturesLayer = layerDescription.data.features.length;

Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/SimplificationSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function SimplificationSettings(
const { LL } = useI18nContext();

const layerDescription = layersDescriptionStore.layers
.find((layer) => layer.id === props.layerId)!;
.find((layer) => layer.id === props.layerId)!; // eslint-disable-line solid/reactivity

const [
simplifiedLayers,
Expand Down
2 changes: 1 addition & 1 deletion src/components/PortrayalOption/SmoothingSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default function SmoothingSettings(props: PortrayalSettingsProps): JSX.El

// The description of the layer to be smoothed
const layerDescription = layersDescriptionStore.layers
.find((l) => l.id === props.layerId)!;
.find((l) => l.id === props.layerId)!; // eslint-disable-line solid/reactivity

// The bbox of the layer to be smoothed
const bboxLayer = bbox(layerDescription.data);
Expand Down
2 changes: 0 additions & 2 deletions src/helpers/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ export async function exportMapToPng(outputName: string, scaleFactor = 1) {
// eslint-disable-next-line no-param-reassign
const outputNameClean = cleanOutputName(outputName, 'png');

const mimeType = 'image/png';

let svgXml;
let context: CanvasRenderingContext2D;
let image: HTMLImageElement;
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/fileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
SupportedTabularFileTypes,
SupportedTextualTabularFileTypes,
} from './supportedFormats';
import { convertTopojsonToGeojson, convertToTopojsonQuantizeAndBackToGeojson } from './topojson';
import { convertTopojsonToGeojson } from './topojson';
import { detectTypeField, Variable } from './typeDetection';
import rewindLayer from './rewind';

Expand Down
2 changes: 1 addition & 1 deletion src/store/ClassificationPanelStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStore } from 'solid-js/store';
import { ClassificationMethod, ClassificationParameters, DiscontinuityParameters } from '../global';
import type { ClassificationParameters, DiscontinuityParameters } from '../global';

type ClassificationPanelStoreType = {
show: boolean,
Expand Down

0 comments on commit 298a227

Please sign in to comment.